summaryrefslogtreecommitdiffstats
path: root/_log/arduino-due.md
diff options
context:
space:
mode:
authorSadeep Madurange <sadeep@asciimx.com>2025-12-31 21:51:40 +0800
committerSadeep Madurange <sadeep@asciimx.com>2025-12-31 21:51:40 +0800
commit99a21a1bf35c5af6188abdcb87e894b371bbffa5 (patch)
tree294f4e6a90150fb3b478c06576e147c9f24540b4 /_log/arduino-due.md
parent94a42f4e48e5371462fccf92a6e94155951d97d4 (diff)
downloadwww-99a21a1bf35c5af6188abdcb87e894b371bbffa5.tar.gz
Fix date tag h5 and broken html.
Diffstat (limited to '_log/arduino-due.md')
-rw-r--r--_log/arduino-due.md26
1 files changed, 8 insertions, 18 deletions
diff --git a/_log/arduino-due.md b/_log/arduino-due.md
index 0d4f495..f604e89 100644
--- a/_log/arduino-due.md
+++ b/_log/arduino-due.md
@@ -4,25 +4,15 @@ date: 2024-09-16
layout: post
---
-Notes on programming ATSAM3X8E chips (Arduino Due) without bootloader. Tested
-on OpenBSD.
+Notes on programming bare-metal ATSAM3X8E chips (Arduino Due) using Serial Wire
+Debug (SwD) protocol.
## Toolchain
-Need to bypass embedded bootloader—requires hardware programmer that speaks
-Serial Wire Debug (SWD). ST-LINK/V2 works as SWD-USB adapter.
-
-OpenOCD translates commands to binary sequences the chip understands. Runs
-telnet server on startup for issuing commands.
-
-ARM GNU Compiler Toolchain for compiling C programs. Both OpenOCD and ARM
-toolchain available on OpenBSD.
+ST-LINK/V2 programmer, OpenOCD, ARM GNU Compiler Toolchain.
## Electrical connections
-Arduino Due exposes ATSAM3X8E's SWD interface via DEBUG port. ST-LINK/V2
-connects there.
-
<table style="border: none; width: 100%;">
<tr style="border: none;">
<td style="border: none; width: 50%; vertical-align: top; background-color: transparent;">
@@ -41,8 +31,7 @@ ST-LINK/v2 programmer connects to that to communicate with the chip.
## Upload procedure
-Sample LED blink program with OpenOCD config and linker scripts in tarball
-below.
+Build. Magic is in the script.ld linker script.
```
$ arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -T script.ld \
@@ -51,7 +40,8 @@ $ arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -T script.ld \
-o a.elf main.c
```
-Upload:
+
+Upload using OpenOCD:
```
$ openocd -f openocd-due.cfg
@@ -81,8 +71,8 @@ Program goes in flash0, so set GPNVM1=1 to boot our code instead of bootloader.
## Linker script notes
-Vector table must be at first flash address--mandatory for ARM chips unless
-using VTOR register for relocation.
+Vector table must be at first flash address--required for ARM chips unless
+relocated using VTOR register.
First vector table entry: stack pointer. Initialize to highest memory location
(ATSAM3X8E has descending stack).