Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ASF SAM4L Firmware Generator for USB Host Mass Storage Bootloader

Introduction

SAM4L Firmware generator application is to provide a easy way to generate AES encrypted firmware with CRC32 and signature bytes. The firmware is fully compatible for the SAM4L USB Host MSC Bootloader.

  • Do complete chip erase.
  • Program the firmware generator application
  • Load the application firmware into U-disk. Connect it to the SAM4L-EK USB MSC Host.
  • Application generates & appends CRC32 with signature bytes and encrypts the whole binary.

Bootloader Configuration

Bootloader Configurations are managed in conf_bootloader.h

  • FIRMWARE_AES_ENABLED -> Enable/disable the AES Decryption
  • CONSOLE_OUTPUT_ENABLED -> Enable/disable the Console message output
  • APP_START_OFFSET -> Application starting offset from Flash
  • FIRMWARE_IN_FILE_NAME -> Input Application Firmware
  • FIRMWARE_OUT_FILE_NAME -> Encrypted/Unencrypted Application Firmware for bootloader
  • APP_SIGNATURE -> Signature bytes to be verified

Board Configuration

Board Configurations are managed in conf_board.h

  • SAM4L-EK configuration
    • Has an IO configured for VBUS Detect. VBUS Pin jumper PA06/USB should be set
    • CONF_BOARD_USB_PORT -> Enable USB pins
    • CONF_BOARD_USB_VBUS_CONTROL -> VBUS control enabled, jumper PC08/USB should be set
    • CONF_BOARD_USB_VBUS_ERR_DETECT-> VBUS error control enabled, jumper PC07/USB should be set
    • An external power supply should be used since the VBUS is powered only through the external power supply controlled by the VBUS Control(VBOF) pin. Refer the SAM4L-EK schematics for more details.
    • Console message output is sent through the Embedded Debugger(onboard)'s COM PORT.
  • SAM4L Xplained Pro configuration
    • Has an IO configured for VBUS Detect.
    • CONF_BOARD_USB_PORT -> Enable USB pins
    • CONF_BOARD_USB_VBUS_CONTROL -> VBUS control enabled
    • An external power supply should be used if the EDBG USB port is not able to provide enough power to the USB MSC device.
    • Console message output is sent through the Embedded Debugger(onboard)'s COM PORT.

Application Output Format

The application binary structure is modified by the firmware generator. The final application binary structure would be as below

  • AES Enabled:
    • 4 bytes -> Encrypted CRC32
    • 12 bytes -> Encrypted Signature Data
    • Rest data -> Encrypted Input Firmware
  • AES Disabled:
    • 4 bytes -> CRC32
    • 12 bytes -> Signature Data
    • Rest data -> Input Firmware
  • A sample application binary output (AES encrypted) is provided for testing with the firmware generator.

Dependencies

The application uses the following module groups: