Hi everyone, I`m having trouble with my task´s memory. The thing is as follows: I have several tasks, as ETH task, an SD (writing/erasing) task, a mifare task, a biometric device control task, among others. I`m running out of memory and my device is working right on the boundaries and if i want to modify the memory of one of them, right away another one starts to work badly. Is there by any chance a way to make this memory assignment dynamically? Right now I`m making the assignatios like this:
TASK_TEMPLATE_STRUCT MQX_template_list[] =
{
/* Task number, Entry point, Stack, Pri, String, Auto? */
{GPIO_TASK, Gpio_task, /*1500*//*1000*/1000,12, "GPIO", MQX_AUTO_START_TASK},
{LCD_TASK, Lcd_task, /*1500*//*1000*/900, 12, "LCD", MQX_AUTO_START_TASK},// ojo modificado por miguel para lo de conalvias
MORPHOSMART_TASK_TAMPLATES,
// WISMO_TASK_TAMPLATES,
//{MODEM_TASK, Modem_task, 1500, 11, "MODEM", MQX_AUTO_START_TASK}, // Ojo agregado por miguel para lo de conalvias
//{CBM_TASK, Cbm_task, 1500, 10, "CBM", MQX_AUTO_START_TASK},
{ETH_TASK, Eth_task, /*1300*/1000, 9, "ETH", 0}, // ojo modificado por miguel para lo de conalvias
{RTC_TASK,rtcinit_task,800,10,"rtcinit",MQX_AUTO_START_TASK},
{MIFARE_TASK, mifare_task, /*1500*/1000, 10, "mifare", 0},
{MIFARERX_TASK,mifarerx_task, /*1500*/1700, 9, "mifarerx",0},
{T_TASK, t_task, /*1000*/1500 ,12, "TIMER", /*0*/MQX_AUTO_START_TASK},
{SD_TASK, Install_SD, /*2500*/2800 ,12, "SD_Task",MQX_AUTO_START_TASK},
{PRINCIPAL_TASK, Principal, /*1500*/800 ,12, "Principal_Task",MQX_AUTO_START_TASK},
//{RECIEVE_TASK, Recieve_task, 200 ,12, "Recieve",MQX_AUTO_START_TASK}, // Ojo tarea agregada por miguel para lo de conalvias
//{WIEGAND_TASK, Wiegand_task, 800 ,12, "Wiegand",MQX_AUTO_START_TASK}, // Ojo tarea agregada por miguel para lo de aireflex
{0, 0, 0, 0, 0, 0, }
};
Thank you in advance for your time and cooperation.
BR
Hello Camilo A Camacho D,
Chongbin Fan made a good point to direct you right direction. The stack size of each task is statically allocated, not dynamically. Stack usage plug-in for MQX serves as watermark - highest usage of a stack per task.
This thread is also related to stack size and how a user solved a problem with a stack overflow : How to determine how much stack is used in a task
Regards,
c0170
Hi Camilo,
What's the meaning of "if i want to modify the memory of one of them"? Changing the stack size of the tasks.
MQX did not support stack increasing in run-time, so it is programmer's responsibilty to figure out the stack size of the tasks. A good news is that the stack usage can be get using MQX plug-in. So you can set a breakpoint in the deepest call stack of the task, and then check the stack usage of the task .
Another option is "#define MQX_MONITOR_STACK 1" to make MQX fill 0x7374616B("stak") to the task's stack when the tast being created. Then after the task run for a while, you can dump the task's stack using JTAG tool to figure out the maxium usage ever.