MQX 4.2 Task Stack Allocation & Compiler Optimization

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

MQX 4.2 Task Stack Allocation & Compiler Optimization

1,098 Views
jasonscott
Contributor IV

Good Afternoon,

I am having serious memory issues and i need help understanding a few things.

For starters here is some background information about what i am trying to do:

I am working on a custom board using the k60 processor.

I am using the KDS 3 with the GCC compiler.

What I need help with:

1) How do MQX tasks/sub-tasks allocate stack size & location?I currently run multiple sub tasks out of my "main task". I setup my SD card, start the shell, and a few other things. After entering a third task i feel like i am running out or stack space to allocate.

pastedImage_4.png

The screenshot above is right before i start my next task. After i enter the task, the MQX stack usage window goes gray and i can not see any information. however, i checked the stack pointer and i am at 0x1fffe938. I think i am expanding into another region or something.

2) Can I set a stack space for each individual task in external ram? If so, could i please see an example?

3) I read that the boot_stack is only used for the interrupts and a few basic things, are all of my MQX tasks running out of the boot_stack? Probably not right?

4) Does anyone have any recommendations on if building the bsp library's using optimizations/ debugging would alter my memory vs a release version? Again I am using the GCC 4.8.

 

Thanks for your time,

Any information or things to try would be appreciated! 

4 Replies

723 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Jason:

1) Memory for task's stack is allocated dynamically when the task is created from the default memory pool. This default memory pool is used also for memory allocation from other kernel components, like semaphores and so on.

2) Yes, you can. To start a task with its stack in a given memory, use _task_create_at() function; there you can give the stack_ptr and stack_size to point to a DDR2 location /SRAM location

Regards

Daniel

723 Views
jasonscott
Contributor IV

Hi Daniel,

Thanks for your response!

That information was helpful!

Would you happen to know of any documentation that I could read to learn more?

Thanks for your time,

Jason

0 Kudos
Reply

723 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Jason:

The MQX documents are under the MQX installation folder,

Freescale_MQX_4_2\doc\

pastedImage_1.png

The deference between Release mode and Debug mode, is in Debug mode there will be debug information added into the executable.  And the optimization level is different.

Regards

Daniel

723 Views
jasonscott
Contributor IV

Hi Daniel,

Sorry its taken me a bit to respond.

Thank you for the information and clarification.

-Jason

0 Kudos
Reply