First, make sure that you have the following prerequisites installed:
- Vagrant
- VirtualBox 5.X
- VirtualBox Extension Pack
On Linux,
sudo usermod -a -G vboxusers $USER # grant VM access to USB devices
# log out and log back in for change to take affect
Now, you can start it up and log in
vagrant up # could take 10 minutes while VM is built, you can eat a snack or something
vagrant ssh # log into the VM
- make sure that the board itself is powered (plugged into wall wart or powered usb)! must have enough current (otherwise LEDs won't light)
- J-Link Mini can be plugged into the powered USB port, but also needs enough current (otherwise its LED will blink rapidly)
To connect to the SAMD21 via J-Link Commander,
vagrant ssh
> JLinkExe
JLink> connect
device> ATSAMD21G18 # this is the name of our cpu.
TIF> S # select 'S' (SWD) as the target interface.
Speed> # default (4000kHz) seems fine.
- use
OpenOCD
instead ofjlink
for flashing (open source and configurable see this) - use
UF2
bootloader (supports Mass Storage Bootloader (for end-users who want to update firmware) AND BOSSA Bootloader for programmatically flashing) - use
BOSSA
for updating firmware in development mode. (see this) - for final product, have a button which when double-tapped, puts the device in BOOTLOADER mode (see AdaFruit UF2 SAMD bootloader and Winterbloom's same thing)
!!!!! NOTE: "For CMSIS stuff you need to download ASF (still available as a standalone ZIP, I believe), disregard all the drivers stuff and just take header files. That will basically constitute all that Atmel has for CMSIS." see this look at AdaFruit's update from Atmel Start repo ALSO LLOOK AT this
- Write test program to flash onto mcu (blink led in pattern) a. compile b. flash
- research OpenOCD + CMSIS + ASF
- write tools/process for: a. bootloading (writing a blank or possibly bricked device with a bootloader (UF2)) b. development programming (using BOSSA against UF2 bootloader) c. end-user firmware update via doubletapped button and usb.
Development Hardware:
- SAMD21 Dev Board (SparkFun RedBoard Turbo)
ATSAMD21G18
cpu (ARM Cortex M0+, 32-bit, 48MHz)- pre-flashed with UF2 (USB Flashing Format) Bootloader
- additional 4MB external Flash Hardware debugger:
- SEGGER JLink Toolchain:
- GNU ARM Embedded
- J-Link Software Pack - Suite of tools for using the J-Link. Download Link
- J-Link Commander (JLinkExe) - J-Link firmware update and basic utility for verifying/analysing the target system via J-Link.
- J-Link GDB Server - "a remote server for GDB making it possible for GDB to connect to and communicate with the target device via J-Link."
- J-Flash - stand-alone utility for programming flash devices.
- J-Run - cli tool for running automated tests.
- "why not use openOCD?" - technically, you can use a J-Link with
openOCD
but according to this wiki page it is much slower than using the proprietary SEGGER J-LINK GDB Server. - "what is the device name when connecting via J-Link?" -
ATSAMD21G18
(generally, search for names on here)
This development environment draws heavily on previous work by Mutable Instruments and Adafruit!