AnsweredAssumed Answered

Flash layout when using a bootloader on the S32K144

Question asked by Damien Dusha on Sep 5, 2018
Latest reply on Sep 14, 2018 by Diana Batrlova

I am currently designing a bootloader for the S32K144, and I have some questions about the flash layout when using the bootloader.

 

When compiling a normal application (i.e. single program, no bootloader), there is a section of flash for the interrupts, a section of flash for the Flash configuration and the remainder for the program itself.  That is:

 

/* Specify the memory areas */
MEMORY
{
  /* Flash */
  m_interrupts          (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00000400
  m_flash_config        (RX)  : ORIGIN = 0x00000400, LENGTH = 0x00000010
  m_text                (RX)  : ORIGIN = 0x00000410, LENGTH = 0x0007FBF0

  /* SRAM_L */
  m_data                (RW)  : ORIGIN = 0x1FFF8000, LENGTH = 0x00008000

  /* SRAM_U */
  m_data_2              (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00007000
}

 

However, the bootloader in the S32K144 CAN bootloader has an additional "hole" in the flash map between where the m_flash_config ends and the text section begins. Is there a reason for this hole?

 

/* Specify the memory areas */
MEMORY
{
  m_interrupts          (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00000400
  m_flash_config        (RX)  : ORIGIN = 0x00000400, LENGTH = 0x00000010
  /** Note the hole here between 0x410 and 0x500 **/
  m_text                (RX)  : ORIGIN = 0x00000500, LENGTH = 512K - 0x500
  m_data                (RW)  : ORIGIN = 0x1FFF8000, LENGTH = 0x00007FFF
  m_data_2              (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00007000
}

 

Secondly, when looking at AN12218 ("Using the bootloader, S32K1xx Bootloader,Rev. 0,07/2018", p8 sec.3), there is an explicit location in the user application for storage of the flash_config space, even through (as I understand it), they are read and applied only on reset and thus it is the value at 0x0400 in flash that really matters.

The S32K144 CAN bootloader application keeps the flash_config in the expected location, and there is no "hole" for it in the memory map:

/* Specify the memory areas */
MEMORY
{
  m_interrupts          (RX)  : ORIGIN = 0x00004000, LENGTH = 0x00000400
  m_flash_config        (RX)  : ORIGIN = 0x00000400, LENGTH = 0x00000010
  m_text                (RX)  : ORIGIN = 0x00004400, LENGTH = 512K - 0x4400
  m_data                (RW)  : ORIGIN = 0x1FFF8000, LENGTH = 0x00007FFF
  m_data_2              (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00007000
}

 

Does there need to be a section in flash reserved for the flash_config, even when in the application?

 

My second question is with respect to the alignment of m_interrupts.   Does this need to be aligned with anything specific (e.g. 512-byte/1024-byte boundaries, a 4k sector of flash, etc)?

Outcomes