Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"permissions": {
"allow": [
"Bash(ls /home/noah/dev/memfault/interrupt-worktree/*.html)",
"Bash(ls /home/noah/dev/memfault/interrupt-worktree/*.md)",
"Bash(xargs -I{} grep -n 'post_url' {})",
"Bash(sort -t: -k2 -rn)"
]
}
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ _site/
.jekyll-cache/
.jekyll-metadata

# Gatsby
.cache/
public/

.DS_Store
/vendor
/example/*/build
Expand Down
874 changes: 0 additions & 874 deletions .yarn/releases/yarn-3.6.3.cjs

This file was deleted.

940 changes: 940 additions & 0 deletions .yarn/releases/yarn-4.13.0.cjs

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
yarnPath: .yarn/releases/yarn-3.6.3.cjs
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.13.0.cjs
7 changes: 0 additions & 7 deletions _includes/header-custom.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,4 @@ <h3 class="no-anchor">by <a href="https://memfault.com">Memfault</a></h3>
>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="{{ '/jobs' | relative_url }}">Jobs</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a href="{{ '/events' | relative_url }}">Events</a>&nbsp;&nbsp;&nbsp;&nbsp;
<button
id="theme-toggle"
title="System theme (click for dark)"
aria-label="Toggle dark mode"
>
<i class="fa fa-adjust" aria-hidden="true"></i>
</button>
</header>
7 changes: 4 additions & 3 deletions _includes/nav-footer-custom.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<footer>

<!-- Your custom nav footer here -->

<button id="theme-toggle" title="System theme (click for dark)" aria-label="Toggle dark mode">
<i class="fa fa-adjust" aria-hidden="true"></i>
<span id="theme-toggle-label">System theme</span>
</button>
</footer>
91 changes: 44 additions & 47 deletions _layouts/default.html
Original file line number Diff line number Diff line change
@@ -1,49 +1,46 @@
<!DOCTYPE html>
<!doctype html>
<html>

{% include head.html %}

<body>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-PDMNKRX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<div id="wrap">

<!-- Navigation -->
{% include menu.html %}

<!-- Top banner -->
{% include notification-banner.html %}

<!-- Icon menu -->
<a {% if site.reverse == true %}id="nav-menu-left"{% else %}id="nav-menu"{% endif %}>
<div id="menu"></div>
</a>

<!-- Header -->
{% include header-custom.html %}

<!-- Main content -->
<div id="container">

<main>

{{ content }}

</main>

<!-- Pagination links -->
{% include pagination.html %}

</div>

<!-- Footer -->
{% include footer.html %}

<!-- Script -->
{% include script.html %}

</div>
</body>
{% include head.html %}

<body>
<!-- Google Tag Manager (noscript) -->
<noscript
><iframe
src="https://www.googletagmanager.com/ns.html?id=GTM-PDMNKRX"
height="0"
width="0"
style="display: none; visibility: hidden"
></iframe
></noscript>
<!-- End Google Tag Manager (noscript) -->
<div id="wrap">
<!-- Navigation -->
{% include menu.html %}

<!-- Top banner -->
{% include notification-banner.html %}

<!-- Icon menu -->
<a {% if site.reverse == true %}id="nav-menu-left"{% else %}id="nav-menu"{% endif %}>
<div id="menu"></div>
</a>

<!-- Header -->
{% include header-custom.html %}

<!-- Main content -->
<div id="container">
<main>{{ content }}</main>

<!-- Pagination links -->
{% include pagination.html %}
</div>

<!-- Footer -->
{% include footer.html %}

<!-- Script -->
{% include script.html %}
</div>
</body>
</html>
102 changes: 48 additions & 54 deletions _layouts/homepage.html
Original file line number Diff line number Diff line change
@@ -1,56 +1,50 @@
<!DOCTYPE html>
<!doctype html>
<html>

{% include head.html %}

<body>
<div id="wrap">

<!-- Navigation -->
{% include menu.html %}

<!-- Top banner -->
{% include notification-banner.html %}

<!-- Icon menu -->
<a {% if site.reverse == true %}id="nav-menu-left"{% else %}id="nav-menu"{% endif %}>
<div id="menu"></div>
</a>

<div id="header">
<img id='logo' src="{% img_url interrupt-logo.svg %}" alt="Interrupt Logo">
<h1 class="header">Interrupt</h1>
<h3 class="header">by <a href="https://memfault.com">Memfault</a></h3>
</div>

<!-- Main content -->
<div id="split-container-wrapper" class="home-split-container">
<div id="split-container">
<main>

{{ content }}

</main>
<aside>
{% include search.html %}
{% include subscribe.html %}
{% include posts-nav.html %}
{% include by-memfault.html %}
{% include share-buttons.html %}
</aside>
</div>

<!-- Pagination links -->
{% include pagination.html %}

</div>

<!-- Footer -->
{% include footer.html %}

<!-- Script -->
{% include script.html %}

</div>
</body>
{% include head.html %}

<body>
<div id="wrap">
<!-- Navigation -->
{% include menu.html %}

<!-- Top banner -->
{% include notification-banner.html %}

<!-- Icon menu -->
<a {% if site.reverse == true %}id="nav-menu-left"{% else %}id="nav-menu"{% endif %}>
<div id="menu"></div>
</a>

<div id="header">
<img
id="logo"
src="{% img_url interrupt-logo.svg %}"
alt="Interrupt Logo"
/>
<h1 class="header">Interrupt</h1>
<h3 class="header">by <a href="https://memfault.com">Memfault</a></h3>
</div>

<!-- Main content -->
<div id="split-container-wrapper" class="home-split-container">
<div id="split-container">
<main>{{ content }}</main>
<aside>
{% include search.html %} {% include subscribe.html %} {% include
posts-nav.html %} {% include by-memfault.html %} {% include
share-buttons.html %}
</aside>
</div>

<!-- Pagination links -->
{% include pagination.html %}
</div>

<!-- Footer -->
{% include footer.html %}

<!-- Script -->
{% include script.html %}
</div>
</body>
</html>
51 changes: 29 additions & 22 deletions _posts/2019-04-25-getting-started-with-ibdap-and-atsamd21g18.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
---
date: "2019-04-25"
title: "Programming the ATSAMD21 with IBDAP"
description: "How to flash the Atmel SAM D21 using the IBDAP programmer"
author: francois
tags: [cortex-m]
---

<!-- excerpt start -->
In the process of porting a blog post from the retired [Arduino M0
Pro](https://store.arduino.cc/usa/arduino-m0-pro) to Adafruit's excellent
[Metro M0
Express](https://www.adafruit.com/product/3505), I ran into a few issues and scant amount of documentation. I'm writing this for
the next poor soul wrestling with these systems.

In the process of porting a blog post from the retired
[Arduino M0 Pro](https://store.arduino.cc/usa/arduino-m0-pro) to Adafruit's
excellent [Metro M0 Express](https://www.adafruit.com/product/3505), I ran into
a few issues and scant amount of documentation. I'm writing this for the next
poor soul wrestling with these systems.

<!-- excerpt end -->

Note: I'm a MacOS user, but the procedure below will work fine on Linux /
Expand All @@ -23,32 +26,36 @@ programmer from Adafruit. This is a simple CMSIS-DAP device based on the
LPC11u35 chipset.

In order to work as a CMSIS-DAP device, the dongle needs to be flashed with a
firmware from the supplier. Unfortunately, the company behind the dongle seems to have gone out of business.
Its documentation, firmware binaries, and github repositories have all vanished
from the internet.
firmware from the supplier. Unfortunately, the company behind the dongle seems
to have gone out of business. Its documentation, firmware binaries, and github
repositories have all vanished from the internet.

I found out via a forum post that mbed's
[SWDAP](https://os.mbed.com/platforms/SWDAP-LPC11U35/) firmware precompiled for
LPC1768 works fine on this board. From there, the steps were relatively
straightforward:

1. Download the pre-built firmware.

```terminal
$ wget https://os.mbed.com/media/uploads/chris/lpc11u35_swdap_lpc1768_if_crc.bin
```

2. Connect the dongle over USB.
3. Put the dongle in DFU mode by pressing both the RESET and ISP buttons. It
should now appear as a USB drive named "CRP DISABLD".
3. Copy the firmware over to the drive. On my Mac this was best achieved with
4. Copy the firmware over to the drive. On my Mac this was best achieved with
`dd`.

```terminal
$ dd if=lpc11u35_swdap_lpc1768_if_crc.bin of=/Volumes/CRP\ DISABLD/firmware.bin
conv=notrunc
```

Note that simply dragging the firmware over did not work because it fits exactly
within the flash and OSX wants some overhead, erroring out with "not enough space".
4. Reset the dongle by pressing the RESET button.
5. Verify that it now enumerates as a USB drive named "DAPLINK".
within the flash and OSX wants some overhead, erroring out with "not enough
space". 4. Reset the dongle by pressing the RESET button. 5. Verify that it now
enumerates as a USB drive named "DAPLINK".

You are now the proud owner of a functional IBDAP programmer!

Expand All @@ -67,13 +74,14 @@ Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
```

Huzzah!

## Flashing the atsamd21g18

Both the Arduino M0 pro and the Metro M0 Express boards come with fancy
bootloaders that let you [update your firmware over
USB](https://learn.adafruit.com/adafruit-metro-m0-express-designed-for-circuitpython/uf2-bootloader-details).
bootloaders that let you
[update your firmware over USB](https://learn.adafruit.com/adafruit-metro-m0-express-designed-for-circuitpython/uf2-bootloader-details).
Most people will be thrilled to use that.

If - like me - you're trying to build your own bootloader, things get a bit more
Expand Down Expand Up @@ -123,8 +131,8 @@ reset
shutdow
```

These are all general openocd command documented [on their
website](http://openocd.org/doc/html/General-Commands.html).
These are all general openocd command documented
[on their website](http://openocd.org/doc/html/General-Commands.html).

Not so fast...

Expand All @@ -143,11 +151,12 @@ It turns out our MCU can write protect bootloader pages, so that a firmware bug
does not overwrite the bootloader and brick the device. You can read all about
it in section 9.4 of the
[SAMD20 family datasheet](http://ww1.microchip.com/downloads/en/DeviceDoc/60001504B.pdf).
Typically, boot protection can be overcome with a chip erase, but that did not do the trick
here.
Typically, boot protection can be overcome with a chip erase, but that did not
do the trick here.

To disable it, we need to zero out the `BOOTPROT` bits (0:2) in the NVM User Row,
which is a fancy name for a non-volatile, 64-bit register at address `0x804000`.
To disable it, we need to zero out the `BOOTPROT` bits (0:2) in the NVM User
Row, which is a fancy name for a non-volatile, 64-bit register at address
`0x804000`.

Conveniently, openOCD has a MCU specific command just for this, documented
[here](http://openocd.org/doc-release/html/Flash-Commands.html)! Let's add it to
Expand Down Expand Up @@ -190,5 +199,3 @@ verified 1252 bytes in 0.207606s (5.889 KiB/s)
** Resetting Target **
shutdown command invoked
```


Loading
Loading