FreeRTOS allocation problem

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

FreeRTOS allocation problem

Jump to solution
767 Views
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 Solution
615 Views
john71
Senior Contributor I

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

View solution in original post

4 Replies
616 Views
john71
Senior Contributor I

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

615 Views
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

615 Views
john71
Senior Contributor I

I see. Thank you.

0 Kudos
615 Views
danielchen
NXP TechSupport
NXP TechSupport

Thanks for sharing.

Regards

Daniel

0 Kudos