[SOLVED] Ways of setting Starting Stack Pointer Value

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] 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

    :whistling:
  • Hello,

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

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hello,

    Did it make it into the upcoming release?

    This will not be implemented yet as the final decision is not made yet.

    For now if the SP is not set correctly through download as it is usually expected we recommend setting it through the application.

    We will consider this thread as solved now.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.