FreeRTOS allocation problem

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

FreeRTOS allocation problem

跳至解决方案
1,827 次查看
john71
Senior Contributor I

I use MK10FN1M0xxx12.

I create two tasks

FRTOS1_xTaskCreate((TaskFunction_t)operation_task, (signed char*) "tx", 1024, NULL, 1, NULL); FRTOS1_xTaskCreate((TaskFunction_t)log_managment_task, (signed char*) "rx", 512, NULL, 1, NULL);

It runs OK.

But if I increase the stack size

FRTOS1_xTaskCreate((TaskFunction_t)operation_task, (signed char*) "tx", 1024, NULL, 1, NULL); FRTOS1_xTaskCreate((TaskFunction_t)log_managment_task, (signed char*) "rx", 1024, NULL, 1, NULL);

I fall into FRTOS1_vApplicationMallocFailedHook

And I have  #define configTOTAL_HEAP_SIZE (24576) /* size of heap in bytes */

How to fix the problem?

1 解答
1,675 次查看
john71
Senior Contributor I

Sorry. Found the problem. Should increase  heap size #define configTOTAL_HEAP_SIZE (32768)

在原帖中查看解决方案

4 回复数
1,676 次查看
john71
Senior Contributor I

Sorry. Found the problem. Should increase  heap size #define configTOTAL_HEAP_SIZE (32768)

1,675 次查看
BlackNight
NXP Employee
NXP Employee

Hi,

just a comment:

xTaskCreate((TaskFunction_t)operation_task, (signed char*) "tx", 1024, NULL, 1, NULL);

this means you actually are requesting 4KB (4*1024 bytes) of stack space.

This of course depends on your application, but is rather high, and you maybe only wanted to reserve 1024 bytes of stack?

Erich

1,675 次查看
john71
Senior Contributor I

I see. Thank you.

0 项奖励
回复
1,675 次查看
danielchen
NXP TechSupport
NXP TechSupport

Thanks for sharing.

Regards

Daniel

0 项奖励
回复