stm32duino / STM32FreeRTOS

Real Time Operating System implemented for STM32
312 stars 61 forks source link

How to set the value heap and stack in the .ld file? #38

Closed KiraVerSace closed 3 years ago

KiraVerSace commented 3 years ago

OK, Here is my problem, and I was confused. I use five tasks in my main.cpp like this:

    xTaskCreate(periphRunTask,      (const portCHAR *)"PeriphRun",      512,    NULL,   6,  NULL);
    xTaskCreate(sensorSampleTask,   (const portCHAR *)"Sensor",         256,    NULL,   5,  NULL);
    xTaskCreate(dataHandleTask,     (const portCHAR *)"DataHandle",     512,    NULL,   4,  NULL);
    xTaskCreate(socketLTERunTask,   (const portCHAR *)"LTESocket",      1024,   NULL,   3,  NULL);
    xTaskCreate(socketWaterRunTask, (const portCHAR *)"WaterSocket",    1024,   NULL,   2,  NULL);

and in my ldscript.ld file , I set the heap size like this:

/* Generate a link error if heap and stack don't fit into RAM */
_Min_Heap_Size  = 0x200;;       /* 0x400 1KB 一般由程序员分配和释放,分配方式类似于数据结构中的链表     */
_Min_Stack_Size = 0x800;;       /* 0x800 2KB 由编译器自动分配和释放,如存放函数的参数值,局部变量的值等   */

and default use #define configUSE_NEWLIB_REENTRANT 1

but I dont know how to set them with right value, my problem often run to hardfault, When I use tasklist to see the statck size, it is useless.

Could you help me?

fpistm commented 3 years ago

You should try to get support on the forum: https://www.stm32duino.com. here this is to report issue with the library. Your issue is mainly for usage.