Jump to main content

# 1.3.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

- Disable Fuse Settings:

  - Fuse settings needs to be disabled for the application which will be bootloaded 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, ensure 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 MPLAB X IDE as shown below

- 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
- For Trustzone Devices:
  - Configure all the required peripherals and GPIO's to Non-Secure except the peripherals and pin's used by Bootloader
  - 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

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

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 ensure the data in the hex file is arranged sequentially.

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

Rev: G