merge Bootloader and application

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

merge Bootloader and application

1,805 Views
mojtaba_al22
Contributor II

Hi guys,

I have a Bootloader and application files in project with part of S912G128MLL, and I want to merge and write them in the flash, Please tell me where to start.

TNX

Labels (1)
3 Replies

1,616 Views
RadekS
NXP Employee
NXP Employee

Hi Mojtaba,

There are more ways how to do it.

The simplest is method is direct editing *.s19 (*.sx) file and copy flash content from one file into another.

You may also use SRecCvt tool for sorting data in the final S-record file.

 

The next option is including your bootloader S-Rec file into your application project (or opposite) by simple line in *.prm linker file.

For example:

HEXFILE bootloader.s19‍

For more details, please check chapter 8 in AN4258

For more details regarding *.prm linker file, please follow "c:\Freescale\CW MCU v11.0\MCU\Help\PDF\MCU_Build_Tools_Utilities.pdf" document. 


I hope it helps you.

Have a great day,
Radek

1,616 Views
mojtaba_al22
Contributor II

Hi Radek,

*/The simplest is method is direct editing *.s19 (*.sx) file and copy flash content from one file into another.*/

If it's possible please explain this method more.

Thank you for your post. 

Best Regards,

Mojtaba

0 Kudos

1,615 Views
RadekS
NXP Employee
NXP Employee

Hi Mojtaba,

The bootloader and application code must be located at different address areas. Any Flash sector which share bootloader and application code is potential source of issue. Therefore bootloader-application border must be aligned by flash sector size.

So, there should not be also any overlapping in s-recod files.

 

Every s-record line contains S record type identifier, length, address, data, and CRC. SREC (file format) - Wikipedia 

The S-Rec files are text files. You may simply copy all S1/S2 lines (starting by “S1” or “S2”) from the bootloader s19 file into application s19 file (or opposite).

You may ignore all lines except S1/S2 - like lines starting with S0 (file header) or S9 (at end of file).

Note: The S3  format is not relevant for 16bit MCUs.

 

If there is overlapping at addresses with reset vector(s) use lines from bootloader code.

Please check AN4258 for more details.