Updating user application FW using custom bootloader[XEP100]

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

Updating user application FW using custom bootloader[XEP100]

331 Views
Vaibhav_Mahajan
Contributor I

Hi,

I am trying to upload application firmware to flash memory using bootloader application. I am having MC9S12XEP100CVL controller.

We have bootloader and application to place in flash memory blocks. Memory mapping of the XEP100 in terms of blocks are mentioned below

Global AddressLogical AddressBlockSize
0x70_0000 - 0x73_FFFFC08000 - CFBFFFB3256K
0x74_0000 - 0x77_FFFFD08000 - DFBFFFB2256K
0x78_0000 - 0x79_FFFFE08000 - E7BFFFB1S128K
0x7A_0000 - 0x7B_FFFFE88000 - EFBFFFB1N128K
0x7C_0000 - 0x7F_FFFFF08000 - FFFFB0256K

 

We want to arrange the memory as shown below. The bootloader code is around 18KB, and user application is around 700KB.

Application TypeGlobal AddressLogical AddressDescription
User application Start0x7FC000C000ROM_C000 address range assignment for user application
User application End0x7FD7FFD7FFROM_C000 address range assignment for user application
User application vector Table[Start]0x7F7F107F10User application vector table range assignment
User application vector Table[End]0x7F7FFF7FFFUser application vector table range assignment
Bootloader Date Start0x7FD800D800Verification Data Range assignment
Bootloader Date End0x7FD805D805Verification Data Range assignment
Bootloader Code start0x7FDF00DF00ROM_C000 address range assignment for bootloader application
Bootloader code end0x7FFEFFFEFFROM_C000 address range assignment for bootloader application
Bootloader vector Table[Start]0x7FFF10FF10Bootloader vector table Range assignment
Bootloader vector Table [End]0x7FFFFFFFFFBootloader vector table Range assignment

 

Memory Arrangement:

Currently Our bootloader application is running in block 0 which performs following application

  • Erase complete flash memory.
  • Writing application firmware to flash memory
  • Switching from bootloader to user application

The code snippets of the .prm file for bootloader which defines the memory assignment is added below.

ROM_4000 = READ_ONLY 0x4000 TO 0x7F0F;
ROM_C000 = READ_ONLY 0xDF00 TO 0xFEFF; [Bootloader Code]

BL_DATA = READ_ONLY 0xD800 TO 0xD805; [Bootloader - Application Verification section]

The Bootloader is running in block 0 [bottom few sectors]. It uses address range [0x7FDF00 - 0x7FFFE0].

The code snippets of the .prm file for user application which defines the memory assignment is added below

/* Non-banked FLASH */
      /* Leave space for Vector table from 0x7F10 to 0x7FFF;  */
      ROM_4000      = READ_ONLY    0x4000 TO   0x7F0F;
      
      /* Leave space for Bootloader from 0xD800 to 0xFFFF */
      /* Note: D800 to DBFF reserved for Application Verification info written by bootloader */
      ROM_C000      = READ_ONLY    0xC000 TO   0xD7FF;

 The S19 file of application includes few of the remaining addresses from the block 0.

Limitation: The issue is XEP100 does not allow to perform any operation like erase and write on the unused flash addresses of particular Block where the code is running.

In our case we are using Block 0[256KB] for bootloader application which uses around 12 sectors [code and verification data] so we are not able to use remaining sectors of block 0 because of above mentioned limitation. 

So, one way is to place the user application code in other blocks. 

Questions:

1. What all changes we need in prm file for placing bootloader and user application?

2. Using other blocks for running the user application code.

   - Can you please share any example code or what all things we need to take care for running user application from different blocks?

3. finding a way to use the remaining block of the block 0.

   - Is there any way we can write to unused sectors of block 0 where my bootloader application is running?

Can you please suggest any way to fix these issues?

Please find attached parameter [.prm] files of bootloader and user application

 

0 Kudos
1 Reply

306 Views
lama
NXP TechSupport
NXP TechSupport

Hi,

As I have writen, the AN4258 can be taken as a development platform where it is explained. Also prinicple when RAM is used and critical part of the flash routine is explained in attached example. Extension of the last principle is explained as a DoOnStack routine. It is up to you which of them you will implement and use.

More was presented in your original  question...

https://community.nxp.com/t5/S12-MagniV-Microcontrollers/FW-update-using-bootloader-in-XEP100-HSC12X...

Best regards,

Ladislav

 

0 Kudos