Encapsulate the generated image into a header and trailer

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

Encapsulate the generated image into a header and trailer

Jump to solution
589 Views
SVC2
Contributor II

Hi,

 

I am trying to encapsulate the generated image into a header and trailer signature in order for the Boot Loader to recognize a valid image.

 

Therefore, in the BSP library, in vectors.cw, I added:

 

; CFM Flash Configuration Field…..// HeaderHEAD_SIG: .long   0xABCDEF12  // 4 bytes 0x418HEAD_LG1: .long   0x99999999 // 4 bytes 0x41C
HEAD_LG2: .long   0xAAAAAAAA // 4 bytes 0x420HEAD_LG3: .long   0xBBBBBBBB // 4 bytes 0x424HEAD_LG4: .long   0xCCCCCCCC // 4 bytes 0x428HEAD_LG5: .long   0xDDDDAAAA // 4 bytes 0x42C// 256 x 4 = 1024 (0x400) + 24 + 24 = 1064 = 0x430// " __boot" is at offset 0x430

 

This works fine as I can see my header in the s19 file.

 

The problem is the trailer. In one of the examples, web_hvac_m52259evb.mcp, I added a trailer.asm file:

_DEF_TRAILER_SIG    .set 0x1234ABCF    .global _Trail_Sig    .global _Tspare1    .global _Tspare2    .data   _Trail_Sig: .long _DEF_TRAILER_SIG  ; 2 word trailer signature_Tspare1:   .long 0_Tspare2:   .long 0 .end

 

In the linker file I added:

FORCE_ACTIVE {_Trail_Sig, _Tspare1, _Tspare2}

  Now, where in the linker file (extmram_usb.lcf) I shoud add        trailer.ams (.data)  in order to have the trailer signature at the very end of the image (s19  file)?

 

Thanks,

S.

 

 

 

 

 

0 Kudos
1 Solution
365 Views
DavidS
NXP Employee
NXP Employee

Hi SVC2,

Need how you are adding the header portion.  Thank you for sharing.

The way I have a trailer add in the linker (*.lcf) is in attached file.

Summary of it is here...look for #//DES in comments.

MEMORY
{
   vectorrom   (RX): ORIGIN = 0x00014000, LENGTH = 0x00000400
   rom         (RX): ORIGIN = 0x00014400, LENGTH = 0x0006BBF0  # Code + Const data  
   flash_done   (R): ORIGIN = 0x0007FFF0, LENGTH = 0x00000010 # //DES Flash Program Verification String
  
   ram         (RW): ORIGIN = 0x20000000, LENGTH = 0x00010000  # SRAM - RW data

   # kernel space starts after RAM variables (Location of MQX Kernel data + MQX heap)
   end_of_kd   (RW): ORIGIN = 0x2000FFF0, LENGTH = 0x00000000
  
   # Boot stack reused by MQX Kernel data
   bstack      (RW): ORIGIN = 0x2000FA00, LENGTH = 0x00000200  # Boot stack
   end_bstack  (RW): ORIGIN = 0x2000FBFF, LENGTH = 0x00000000
}

 

 .flash_written :
 {
  WRITEW(0x46534c4d);  # //DES FSLM
  WRITEW(0x51582055);  # //DES QX U
  WRITEW(0x53422073);  # //DES SB s
  WRITEW(0x7469636b);  # //DES tick
 } > flash_done

 

Hope this helps.

Regards,

David

View solution in original post

0 Kudos
1 Reply
366 Views
DavidS
NXP Employee
NXP Employee

Hi SVC2,

Need how you are adding the header portion.  Thank you for sharing.

The way I have a trailer add in the linker (*.lcf) is in attached file.

Summary of it is here...look for #//DES in comments.

MEMORY
{
   vectorrom   (RX): ORIGIN = 0x00014000, LENGTH = 0x00000400
   rom         (RX): ORIGIN = 0x00014400, LENGTH = 0x0006BBF0  # Code + Const data  
   flash_done   (R): ORIGIN = 0x0007FFF0, LENGTH = 0x00000010 # //DES Flash Program Verification String
  
   ram         (RW): ORIGIN = 0x20000000, LENGTH = 0x00010000  # SRAM - RW data

   # kernel space starts after RAM variables (Location of MQX Kernel data + MQX heap)
   end_of_kd   (RW): ORIGIN = 0x2000FFF0, LENGTH = 0x00000000
  
   # Boot stack reused by MQX Kernel data
   bstack      (RW): ORIGIN = 0x2000FA00, LENGTH = 0x00000200  # Boot stack
   end_bstack  (RW): ORIGIN = 0x2000FBFF, LENGTH = 0x00000000
}

 

 .flash_written :
 {
  WRITEW(0x46534c4d);  # //DES FSLM
  WRITEW(0x51582055);  # //DES QX U
  WRITEW(0x53422073);  # //DES SB s
  WRITEW(0x7469636b);  # //DES tick
 } > flash_done

 

Hope this helps.

Regards,

David

0 Kudos