We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
I am trying to understand STM32F4-Discovery startup code that is added automatically to Keil project. i.e.
github.com/.../startup_stm32f407xx.s
I am using Keil MDK v5. Everything is clear except the following portion:
;******************************************************************************* ; User Stack and Heap initialization ;******************************************************************************* IF :DEF:__MICROLIB EXPORT __initial_sp EXPORT __heap_base EXPORT __heap_limit ELSE IMPORT __use_two_region_memory EXPORT __user_initial_stackheap __user_initial_stackheap LDR R0, = Heap_Mem LDR R1, =(Stack_Mem + Stack_Size) LDR R2, = (Heap_Mem + Heap_Size) LDR R3, = Stack_Mem BX LR ALIGN ENDIF
My Questions are:
1. Whats the purpose of this portion? 2. How does it initializes Stack and Heap as it only load Stack/Heap addresses in R0-R3? 3. Where is __use_two_region_memory defined that is imported here?
I search a lot but couldn't find any proper explanation. Any clue/reference will be highly appreciable.
Thanks. The links are indeed very helpful.