BASEPRI and Task Priority for Cortex-M4

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

BASEPRI and Task Priority for Cortex-M4

Jump to solution
797 Views
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 Kudos
1 Solution
501 Views
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

View solution in original post

0 Kudos
2 Replies
502 Views
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 Kudos
501 Views
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 Kudos