In the RVCT cstartup.s file the stacks and heap are created. I'm usually not paying much attention to startup files, but while the application grows I started to look deeper to get better understanding of what is happening to not get any surprises in the future.
The stacks and heaps should be mapped like this using my custom scattering file: (yes, its an STM32F407)
0 Statics
1 MSTACK
2 HEAP
3 CSTACK
All 0x1000 size.
Code: Select all
; RW data SRAM1 - 64 kB
RW_IRAM1 0x20000000 0x1C000 {
.ANY (+RW +ZI)
}
; RW data SRAM2 - S-bus only
RW_IRAM2 0x2001C000 0x4000 {
.ANY (+RW +ZI)
}
; Core Coupled Memory - D-bus only
RW_IRAMCCM 0x10000000 EMPTY 0x10000 {
}
They are mapped to ram like this:
Code: Select all
...statics...
0x2000cf30 0x00001000 Zero RW 2124 CSTACK cstartup.o
0x2000df30 0x00001000 Zero RW 2125 HEAP cstartup.o
0x2000ef30 0x00001000 Zero RW 2123 MSTACK cstartup.o
__heap_base__=Image$$RW_IRAM1$$ZI$$Limit
...remainder free mem sram1 used by memcore...
__heap_end__=Image$$RW_IRAM2$$Base
All I'm asking is an explanation how this stack/heap memory management is supposed to work with Chibios 2.6.5, since this is unclear to me.
Now it looks like I'm wasting MSTACK and HEAP since when I browse there in memoryview only 0's appear.