BASEPRI and Task Priority for Cortex-M4

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

BASEPRI and Task Priority for Cortex-M4

跳至解决方案
838 次查看
razed11
Contributor V

Hi,

The user guide shows a table of values for task priorities 0-7. The "writing your first MQX application" document suggests that any task defined by the application should not be between 0-8.

What is BASEPRI for tasks above 8?

What is the range of values for priorities? What is the highest numerical value?

A queue is created for each priority so I understand that it will increase memory but is this done dynamically or statically (by a configuration constant)?

I chose to define a single spawn task in the task template. My other tasks are created dynamically.

Thanks,

Kenny

0 项奖励
1 解答
542 次查看
danielchen
NXP TechSupport
NXP TechSupport

Hi Kenny:

The BASEPRI for tasks above 8 is 0x0;

As you said, a queue is created for each priority queue, it will increase memory. it is done statically.

you can refer to the following code, in function _psp_init_readyqs

q_ptr = (READY_Q_STRUCT_PTR)_mem_alloc_zero(sizeof(READY_Q_STRUCT) * priority_levels);

so the highest priority is determined by how much memory you allocated. I have tried this in TWR-K60F120,  the highest priority is between 7500-7800


Have a great day,
Daniel

在原帖中查看解决方案

0 项奖励
2 回复数
543 次查看
danielchen
NXP TechSupport
NXP TechSupport

Hi Kenny:

The BASEPRI for tasks above 8 is 0x0;

As you said, a queue is created for each priority queue, it will increase memory. it is done statically.

you can refer to the following code, in function _psp_init_readyqs

q_ptr = (READY_Q_STRUCT_PTR)_mem_alloc_zero(sizeof(READY_Q_STRUCT) * priority_levels);

so the highest priority is determined by how much memory you allocated. I have tried this in TWR-K60F120,  the highest priority is between 7500-7800


Have a great day,
Daniel

0 项奖励
542 次查看
razed11
Contributor V

Thanks for the clarification. I think that is a dynamic run-time initialization using a custom memory manager. 7500-7800! I hope I don't need that many.

BASEPRI, for others reading this, disables the masking function allowing any interrupt to run.

I feel like I have a good grasp of the tasking now. I have a C++ Task class that gives me some key functions and I've ported the QP state machine framework which makes use of the lightweight queues. I'm ready to start building on top of this. TCP/IP is next!

K

0 项奖励