cancel
Showing results for 
Search instead for 
Did you mean: 

Code execution from external RAM

mbadanai
Associate II
Posted on October 19, 2009 at 12:31

Code execution from external RAM

#fsmc-code-execution-slow-in-sram #poorly-chosen-micro
11 REPLIES 11
mbadanai
Associate II
Posted on May 17, 2011 at 13:23

I'm using STM32F103ZE and i want to copy and execute firmware code from external RAM (not external NOR flash!)

Does anyone has a source code for this?

Thanks

picguy
Associate II
Posted on May 17, 2011 at 13:23

You simply write the code. You (with any required hardware help) put the code at the external address. You bl to the code. QED (Quite Easily Done)

But as another post explains your code execution will be S...L...O...W. Indeed, code executing out of internal RAM is slower than code executing out of internal flash.

mbadanai
Associate II
Posted on May 17, 2011 at 13:23

For a test, i've build a bootloader that load firmware code into SRAM, External RAM, Flash and execute it. The test firmware generate a square wave made with a ''for'' delay cycles.

The results about code running speed time is amazing! I've used STM3210E-EVAL board...

I've measured with scope the semiperiod of square wave and this is the results:

Code running into SRAM : 82 msec

Code running into FLASH (internal): 100 msec

Code running into External SRAM : 636 msec :o :o :o !!!!!!!

Execution code from external RAM is not a good solution!!!

I attach the images of square wave generated from code of SRAM and External RAM.

Any comments?

st3
Associate II
Posted on May 17, 2011 at 13:23

Quote:

If your program is so large you need to run out of external memory you probably need a processor with more horsepower.

Or, at least, with more internal memory!

obtronix
Associate II
Posted on May 17, 2011 at 13:23

not surprising, the STM32 external bus is designed for data storage, not for code execution (to save money).

If your program is so large you need to run out of external memory you probably need a processor with more horsepower.

sarang
Associate II
Posted on May 17, 2011 at 13:23

Can you post the code you used for the bootloader?

I am new to ARM Cortex and we want to do execute code out of external RAM.

mbadanai
Associate II
Posted on May 17, 2011 at 13:23

I attach you the file LoadExtRam.c that load a binary into external ram and execute it. The binary code of firmware must be in an array binFirmware.

This code assume that interrupt vector of firmware to be loaded is located in RAM and not in flash!

Also, i attach you the ICF files used to generate BIN of firware that you want to load into external RAM

sarang
Associate II
Posted on May 17, 2011 at 13:23

Thanks for the quick response! Appreciate it!

sarang
Associate II
Posted on May 17, 2011 at 13:23

Is binFirmware a byte array or a 16 bit unsigned char array?