MQX Loadable Tasks

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

MQX Loadable Tasks

Jump to solution
1,113 Views
mohwaqas12
Contributor III

Hello everyone,

Is it possible to run a small mqx binary/tasks from sd card instead of flashing it in rom. Just like how linux does in it using dynamic link loadable's .

What if , if  there is a way to compile a small executable mqx task and place it on sd card. and by using some way of loading it into ram and running it along with other mqx tasks.

I remember , i once asked the same thing and someone told me that its not possible due to some dependencies of harvard architecture, therefore i wanted to know about its possibilities

Regards

Tags (2)
0 Kudos
1 Solution
605 Views
Luis_Garabo
NXP TechSupport
NXP TechSupport

Hi Muhammad,

Unfortunately it is not possible to load modules in MQX as it is done with Linux. Basically it is because the OS is compiled together with the application. I see the linking as the big problem here. Once it is done, there is not an easy way to modify it and re-allocate the addressing of the code into the OS.

Best Regards,

Garabo

View solution in original post

0 Kudos
5 Replies
605 Views
mohwaqas12
Contributor III

Thank you Bryan , that was really helpful,  I would definitely try to implement bootloader for mqx as well

0 Kudos
605 Views
mohwaqas12
Contributor III

Thank you Garabo and Bryan Hunt for great answers.

Bryan , this means implementing bootloader along with mqx to update firmware remotely is technically  a difficult task. I have seen application notes as well as discussions on implementing bootloader for mqx , i have not really followed on them , but would eventually do once i reach that point.

0 Kudos
605 Views
BryGuyH
Contributor IV

Well a bootloader and application loader are different things. Setting up a bootloader with MQX is not a particularly difficult task (though there are some items that require one to be familiar with some low level code) but a bootloader is not expected to be resident in memory with the MQX application either. The difficulty comes in when one tries to seperate specific functions or modules from the main application and load them dynamically. That requires a much more intimate understanding of operating system design (again the elf spec is a great resource).

605 Views
BryGuyH
Contributor IV

For any processor able to execute instructions from RAM you can dynamically load and execute modules (this means a good number of the processors MQX runs on). But since MQX was not designed with this capability in mind you do end up with dependency issues that are not easily resolved. If the module you are loading is simple enough you could do this - if the module is complex and makes calls outside of it's address space you would have integration problems.

There are a number of examples of bootloaders that do this exact thing - but despite the technical feasibility I don't believe the time would justify the results and would suggest finding another way to accomplish the task (or select an embedded linux variant)

The basic steps you would take to implement this is:

* Dynamically create a task with enough stack space to handle the application being loaded (I suggest reading the elf specification to help you with that)

* Have the task allocate a block of memory for the code you wish to load

* load the executable code into the ram block paying attention to alignment

* jump to the entry address (do this by prototyping the function pointer to the address and calling it - i.e. the same way main() gets called behind the scenes) - again the elf spec would help you out.

By this point you've already re-invented the wheel...

606 Views
Luis_Garabo
NXP TechSupport
NXP TechSupport

Hi Muhammad,

Unfortunately it is not possible to load modules in MQX as it is done with Linux. Basically it is because the OS is compiled together with the application. I see the linking as the big problem here. Once it is done, there is not an easy way to modify it and re-allocate the addressing of the code into the OS.

Best Regards,

Garabo

0 Kudos