Using External Memory with FreeRTOS in STM32F

francisco-moon wrote on Wednesday, March 28, 2012:

I designed STM32F207ZG and I have a external SRAM with 1MBytes.

I used an example in st web-site. (FreeRTOS + lwIP)

From orginal project, I can read/write the external SRAM without runnig FreeRTOS , but I can’t run my FreeRTOS kernel using external SRAM.

I modified scatter file in uVision , but it didn’t work :

; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************

LR_IROM1 0x08000000 0x00100000  {    ; load region size_region
  ER_IROM1 0x08000000 0x00100000  {  ; load address = execution address
   *.o (RESET, +First)
   .ANY (+RO)
  RW_RAM1 0x60000000 UNINIT 0x00100000  {  ; RW data
   heap_2.o(+RW +ZI)
  RW_IRAM1 0x20000000 0x00020000  {
   .ANY (+RW +ZI)

Do you have any idea to solve this problem?

Please help me…

rtel wrote on Wednesday, March 28, 2012:

Can you clarify “can’t run the kernel with external SRAM”?  What in the kernel is using the external RAM rather than the internal RAM?  Are the task stacks in external RAM, the kernel data, the main() stack, etc.?

If you can run a non FreeRTOS application with the external RAM then there should be no reason why you cannot run a FreeRTOS application as it would appear the external bus interface is being set up correctly (are you sure you non-FreeRTOS application is actually using the external RAM and is not contained in the internal RAM?).

The other thing to look for is that the start up code is clearing data to zero and initialising data correctly even when the data is in external RAM.


francisco-moon wrote on Thursday, March 29, 2012:

Thanks a lot.
I checked the start up code. It was a mainly problem.
For using an external memory in STM32F, I have to modify it.

__initial_spTop EQU    0x20000400                 ; stack used for SystemInit & SystemInit_ExtMemCtl
;__Vectors       DCD     __initial_sp               ; Top of Stack
__Vectors       DCD     __initial_spTop            ; Top of Stack