0

I am using PlatformIO and the Arduino framework to build firmware for an Adafruit Feather M0 Express. All is well, I can run pio run -t upload and my firmware is uploaded and runs fine (the LED blinks, which is all I'm trying to do right now). My production environment will use the same ATSAMD21G18 chip as the Feather, but on a custom board. Importantly: I'll be using an Atmel-ICE dongle to do the firmware upload instead of USB. My question is this:

How can I use OpenOCD or avrdude to upload my firmware with the Atmel ICE?

My openocd.cfg file is:

# Atmel-ICE JTAG/SWD in-circuit debugger
interface cmsis-dap

# Chip info
set CHIPNAME at91samd21g18
source [find target/at91samdXX.cfg]

I have used OpenOCD version 0.9.0 to upload a bootloader to the custom board like this:

openocd -f ./openocd.cfg -c "telnet_port disabled; init; halt; at91samd bootloader 0; program ~/Downloads/featherm0bootloader_160305.hex verify reset ; at91samd bootloader 4096; shutdown"

The custom board has a (temporary) USB cable and I can run pio run -t upload and the custom board behaves just like the Feather (the LED blinks). If I run OpenOCD to upload the firmware like this:

openocd -f ./openocd.cfg -c "telnet_port disabled; init; halt; at91samd bootloader 0; flash write_image ./.pioenvs/adafruit_feather_m0_express/firmware.bin 0x2000 ; at91samd bootloader 4096 ; shutdown"

it appears that my firmware is being uploaded but never executes (the LED does not blink). Why?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.