diff options
| author | Sadeep Madurange <sadeep@asciimx.com> | 2026-01-05 17:39:10 +0800 |
|---|---|---|
| committer | Sadeep Madurange <sadeep@asciimx.com> | 2026-01-05 18:49:38 +0800 |
| commit | a6440c00abbc30230f8a59c737e4ec55cb82a350 (patch) | |
| tree | 8f7da5640298a84eb202f995caa888bed0012180 /_site/log/arduino-due | |
| parent | b10690f16d2b310221ffa7995e779f09d146f7f8 (diff) | |
| download | www-a6440c00abbc30230f8a59c737e4ec55cb82a350.tar.gz | |
Fix Arduino Due post, ol list css.
Diffstat (limited to '_site/log/arduino-due')
| -rw-r--r-- | _site/log/arduino-due/index.html | 71 |
1 files changed, 25 insertions, 46 deletions
diff --git a/_site/log/arduino-due/index.html b/_site/log/arduino-due/index.html index d9cc946..ed49e78 100644 --- a/_site/log/arduino-due/index.html +++ b/_site/log/arduino-due/index.html @@ -3,7 +3,7 @@ <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> - <title>Bare-metal ATSAM3X8E</title> + <title>ATSAM3X8E bare-metal notes</title> <link rel="stylesheet" href="/assets/css/main.css"> <link rel="stylesheet" href="/assets/css/skeleton.css"> </head> @@ -37,17 +37,26 @@ <main> <div class="container"> <div class="container-2"> - <h2 class="center" id="title">BARE-METAL ATSAM3X8E</h2> + <h2 class="center" id="title">ATSAM3X8E BARE-METAL NOTES</h2> <h5 class="center">16 SEPTEMBER 2024</h5> <br> - <div class="twocol justify"><p>Notes on programming bare-metal ATSAM3X8E chips (Arduino Due) using Serial Wire -Debug (SwD) protocol.</p> + <div class="twocol justify"><p>Bypassing ATSAM3X8E (Due) bootloader via Serial Wire Debug (SWD).</p> -<h2 id="toolchain">Toolchain</h2> +<p>Toolchain: ST-LINK/V2 programmer, OpenOCD, ARM GNU Compiler Toolchain.</p> -<p>ST-LINK/V2 programmer, OpenOCD, ARM GNU Compiler Toolchain.</p> +<p>ARM chips boot into 0x00000. GPNVM bits map one of ROM, flash0, flash1 to +0x00000:</p> -<h2 id="electrical-connections">Electrical connections</h2> +<ul> + <li>GPNVM1=0 → ROM (default).</li> + <li>GPNVM1=1 and GPNVM2=0 → flash0.</li> + <li>GPNVM1=1 and GPNVM2=1 → flash1.</li> +</ul> + +<p>By default, control jumps to Atmel’s SAM-BA bootloader in ROM. To bypass, set +GPNVM1=1 and place vector table at 0x80000 (flash0).</p> + +<p>Connect ST-LINK/v2 to Arduino Due’s DEBUG port:</p> <table style="border: none; width: 100%;"> <tr style="border: none;"> @@ -62,20 +71,7 @@ Debug (SwD) protocol.</p> </tr> </table> -<p>Arduino Due exposes the ATSAM3X8E’s SWD interface via its DEBUG port. The -ST-LINK/v2 programmer connects to that to communicate with the chip.</p> - -<h2 id="upload-procedure">Upload procedure</h2> - -<p>Build. Magic is in the script.ld linker script.</p> - -<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -T script.ld \ - -nostartfiles \ - -nostdlib \ - -o a.elf main.c -</code></pre></div></div> - -<p>Upload using OpenOCD:</p> +<p>Remap memory:</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ openocd -f openocd-due.cfg $ telnet localhost 4444 @@ -83,35 +79,18 @@ $ telnet localhost 4444 > at91sam3 gpnvm show > at91sam3 gpnvm set 1 > at91sam3 gpnvm show -$ openocd -f openocd-due.cfg -c "program a.elf verify reset exit" </code></pre></div></div> -<p>First command starts OpenOCD. Telnet session halts chip, checks GPNVM bit. If -unset (returns 0), set to 1 and verify. Final command uploads program. See -OpenOCD manual AT91SAM3 flash driver section for full command list.</p> +<p>Full command list is in OpenOCD manual AT91SAM3 (flash driver section).</p> -<h2 id="gpnvm-bits">GPNVM bits</h2> +<p>Compile and upload program:</p> -<p>ARM chips boot into address 0x00000. ATSAM3X8E has ROM and dual-banked flash -(flash0/flash1) at different addresses. GPNVM bits control which maps to -0x00000.</p> - -<p>GPNVM1 cleared (default): boots from ROM (Atmel SAM-BA bootloader). GPNVM1=1, -GPNVM2=0: flash0 (0x80000) maps to 0x00000. Both cleared: flash1 maps to -0x00000.</p> - -<p>Program goes in flash0, so set GPNVM1=1 to boot our code instead of bootloader.</p> - -<h2 id="linker-script-notes">Linker script notes</h2> - -<p>Vector table must be at first flash address–required for ARM chips unless -relocated using VTOR register.</p> - -<p>First vector table entry: stack pointer. Initialize to highest memory location -(ATSAM3X8E has descending stack).</p> - -<p>Second entry: reset vector. Place initialization code here (zero memory, set -registers) before jumping to main().</p> +<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -T script.ld \ + -nostartfiles \ + -nostdlib \ + -o a.elf main.c +$ openocd -f openocd-due.cfg -c "program a.elf verify reset exit" +</code></pre></div></div> <p>Commit: <a href="https://git.asciimx.com/bare-metal-arduino-due/commit/?id=318496925ca76668dd9d63c3d060376f489276f8">3184969</a></p> |
