1.7.4.1 Application project configurations for CORTEX-M based MCUs

Application settings in MCC system configuration

  • Launch MCC for the application project to be configured

  • Select system component from the project graph and configure the below highlighted settings

arm_application_config_mcc
  • Disable Fuse Settings:

    • Fuse settings needs to be disabled for the application which will be boot-loaded as the fuse settings are supposed to be programmed through programming tool from bootloader code or by using device configuration command supported by UART, I2C, CAN and SPI bootloaders.

    • Enabling the fuse settings also increases the size of the binary when generated through the hex file

    • When updating the bootloader itself, make sure that the fuse settings for the bootloader application are also disabled

  • Specify the Application Start Address:

    • Specify the Start address from where the application will run under the Application Start Address (Hex) option in System block in MCC.

    • This value should be equal to or greater than the bootloader size and must be aligned to the erase unit size on that device.

    • As this value will be used by bootloader to Jump to application at device reset it should match the value provided to bootloader code

    • The Application Start Address (Hex) will be used to generate XC32 compiler settings to place the code at intended address

    • After the project is regenerated, the ROM_ORIGIN and ROM_LENGTH are the XC32 linker variables which will be overridden with value provided for Application Start Address (Hex) and can be verified under Options for xc32-ld in Project Properties in MPLABX IDE as shown below.

arm_application_config_xc32_ld_rom
  • CORTEX-M based devices where both Boot Flash Memory (BFM) and Program Flash Memory (PFM) are available

    • Vector table must be placed to the FCR_PFM (FLASH) memory from FCR_BFM

mplab_place_vector_table
  • For Trustzone Devices

    • Configure all the required peripherals and GPIO's to Non-Secure except the peripherals and pin's used by Bootloader

    arm_application_config_truszone_peripherals
    • Configure below memory regions as specified to generate Linker symbols required to place the Application after Bootloader region (BOOTPROT) and other regions required based on use cases

    arm_application_config_truszone_memory_config

MPLAB X Settings

For Bootloading the application using binary file

  • Below are the Bootloaders which use application binary (.bin) file as input

    • UART

    • I2C

    • CAN

    • SPI

    • Serial Memory

    • File System

    • OTA

  • Specifying post build option to automatically generate the binary file from hex file once the build is complete

${MP_CC_DIR}/xc32-objcopy -I ihex -O binary ${DISTDIR}/${PROJECTNAME}.${IMAGE_TYPE}.hex ${DISTDIR}/${PROJECTNAME}.${IMAGE_TYPE}.bin
arm_application_config_post_build_script

For Bootloading the application using Normalized Hex file

  • Below are the Bootloaders which use Normalized application Hex (.hex) file as input

    • USB Device HID

    • UDP

  • Check the Normalize hex file option as shown below, as the Unified bootloader host application takes hex file as an input. Normalizing the hex file will make sure the data in the hex file is arranged sequentially

arm_application_config_normalize_hex

Additional settings (Optional)

  • RAM_ORIGIN and RAM_LENGTH values should be provided for reserving configured bytes from start of RAM to trigger bootloader from firmware

  • Under Project Properties, expand options for xc32-ld and define the values for RAM_ORIGIN and RAM_LENGTH under Additional options

  • This is optional and can be ignored if not required

arm_application_config_xc32_ld_ram