I’m working on creating a Cortex-M4 project using the MPU version of FreeRTOS. The target processor is the STM32F303RE.
To summarize the issue I’m having: global BSS data in FreeRTOS privileged areas is not being cleared to 0 on init.
I’m using a linker script based on FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/GCC_Specific/sections.ld but with the proper ROM and RAM areas for this MPU:
ROM (rx) : ORIGIN = 0x08000000, LENGTH = 128K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K
The startup assembler file is the ST CMSIS startup file which comes with their standard peripheral library. Stepping through the Reset_Handler code, I see that it does a BSS init to zero for my application data. But this does not include variables in FreeRTOS privileged areas. This results in crashes when I start creating tasks, since structures like pxReadyTasksLists are essentially uninitialized.
My guess is that the startup assembler code needs to initialize a second BSS area and possibly also copy initialized data from ROM to RAM for another area for FreeRTOS. Or maybe there is something wrong with the linker map, where these areas should somehow be combined but still marked as privileged? Is there a startup assembler file I can look at for an MPU port? Any other ideas?