<p>tsaitgaist has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-asf4-dfu/+/16865">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">document flashing procedure for sysmoOCTSIM<br><br>the sysmoOCTSIM board does not have an onboard EDBG adapter such as<br>the SAM E54 Xplained Pro board.<br>instead SWD is used directly.<br><br>Change-Id: I75766fc891dd835afc35ece9a1eee1c495c5ab20<br>---<br>M README.md<br>1 file changed, 8 insertions(+), 22 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-asf4-dfu refs/changes/65/16865/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/README.md b/README.md</span><br><span>index e63565e..5bf5e0a 100644</span><br><span>--- a/README.md</span><br><span>+++ b/README.md</span><br><span>@@ -1,8 +1,7 @@</span><br><span> This is an implementation of the DFU mode of the [USB DFU Device Class Specification](https://usb.org/document-library/device-firmware-upgrade-11-new-version-31-aug-2004) for the Microchip SAM D5x/E5x micro-controller.</span><br><span> It is meant to be used as bootloader to allow flashing the main application over USB.</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-The code has been developed using a [SAM E54](https://www.microchip.com/wwwproducts/en/ATSAME54P20A) micro-controller.</span><br><span style="color: hsl(0, 100%, 40%);">-It should work on any chip of the SAM D5x/E5x device family by replacing the corresponding device-specific definitions (usually including the chip name in the file name).</span><br><span style="color: hsl(120, 100%, 40%);">+This branch is specific to the proprietary sysmocom sysmoOCTSIM hardware.</span><br><span> </span><br><span> The code uses the [Atmel START](https://start.atmel.com/) ASFv4 library.</span><br><span> </span><br><span>@@ -51,6 +50,8 @@</span><br><span> Flashing</span><br><span> ========</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+To flash the bootloader you can use OpenOCD with any SWJ adapter.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> The USB DFU bootloader should be flashed in a protected area of the flash memory to prevent for erasing it, as specified in data sheet section 25.6.2 Memory Organization.</span><br><span> The bootloader size is configured in the NVM user configuration BOOTPROT field, as specified in data sheet section 25.6.9 NVM User Configuration.</span><br><span> The bit position of the BOOTPROT field is documented in data sheet section 9.4 NVM User Page Mapping.</span><br><span>@@ -58,29 +59,14 @@</span><br><span> This setting will also tell the bootloader where to flash the application firmware to (e.g. after the bootloader reserved space).</span><br><span> The LED will blink once per second if this size is not set.</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-EDBG</span><br><span>-----</span><br><span style="color: hsl(120, 100%, 40%);">+ST-LINK/V2</span><br><span style="color: hsl(120, 100%, 40%);">+----------</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-To flash the bootloader using the [edbg tool](https://github.com/ataradov/edbg) over the EDBG interface of the SAM E54 Xplained Pro development board.</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-To flash the USB DFU bootloader, perform the following actions:</span><br><span style="color: hsl(0, 100%, 40%);">-* remove reserved bootloader space so we can erase it: `edbg --target atmel_cm4v2 --fuse wv,29:26,15`</span><br><span style="color: hsl(0, 100%, 40%);">-* erase the whole flash: `edbg --target atmel_cm4v2 --fuse v,29:26,15 --erase`</span><br><span style="color: hsl(0, 100%, 40%);">-* program the bootloader: `edbg --target atmel_cm4v2 --fuse v,29:26,15 --program --verify --file bootloader-BOARD-XXXX.bin`</span><br><span style="color: hsl(0, 100%, 40%);">-* reserve bootloader space: `edbg --target atmel_cm4v2 --fuse wv,29:26,13`</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-SWJ</span><br><span>----</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-The bootloader can also be flashed over SWJ (e.g. JTAG or SWD).</span><br><span style="color: hsl(0, 100%, 40%);">-You need to perform the following actions:</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(120, 100%, 40%);">+To flash the USB DFU bootloader, we will use OpenOCD (with the [SAM E54 patch](http://openocd.zylin.com/#/c/4272/) and a ST-LINK/V2 SWD adapter.</span><br><span style="color: hsl(120, 100%, 40%);">+The command will perform the following actions:</span><br><span> * remove reserved bootloader space so we can erase it (and reset MCU for change to be effective)</span><br><span> * erase the whole flash</span><br><span> * program the bootloader</span><br><span> * reserve bootloader space</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-Using OpenOCD (with the [SAM E54 patch](http://openocd.zylin.com/#/c/4272/)) and a ST-LINK/V2 SWD adapter, run the following command:</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-`openocd --file interface/stlink.cfg --command "transport select hla_swd" --command "set CHIPNAME same54" --command "set CPUTAPID 0x2ba01477" --file target/atsame5x.cfg --command "init" --command "reset halt" --command "atsame5 bootloader 0" --command "flash erase_sector 0 0 last" --command "reset halt" --command "program ./bootloader.bin" --command "atsame5 bootloader 16384"  --command "reset run" --command "shutdown"`</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(120, 100%, 40%);">+`openocd --file interface/stlink.cfg --command "transport select hla_swd" --command "set CHIPNAME same54" --command "set CPUTAPID 0x2ba01477" --file target/atsame5x.cfg --command "init" --command "reset halt" --command "atsame5 bootloader 0" --command "flash erase_sector 0 0 last" --command "reset halt" --command "program ./AtmelStart.bin" --command "atsame5 bootloader 16384"  --command "reset run" --command "shutdown"`</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-asf4-dfu/+/16865">change 16865</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-asf4-dfu/+/16865"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-asf4-dfu </div>
<div style="display:none"> Gerrit-Branch: sysmoOCTSIM </div>
<div style="display:none"> Gerrit-Change-Id: I75766fc891dd835afc35ece9a1eee1c495c5ab20 </div>
<div style="display:none"> Gerrit-Change-Number: 16865 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: tsaitgaist <kredon@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>