2013-06-14 03:41 AM
I cannot find the startup file and scatter file for Keil for FSMC_SRAM_DataMemory example in STM32F4xx_DSP_StdPeriph_Lib_V1.1.0.
Basically i want to use external memory on STM3240G eval board as my stack and heap space. I would appreciate if somebody can share these startup and scatter file for keil environment. Thanks #st-fsmc_sram_datamemory-example #fsmc_sram_datamemory-example2013-06-14 05:11 AM
Why would you use the slowest memory available for a stack?
From a prior version STM32F4xx_DSP_StdPeriph_Lib_V1.0.0\Project\STM32F4xx_StdPeriph_Examples\FSMC\FSMC_SRAM_DataMemory\readme.txt <li> MDK-ARM - in Project->Options for Target window, select 'RAM1'and enter 0x64000000 as start address with size of 0x100000 (IRAM1 must be un-checked) - uncomment ''#define DATA_IN_ExtSRAM '' in the ''system_stm32f4xx.c'' file STM32F4xx_DSP_StdPeriph_Lib_V1.0.0\Project\STM32F4xx_StdPeriph_Examples\FSMC\SRAM_DataMemory\startup\MDK-ARM\startup_stm32f4xx.s In the newer version what's wrong with the regular startup file? It has the external memory setup with DATA_IN_ExtSRAM defined.2013-06-14 08:28 AM
Thanks clive. Our main application uses internal RAM for stack and heap. But we have one calibration application for our sensor which only has to run once in factory so we can afford to compromise speed in this application. And calibration library uses lots of stack space which i can not accommodate in 192KB.
It worked for me but i have to check the IRAM1 checkbox although readme says IRAM1 must be un-checked. If i leave it unchecked then SP remains at 2000xxxx in my main function. If i am checking it then its changing to 6400xxxx.In the newer startup file i don't see the following lines :LDR R0, =__initial_sp ; restore original stack pointerMSR MSP, R0 Thanks again for your support.2013-06-14 09:23 AM
There are many ways to deal with this, I'd create a simple scatter file and modify the startup to suit.
The purpose of changing the stack setting to after SystemInit() is so that the external memory can be initialized BEFORE you cause the processor to use it. If SystemInit() has local variables these may need a stack, and at start up that's going to need to be in Internal SRAM, setting the initial SP in the Vector Table to 0x20002000 or something like that will achieve that goal. After it returns from SystemInit() you can move the SP to the External RAM as it should now be functional. You should also make your monster stack allocation in startup_stm32f4xx.s; *************************************************************
; *** Scatter-Loading Description File for STM32F4 ***
; *************************************************************
LR_IROM1 0x08000000 0x00100000 { ; load region size_region
ER_IROM1 0x08000000 0x00100000 { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
}
RW_IRAM1 0x20000000 0x00020000 { ; RW data
.ANY (+RW +ZI)
}
RW_IRAM2 0x64000000 0x00100000 { ; Ext
startup_stm32f4xx.o (STACK)
}
}
2013-06-14 08:55 PM
Thanks Clive for the sample scatter file.
Thank you so much for your prompt replies always :)