cancel
Showing results for 
Search instead for 
Did you mean: 

How to execute code from external SRAM?

ngtbinh
Associate II
Posted on May 26, 2016 at 06:09

Hello,I'm just starting with cortex-m3 and with gnu arm toolchain

Myquestion may be stupid.

What I wanted to ask:

1.I know that during the development it is posible to keep everythingcode and data in SRAM and not to program FLASH.Because the internal SRAM in the Cortex-m3 is 64KB max it may not bebig enough.Is it posible to program External SRAM ?

2. Is it posible to program internal Flash ? Andhow to do that if yes? What is the sequence of commands in GDB?

3.Is it posible to program external FLASH ?Many thanks

3 REPLIES 3
Walid FTITI_O
Senior II
Posted on May 26, 2016 at 13:03

Hi nguyen.binh,

Yes you can execute code from external memory. You can do that by programming Flash memory interface (FMC). . Check FSMC examples in

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software/stm32cubef4.html

at this path:

STM32Cube_FW_F4_V1.12.0\Projects\STM324xG_EVAL\Examples\FSMC

In device that embed QSPI, you can do that using QSPI. I recommend you to check the ''QSPI_ExecuteInPlace'' example at

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software/stm32cubef4.html

packagre at this path:

STM32Cube_FW_F4_V1.12.0\Projects\STM32469I_EVAL\Examples\QSPI\QSPI_ExecuteInPlace

-Hannibal-
Radosław
Senior
Posted on May 26, 2016 at 17:13

Saving Flash for debugging purposses make no sense. Even often and hard debiging will never broke flash. 10000. (this value is only guaranted can bo more).

1. Yes it is posible, but any power off will caouse losing. Vector table must be relocated etc.

2. Aby debugger must and can program internal flash. IDE usualy can do this autimatically. (gbd instruction load) - but IDE usualu can do this automaticcaly.

3. Programing external flash by GDB (in true OpenOCD) is posible, but hard for begginers. For this use STLink Utility.

Posted on May 26, 2016 at 17:15

The Cortex-M3 is not limited to 64KB of Internal SRAM, the part you have chosen might, if you need more consider picking a part that delivers more.

You can run/debug code in External RAM, it will execute significantly slower, and depends if the region is decoded to allow execution. What the debugger will need to do is run a script to enable the external memory, ie the pins, the controller, and the memory itself, so that code can be downloaded there.

Most debug tools have loaders that can write to Internal Flash, review the documentation, or pick one that does it for you. Look at tools like the ST LINK Utilities.

You can read/write to any memory you attach to the system. External memory requires you define the board's/part's specific connectivity to the system, this tend to be unique rather than identical in the Internal Flash case. You must either script the debugger to access the external device, or provide a flash loader for tools like ST-LINK Utilities to program your chosen memory.

You can write you own code to write to the external memory, and deliver data via the USART, etc.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..