FreeRTOS ,S32K312 chip, the configTOTAL_HEAP_SIZE modify

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FreeRTOS ,S32K312 chip, the configTOTAL_HEAP_SIZE modify

Jump to solution
1,312 Views
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 Kudos
Reply
1 Solution
1,239 Views
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

View solution in original post

0 Kudos
Reply
3 Replies
1,299 Views
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 Kudos
Reply
1,286 Views
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 Kudos
Reply
1,240 Views
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 Kudos
Reply