Skip to main content

Flashing the Arduino Bootloader using DAP Link

This is the Wiki Tutorial of how to use DAP link (OpenOCD) to flash the Arduino Bootloader into Arduino Boards. If your Arduino Board's bootloader is interrupted, you can use this guide to re-flash the bootloader back.

Preparations

  1. First thing first, you must follow the How to use Arduino Borads as DAPLink Device first to turn one of your SAMD boards to DAP-Link Device. Once you have configured and uploaded the daplink Arduino ino program, you can come back to this wiki tutorial.

  2. Connect the Target Hardware with the DAP Link Device(SAMD Board) according to the Pin configurations.

    • SWO > SWO
    • CLK > CLK
    • GND > GND

It may look something like this where the Seeeduino XIAO is the DAP Link deivce and Seeeduino Cortex M0+ is the Target.

Get Started

In this example, Seeeduino XIAO is acted as a DAPLink device and used to flash the Arduino Bootloader for Seeeduino Lotus Cortex M0+.

  • Navigate to the root location of the Arduino Board Library Path in Terminal and find the OpenOCD path within the path. It may look something like this:
cd ~/Library/Arduino15/packages/arduino/tools/openocd/
cd 0.10.0-arduino7/bin # Version might vary here
  • Run the OpenOCD with specific scripts:

Note: You may need to change ansonhe to your username or adjust to your correct path.

./openocd -s ../share/openocd/scripts/ -f /Users/ansonhe/Library/Arduino15/packages/Seeeduino/hardware/samd/1.7.9/variants/arduino_zero/openocd_scripts/arduino_zero.cfg

If everything goes well, you should see something like this as followed:

Now the server it's up and running!

  • Leave the previous terminal and open a new terminal. Also navigate to the root location of Arduino Board path. Then navigate to the arm-gcc path:
cd ~/Library/Arduino15/packages/Seeeduino/tools/arm-none-eabi-gcc/7-2017q4/bin
  • Under this path, you can run the following:
./arm-none-eabi-gdb
  • Once within the gdb, connect with target using:
target remote localhost:3333
  • Load the Arduino Bootloader from the Arduino Board library root path:

You may also find the bootloader for Seeed SAMD boards here: https://github.com/Seeed-Studio/ArduinoCore-samd/tree/master/bootloaders

Note: You may need to change ansonhe to your username or adjust to your correct path.

file /Users/ansonhe/Library/Arduino15/packages/Seeeduino/hardware/samd/1.7.9/bootloaders/zero/samd21_sam_ba.elf
  • Flash the bootloader to the target:
load
  • Reset the target device by pressing reset buttons and you should see that COM appeared. Now the Arduino Bootloader is flashed to Seeeduino Lotus Cortex M0+ using Seeeduino XIAO as DAPLink Device!

Tech Support & Product Discussion

Thank you for choosing our products! We are here to provide you with different support to ensure that your experience with our products is as smooth as possible. We offer several communication channels to cater to different preferences and needs.

Loading Comments...