Programming the ATSAMD21 with IBDAP

In the process of porting a blog post from the retired Arduino M0 Pro to Adafruit’s excellent Metro M0 Express, I ran into a few issues and scant amount of documentation. I’m writing this for the next poor soul wrestling with these systems.


This is a companion discussion topic for the original entry at https://interrupt.memfault.com/blog/getting-started-with-ibdap-and-atsamd21g18

First off, I’m really enjoying the first few posts here on Interrupt! Thank you for taking the time to publish clear guides on these topics.

A couple of comments on the above post:
First up, it took me way longer than I’d care to admit to figure out how to use the openocd.cfg you created in the post. For anyone who is eqaully clueless, you can stick the cfg file whereever you plan on running openocd from, and you use the command

    openocd -f openocd.cfg

to actually run it.

Also, I found that on my system, I needed to combine the following lines:

# Flash the firmware
program your-firmware-file.bin
# Read it back and verify it
verify
# Reset the board
reset

into a single line:

program your-firmware-file.bin verify reset

To properly execute the verification and target reset. It gave an error otherwise.

I’m really looking forward to seeing the rest of this series!

Thanks for the comment @ssvt! I’ll update the post with your suggestions this week. Note that you can also submit edits directly on Github!

hi François
thanks for your sharing, I’m a beginner of openocd, encountered a problem while referring to your article:
1.create a openocd.cfg on desktop, but don’t know how to launch the programming procedure. and try the openocd -f openocd.cfg command. error message is “can’t find openocd.cfg”. could you kindly give some advise
alan

yucheng, be shure to add the full file path to openocd.cfg if your working directory isn’t the desktop when you run the openocd command. That might look something like “openocd -f ~/Desktop/openocd.cfg” if you’re on linux.