cancel
Showing results for 
Search instead for 
Did you mean: 

Execute a binary file (code) from SDRAM on STM32F7 ?

Kaniel Outis
Associate II
Posted on May 20, 2018 at 16:13

Hi,

I want to execute my application code (binary file) from the SDRAM and not from internal flash.

I tried to begin with the example in the Cube FW package (FMC_SDRAM_MemRemap) but this example describes how to execute a function in sdram and not the whole code.

Could someone help me ? what should i modify to let the whole code (binary file .bin) executes from SDRAM ?

Thanks

Note that i'm using an STM32F756-Eval board

ELMHIRI.Syrine

‌

##external-sdram #sdram-fmc #sdram
7 REPLIES 7
Posted on May 20, 2018 at 22:37

Do you want to copy the code out of FLASH into SDRAM, or run in SDRAM directly from the debugger?

In the debugger case you'll need to make a debugger script, or initialization file, that stands up all the clocks, pins, controller and memory for your specific board/parts before the debugger can download and execute for there.

For an application you'd get the linker to build an image for the SDRAM address, and then make a small FLASH based loader to stand up the SDRAM, copy the image, and then transfer control to it.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 21, 2018 at 00:18

<< In the debugger case you'll need to make a debugger script, or initialization file, that stands up all the clocks, pins, controller and memory for your specific board/parts before the debugger can download and execute for there. >>

I didn't understand you, sorry!

I thought I must change something in the linker file and in the startup file in order to run my code from SDRAM. 

All i want is to execute the code from the SDRAN and not from FLASH.

what shoud i do ?

Posted on May 21, 2018 at 00:20

Could you detail the steps to do and what should I change/add please

Posted on May 21, 2018 at 13:42

Changing the linker settings is one issue.

How are you planning on getting the code into the SDRAM?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 23, 2018 at 10:56

getting the code into the SDRAM isn't a problem. I can use ST-Link Utility to program the bin file into the SDRAM. or I can use the STM32Cube programmer.

The problem is what changes do I have to make i order to execute the code from SDRAM : tell the PC (program counter) to point to the instructions inside SDRAM : boot from SDRAM

Posted on May 23, 2018 at 13:22

Control transfer to code in SDRAM is no different from any other memory range.

External SDRAM comes in many forms, using different chips, pins, bus widths etc. The processor doesn't know what you have attached. You're not going to 'boot' into SDRAM. You need minimal code, or scripting, to configure the interface before the memory is accessible.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 23, 2018 at 14:18

Turvey.Clive.002

‌ has outlined the steps already.

Please respect Clive's time, and try to see what you have been given.

You need minimal code <- You need to start from Flash and set up the SDRAM configuration.

Inform the linker that your 'Payload code' starts within the SDRAM.

Transfer your payload from the source to the SDRAM at the specific address, execute.

( executing from Flash is faster code, the internal memory flash fetch is much wider than 32bits.)

Please review Clive's verbose answers above.