Flashing Arduino Due for Zephyr

Setting Up for Zephyr Development on Ubuntu

$ sudo apt-get update
$ sudo apt-get install git make gcc gcc-multilib g++ libc6-dev-i386  g++-multilib

Ensure that at least the 32 bit versions of the packages are installed. Ideally, both the 32 and 64 bit versions should be installed.

Setting the Project’s Environment Variables

$ tar xvzf zephyr-v1.0.0.tar.gz
$ cd zephyr-v1.0.0
$ source zephyr-env.sh

Installing the Zephyr Software Development Kit

Run the installation binary, type:

$ chmod +x zephyr-sdk-0.7.2-i686-setup.run
$ sudo ./zephyr-sdk-0.7.2-i686-setup.run

To use the Zephyr SDK, export the following environment variables and use the target location where SDK was installed, type:

$ vim ~/.zephyrrc

export ZEPHYR_GCC_VARIANT=zephyr
export ZEPHYR_SDK_INSTALL_DIR=/opt/zephyr-sdk

$ source ~/.zephyrrc

Flashing Arduino Due for Zephyr

Flashing the Zephyr kernel onto Arduino Due requires the bossa tool. Note that the Arduino specific version is required (branch arduino on GitHub).

Install bossa

sudo apt-get install bossa bossa-cli
  • 1) To build the Zephyr kernel, enter:
$ cd $ZEPHYR_BASE/samples/nanokernel/apps/hello_world/
$ make BOARD=arduino_due

  • 2) Connect the Arduino Due to your host computer using the programming port.
  • 3) Press the Erase button for more than 220 ms.
  • 4) Press the Reset button so the board will boot into the SAM-BA bootloader.
  • 5) To flash the kernel onto Arduino Due, assuming the bossa tool already exists. Using the command line version of bossa, enter:
# $ bossac -p <tty_device> -e -w -v -b outdir/zephyr.bin
$ bossac -p ttyACM0 -e -w -v -b outdir/zephyr.bin

Where <tty_device> is where the Arduino Due can be found.
For example, under Linux, <tty_device> should be /dev/ttyACM0.

  • 6) Run your favorite terminal program to listen for output. For example, under Linux, the terminal should be /dev/ttyACM0.
  • 7) Press the Reset button and you should see “Hello World!” in your terminal.

Make sure your terminal program is closed before flashing the binary image, or it will interfere with the flashing process.

Hacking with the Arduino Due

Install Arduino Due Board on Arduino IDE Tool

Tools> Board> Boards Manager>
Arduino SAM Boards Installing : Arduino Due

Leave a Reply