FreeRTOS ,S32K312 chip, the configTOTAL_HEAP_SIZE modify

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

FreeRTOS ,S32K312 chip, the configTOTAL_HEAP_SIZE modify

跳至解决方案
737 次查看
guochuan
Contributor III

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

MEMORYMEMORY

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

0 项奖励
1 解答
664 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

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

在原帖中查看解决方案

0 项奖励
3 回复数
724 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

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

 

0 项奖励
711 次查看
guochuan
Contributor III

FreeRTOSConfig.hFreeRTOSConfig.hIf 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

0 项奖励
665 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

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

0 项奖励