Tuesday, March 20th 2018, 4:53am UTC+1

You are not logged in.

  • Login
  • Register



Date of registration: Feb 29th 2016

Posts: 103


Friday, March 9th 2018, 12:31pm

Ways of setting Starting Stack Pointer Value

Currently in SES you can use symbol or hex value to set initial stack pointer value (Debug-> Debugger .. ).

It would be great if there were other ways to do this - particularly through script or SES' macros expansion & execution.

E.g. I would like to use this l33t script function (with emScript):

function get_sp_val_from_bin(){
//Note: bin_file_full_path must be defined when calling the script with -define
//The bin file for a Cortex M will have SP value as first word / 32bit
BinaryFile.load( bin_file_full_path );
var val = BinaryFile.peekUint32(0, true);
return val;
spval = get_sp_val_from_bin();

WScript.Echo( "0x" + spval.toString(16) );

and then in SES specify the intial SP value with possibly something like:

$(StudioDir)/bin/$(StudioScriptToolExeName) -define 'bin_file_full_path'='$(ProjectDir)/$(OutDir)/hello_world.bin' -load $(ProjectDir)/initial_sp.js



Super Moderator

Date of registration: Jan 2nd 2017

Posts: 817


Tuesday, March 13th 2018, 9:25am


Thank you for your suggestion.
We will discuss this approach in our next meeting.

Best regards,