How to push code to SRAM rather than FLASH

Sysprogs forums Forums VisualGDB How to push code to SRAM rather than FLASH

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #36590
    Sherlock
    Participant

    Can any community member shed light on how to do this?

    I gather I should add a second linker script (which I can create by creating a new empty project and specifying SRAM as target and then copying this script into my project, that gives me two scrips to choose from for linking, a “flash” one and a “sram” one). but what else must I do?

    I cant see any project options/settings that let me tell the system to push the code to SRAM as opposed to FLASH.

    My projects are STM32 F4 Nucleo projects FYI.

     

    Thank you.

     

    #36591
    bflannery
    Participant

    When you create your project you can specify generically  whether you want your program to execute from FLASH or SRAM.

    If you want the option to choose simply add another executable target and differentiate them by name. Then you could right click on the one you want to use and press “Set as startup target”. Assuming you are using cmake this can be done just by making two calls to add_bsp_based_executable with different NAME values. You can also specify the linkerscript via LINKER_SCRIPT within that call.

    Don’t forget to relocate your vector table in the SRAM version of your executable.

     

    • This reply was modified 9 hours, 11 minutes ago by bflannery.
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.