2009-10-19 03:31 AM
Code execution from external RAM
#fsmc-code-execution-slow-in-sram #poorly-chosen-micro2011-05-17 04:23 AM
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? Thanks2011-05-17 04:23 AM
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.2011-05-17 04:23 AM
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?2011-05-17 04:23 AM
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!2011-05-17 04:23 AM
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.2011-05-17 04:23 AM
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.2011-05-17 04:23 AM
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 RAM2011-05-17 04:23 AM
Thanks for the quick response! Appreciate it!
2011-05-17 04:23 AM
Is binFirmware a byte array or a 16 bit unsigned char array?