How to link Application and Flash bootloader together for S12? What changes we have to do in PRM file or code?

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

How to link Application and Flash bootloader together for S12? What changes we have to do in PRM file or code?

975 Views
anandk13
Contributor II

I have two separate projects - App and Boot. I want to link Bootloader to my application and flash the generated s-record file. How to link my BL to my application? What modifications might come in the PRM file of the application

0 Kudos
7 Replies

704 Views
kef2
Senior Contributor IV

Anand,

I always include bootloader S-records in application, adding

HEXFILE

      bootloader.s19

to application's PRM file.

To produce application only S-records file, I'm using modified burner.bbl file, which produces two S-records files, one with bootloader included, and another one without bootloader.

It's easy to create such bbl file. Open your default bbl, copy everything and paste-insert the copy as you wish at bottom or at top of your bbl file. Then in the copy edit the output file name, for example like this

OPENFILE "%ABS_FILE%-no-bootloader.s19"

Now find the "segment", which belongs to bootloader. If bootloader is at 0xF000, then you need to add len=N line and change N to make bootloader not included in "%ABS_FILE%-no-bootloader.s19" :

origin = 0x00C000       /* nonpaged C000 */
len = 0x3000            /* excluding bootloader, 0x3000 instead of default 0x4000 */
destination = 0x00C000
SENDBYTE 1 "%ABS_FILE%"

After these PRM+BBL mods everything is neat. Click run to make app code + bootloader uploaded to target for debugging. Also two s-files are produced. Full one for factory programming, app-only for upgrading via bootloading.

704 Views
anandk13
Contributor II

Hi,

So would two .map file be generated?

regards

Anand 

0 Kudos

704 Views
RadekS
NXP Employee
NXP Employee

Hi Anand,

In fact, yes, but not simultaneously.

When you build bootloader project, map file for bootloader is generated.

When you include bootloader s19 file into application (by HEXFILE), the included data presents just some bytes without any meaning or direct connection to the application code. When you build application, map file for application is generated.

So, you will not get single map file for both bootloader and application this way.

I hope it helps you.

Have a great day,
Radek

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

704 Views
kef2
Senior Contributor IV

Hi

No, as usually, single map file, single ELF and one additional S-file. I don't remember HEXFILE in PRM produces any changes in map file, perhaps no. Anyway, HEXFILE-included bootloader debugger symbols are not included in ELF file and you can't debug HEX-included debugger, just run it and debug application.

BTW, some CW for some derivatives produces two S-records files by default, one with banked addresses in S-records (*.s19), another one with linear (*.phy) or global (*.glo) addresses. All S-records processing is defined in BBL file. You need to figure what part of BBL to copy and modify to produce additional S-records file with eliminated bootloader S-records. Perhaps you don't need it? Then HEXFILE mod in PRM is enough.

Regards,

Edward

0 Kudos

704 Views
RadekS
NXP Employee
NXP Employee

Hi Anand,

Could you please specify which S12 family you use and type of your bootloader?

 

The basic steps are nicely described in AN4258 Serial Bootloader for S12(X) Microcontrollers Based on 180 nm Technology – chapter 8 How to merge the user application and bootloader:

http://www.nxp.com/files/microcontrollers/doc/app_note/AN4258.pdf

 

Note: please be aware that some steps depends on used bootloader implementation (like step2) and some are needed only for specific S12 families (like step 6)…

I hope it helps you.

Have a great day,
Radek

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

0 Kudos

704 Views
anandk13
Contributor II

Hi

Could you please specify which S12 family you use and type of your bootloader?

S12G, Flash Bootloader

0 Kudos

704 Views
RadekS
NXP Employee
NXP Employee

Hi Anand,

Thank you for information.

I suppose, that you mean Flash Bootloader tool from Vector. Correct?

Unfortunately, I don’t have personal experience with that SW tool. Therefore steps 2 and 3 should be modified per Flash Bootloader architecture/configuration.

 

Note: The step 6 assumes that content of Flash Configuration Field at 0xFF08~0xFF0F is already part of bootloader.

I hope it helps you.

Have a great day,
Radek

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