How to add or remove boot header for XIP targets

The MCUXpresso SDK for i.MX RT1015 provides flexspi_nor_debug and flexspi_nor_release targets for each example and/or demo which supports XIP (eXecute-In-Place). These two targets add XIP_BOOT_HEADER to the image by default. Because of this, ROM can boot and run this image directly on external flash.

Macros for the boot leader:

  • The following three macros are added in flexspi_nor targets to support XIP, as described in Table 1.

    ^

    |XIP_EXTERNAL_FLASH|1: Exclude the code which changes the clock of FLEXSPI.| |0: Make no changes.| |XIP_BOOT_HEADER_ENABLE|1: Add FLEXSPI configuration block, image vector table, boot data, and device configuration data (optional) to the image by default.| |0: Add nothing to the image by default.| |XIP_BOOT_HEADER_DCD_ENABLE|1: Add device configuration data to the image.| |0: Do NOT add device configuration data to the image.|

  • Table 2 shows the different effect on the built image with a different combination of these macros.

    ^

    XIP_BOOT_HEADER_DCD_ENABLE=1

    XIP_BOOT_HEADER_DCD_ENABLE=0

    XIP_EXTERNAL_FLASH=1

    XIP_BOOT_HEADER_ENABLE=1

    - Can be programmed to qspiflash by IDE and can run after POR reset if qspiflash is the boot source.

    • SDRAM will be initialized. | - Can be programmed to qspiflash by IDE, and can run after POR reset if qspiflash is the boot source.

    • SDRAM will NOT be initialized. | |XIP_BOOT_HEADER_ENABLE=0| - CANNOT run after POR reset if it is programmed by IDE, even if qspiflash is the boot source. | |XIP_EXTERNAL_FLASH=0| - This image CANNOT complete because when this macro is set to 0, it includes the code which changes the clock for FLEXSPI. |

Where to change the macros for each toolchain in MCUXpresso SDK?

Take hello_world as an example:

  • IAR

  • MDK

  • ARMGCC

    Change the configuration in CMakeLists.txt.

  • MCUX