BASEPRI and Task Priority for Cortex-M4

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

BASEPRI and Task Priority for Cortex-M4

ソリューションへジャンプ
821件の閲覧回数
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 解決策
525件の閲覧回数
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 返答(返信)
526件の閲覧回数
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 件の賞賛
525件の閲覧回数
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 件の賞賛