USB DFU (Device Firmware Upgrade) firmware for Atmel SAM devices supported by ASF4
Go to file
Kevin Redon 26037ab23b remove OCTSIM in USB ID
this bootloader is initiated and meant for the sysmo-OCTSIM, but
it can be applied for other SAM E5x/D5x boards.
Thus we remove the OCTSIM name an just use the more generic
bootloader name.

Change-Id: Icc46f0d8b4b649fd00b5c6cea5bad91a93891f14
2019-01-31 18:02:10 +01:00
CMSIS use USB CDC Echo example project 2019-01-09 15:33:36 +01:00
config remove OCTSIM in USB ID 2019-01-31 18:02:10 +01:00
contrib add contrib/jenkins.sh for build verification 2019-01-13 13:40:56 +01:00
documentation removed unused USB CDC stack 2019-01-16 18:41:23 +01:00
gcc remove unused example code 2019-01-16 18:41:23 +01:00
hal add flash ASF4 driver 2019-01-16 18:40:31 +01:00
hpl add flash ASF4 driver 2019-01-16 18:40:31 +01:00
hri use USB CDC Echo example project 2019-01-09 15:33:36 +01:00
include use USB CDC Echo example project 2019-01-09 15:33:36 +01:00
usb remove OCTSIM in USB ID 2019-01-31 18:02:10 +01:00
.gitignore ignore gdb history file 2019-01-16 18:40:31 +01:00
.gitreview Add git-review config 2019-01-13 13:05:24 +00:00
AtmelStart.env_conf use USB CDC Echo example project 2019-01-09 15:33:36 +01:00
AtmelStart.gpdsc use USB CDC Echo example project 2019-01-09 15:33:36 +01:00
LICENSE add license file 2019-01-16 18:41:23 +01:00
README.md add README file 2019-01-16 18:41:23 +01:00
atmel_start.c use USB CDC Echo example project 2019-01-09 15:33:36 +01:00
atmel_start.h use USB CDC Echo example project 2019-01-09 15:33:36 +01:00
atmel_start_config.atstart use USB CDC Echo example project 2019-01-09 15:33:36 +01:00
atmel_start_pins.h add button to force DFU bootloader 2019-01-16 18:41:23 +01:00
driver_init.c add button to force DFU bootloader 2019-01-16 18:41:23 +01:00
driver_init.h add code to initialize flash 2019-01-16 18:40:31 +01:00
usb_dfu_main.c add button to force DFU bootloader 2019-01-16 18:41:23 +01:00
usb_start.c start application if valid at boot 2019-01-16 18:41:23 +01:00
usb_start.h add USB DFU description 2019-01-16 18:39:41 +01:00

README.md

This is an implementation of the DFU mode of the USB DFU Device Class Specification for the Microchip SAM D5x/E5x micro-controller. It is meant to be used as bootloader to allow flashing the main application over USB.

The code has been developed for the Microchip SAM E54 Xplained Pro development board using a SAM E54 micro-controller. It should work on any chip of the SAM D5x/E5x device family by replacing the corresponding device-specific definitions (usually including the chip name in the file name).

The code uses the Atmel START ASFv4 library.

USB DFU

This implementation support the following USB DFU capabilities:

  • can download: allowing to download the code over USB on the device (enabled per default)
  • manifestation tolerant: allowing to download after a previous download (disabled per default)
  • will detach: forcing the device the reset after a download, else it wit for a USB reset (enable per default)

Set the corresponding attributes in the 'DFUD_IFACE_DESCB' macro definition in the 'usb/class/dfu/device/dfudf_desc.h' file.

Compiling

Use the 'Makefile' script to compile the source code using the ARM none EABI GCC cross-cimpilig toolchain:

cd gcc
make

The resulting firmware binary is AtmelStart.bin.

Flashing

To flash the bootloader you can either use the edbg tool over the EDBG interface of the SAM E54 Xplained Pro development board, or OpenICD with any SWJ adapter.

The USB DFU bootloader should be flashed in a protected area of the flash memory to prevent for erasing it, as specified in data sheet section 25.6.2 Memory Organization. The bootloader size is configured in the NVM user configuration BOOTPROT field, as specified in data sheet section 25.6.9 NVM User Configuration. The bit position of the BOOTPROT field is documented in data sheet section 9.4 NVM User Page Mapping. We need to reserve as least 2 pages of 8192 bytes for the bootloader since it is a bit larger than 10 KB (e.g. over 8 KB). This setting will also tell the bootloader where to flash the application firmware to (e.g. after the bootloader reserved space). The LED will blink once per second if this size is not set.

EDBG

To flash the USB DFU bootloader, perform the following actions:

  • remove reserved bootloader space so we can erase it: edbg --target atmel_cm4v2 --fuse wv,29:26,15
  • erase the whole flash: edbg --target atmel_cm4v2 --fuse v,29:26,15 --erase
  • program the bootloader: edbg --target atmel_cm4v2 --fuse v,29:26,15 --program --verify --file AtmelStart.bin
  • reserve bootloader space: edbg --target atmel_cm4v2 --fuse wv,29:26,13