Bootloader as a separate application

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

Bootloader as a separate application

842 Views
felipetraesel
Contributor I

CodeWarrior: 5.9.0
MCU: MCF51JM128

 

Hello,

 

I have a question: I've done a separate bootloader application for my code. So, in one project, I've build an .S19 file with the bootloader and transformed it into a .bin file.

Then, in a second project, I simply add the .bin file in the linker, (in the correct SECTION, I add the command INCLUDE xxxx.bin).

Both applications (bootloader and code) has USB hosts and FAT files treatment.

It is working properly, by the way.

The main issue is: as they are separate applications, both allocate room for the USB and FAT libraries, making the program too big, because the libraries are allocated in the bootloader section (a closed .bin file) and in the code section.

Is there a way of reutilizing the code? Or maybe another way of making the bootloader libraries visible to the main code?

 

Thank you in advance,

FelipeTraesel

Labels (1)
0 Kudos
4 Replies

496 Views
trytohelp
NXP Employee
NXP Employee

Hi Felipe,

I found this question/problem was posted on Service Request system.

A colleague replied to your question.

See below the feedback:

++++++++++++++++++++++++++

We have no examples but you can try linking the USB tack as a library.

You can open any example and remove the application code, then in menu Project > Properties > C/C++ Build > Settings > Build Artifact Tab you may choose Library as Artifact Type.

Then you can add this library to your bootloader and application and use only the functions you will need.

++++++++++++++++++++++++++


Have a great day,
Pascal

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

0 Kudos

496 Views
felipetraesel
Contributor I

Hello Pascal,

I tried this approach, of creating a library, but have found a few problems that will make this way of "sharing" the functions not useful for my needs, and would like to share with you, so then maybe we all can reach some solution.


The first issue was that when I build the target bootloader with the library, CodeWarrior generate a code that works for this project, that means, the struct variables of USB stack (CMX) my_address has their address in RAM memory built by the compiler.
But when I do the same with the firmware application, de compiler generate a very few different code, and the difference is in the address of the struct variables in the RAM memory. So, as I include a bootloader.bin in the main application linker, it makes somes functionalities of the USB stack not work properly.


The second issue is that this library I made (with the CMX USB stack and the CMX FAT) is the one responsible for making the linker allocate the functions that handles variables types, like int_to_d.o for example: (from the xMap)

0000A4B4 00000000 .text   _d_utod    (Project_usb_library.lib int_to_d.o )

And so, when I make some changes in the firmware, lets say, add some float variables, the float treatment functions will be added by my USB library, that is inside the "bootloader area", wich should not be changed.

I hope I could express myself, so that you can understand my problem.
Thanks for your support
Felipe

0 Kudos

496 Views
trytohelp
NXP Employee
NXP Employee

Hi Felipe,

Can I suggest you to continue to handle the problem via the SR ?

Please reply to the last email sent by the support team.

Regards

Pascal

0 Kudos

496 Views
felipetraesel
Contributor I

Ok Pascal,

Thank you for your time and attention, I'll reply to the SR.

Best Regards
Felipe

0 Kudos