Based on the official FreeRTOS demo of the S32K312 chip, the configTOTAL_HEAP_SIZE was modified lead to main function could not be accessed
1、Modify the memory allocation in the link file as follows
2、If I change the stack to be smaller than 30K or larger than 60K, the program can run normally. However, if the stack is between 30K and 60K, the main function cannot enter
Solved! Go to Solution.
Hi @guochuan,
I tested your configuration (linker + HEAP size (1024 * 65)) and it fails (MemManage Fault) in Clock_Ip_InitClock() at a write to 0x2040F394
00406690: str r0, [r5, #0]
This is because of the MPU configuration in system.c
Confirmed by disabling the MPU:
/* Enable MPU */ // S32_MPU->CTRL |= S32_MPU_CTRL_ENABLE_MASK;
Regards,
Daniel
Hi @guochuan,
Can you please list all the modifications you made?
How did you changed the configTOTAL_HEAP_SIZE?
You allocated 4KB for the stack, so I don't understand this sentence:
"If I change the stack to be smaller than 30K or larger than 60K..."
Regards,
Daniel
If I change the configTOTAL_HEAP_SIZE to 1024*60,compilation can pass, but not into the main function。
But when I change the configTOTAL_HEAP_SIZE to less than 1024*30, the compilation will go through and the program will work。
Attached is the map file I compiled and generated. Please check whether there are any exceptions
Hi @guochuan,
I tested your configuration (linker + HEAP size (1024 * 65)) and it fails (MemManage Fault) in Clock_Ip_InitClock() at a write to 0x2040F394
00406690: str r0, [r5, #0]
This is because of the MPU configuration in system.c
Confirmed by disabling the MPU:
/* Enable MPU */ // S32_MPU->CTRL |= S32_MPU_CTRL_ENABLE_MASK;
Regards,
Daniel