MQX combine bare metal

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

MQX combine bare metal

493 Views
martindusek
Contributor V

Hello,

is it possible to combine bare metal and MQX code? We developed a bare metal application for Kinetis K60 and now we realised that some MQX parts would be useful for us - task management, RTCS. We don't want to edit our bare metal code. Will we be able to call our bare metal drivers (some are interrupt driven) from MQX tasks?

Thanks

Tags (3)
0 Kudos
1 Reply

223 Views
RadekS
NXP Employee
NXP Employee

Yes, you can use pieces of bare metal code inside MQX tasks. However you have to take care about different programming approach (endless loop versus tasks) and carefully synchronize.

You can use also your own drivers, but you have to take care also about hardware initialization (some hw is already initialized in BSP code therefore you probably cannot simply copy-paste your bare metal code).

If you want handle interrupts outside of MQX, you have to update vector table:

  1. If you use vector table in ROM, you can edit vector table directly in vectors.c file.
  2. If you use vector table in RAM, you can use _int_install_kernel_isr() instead of _int_install_isr(). Of course, you cannot use any call of MQX API function (you can still use global variables…)

For example:

_int_install_kernel_isr(Vector, isr_ptr); /* works only for vector table located in the RAM */

_bsp_int_init(vector, priority, subpriority, enable);

  3. MQX managed isr are initialized by commands:

_int_install_isr(vector, isr_ptr, isr_data);

_bsp_int_init(vector, priority, subpriority, enable);


Best Regards,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos