You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 29, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+3-9Lines changed: 3 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,13 +11,7 @@ It is a much more space efficient alternative to the 4kB Atmel/Microchip [AN_423
11
11
12
12
Downloading can be accomplished with the existing [dfu-util](http://dfu-util.sourceforge.net/) utilities.
13
13
14
-
Downloading a raw binary file looks like this:
15
-
16
-
```
17
-
dfu-util -D write.bin
18
-
```
19
-
20
-
or by using the provided dx1elf2dfu utility, one can create a .dfu file to be downloaded:
14
+
Using the provided dx1elf2dfu utility, one can create a .dfu file; that file can then be downloaded like so:
21
15
22
16
```
23
17
dfu-util -D write.dfu
@@ -27,13 +21,13 @@ dfu-util -D write.dfu
27
21
28
22
The linker memory map of the user application must be modified to have an origin at 0x0000_0400 rather than at 0x0000_0000. This bootloader resides at 0x0000_0000.
29
23
30
-
When booting, the bootloader checks whether a GPIO pin (nominally PA15) is connected to ground. If so, it runs the bootloader instead of the user application.
24
+
When booting, the bootloader checks whether a GPIO pin (nominally PA15) is connected to ground. It also computes a CRC32 of the user application. If the user application is unprogrammed or corrupted, the CRC32 check should fall. If the CRC32 check fails or the GPIO pin is grounded, it runs the bootloader instead of the user application.
31
25
32
26
When branching to the user application, the bootloader includes functionality to update the [VTOR (Vector Table Offset Register)](http://infocenter.arm.com/help/topic/com.arm.doc.dui0662a/Ciheijba.html) and update the stack pointer to suit the value in the user application's vector table.
33
27
34
28
## Requirements for compiling
35
29
36
-
[Rowley Crossworks for ARM](http://www.rowley.co.uk/arm/) is presently needed to compile this code. With Crossworks for ARM v4.1.1, using the Clang 5.0.1 compiler produces an 1010 byte image. The more mainstream GCC does not appear to be optimized enough to produce an image that comes anywhere close to fitting into 1024 bytes.
30
+
[Rowley Crossworks for ARM](http://www.rowley.co.uk/arm/) is presently needed to compile this code. With Crossworks for ARM v4.3.0, using the Clang 7.0.0 compiler produces a 1014 byte image. The more mainstream GCC does not appear to be optimized enough to produce an image that comes anywhere close to fitting into 1024 bytes.
37
31
38
32
There is no dependency in the code on the [Rowley Crossworks for ARM](http://www.rowley.co.uk/arm/) toolchain per se, but at this time I am not aware of any other ready-to-use Clang ARM cross-compiler package that I can readily point users to.
This tool is a possible aid for developers who use the Dx1bootloader and want to generate a DFU image directly from a Dx1 ELF object file.
4
+
This tool is for users of the Dx1bootloader to generate a DFU image directly from a SAMD11/SAMD21 ELF object file.
5
+
6
+
This DFU image output includes a CRC32 calculation that is stored inside the user application; this is checked by the bootloader to verify the user application's integrity.
5
7
6
8
## Sample Usage
7
9
8
10
```
9
11
dx1elf2dfu myapp.elf myapp.dfu
10
12
```
11
13
14
+
## Theory of Operation
15
+
16
+
The Cortex-M0 vector table has nine unused 32-bit entries marked 'Reserved' that only serve as wasted flash space. By using two of these entries to store the user application length and its CRC32, the dx1elf2dfu utility can communicate this information to the bootloader without consuming additional space.
17
+
18
+
By storing the user application length, the bootloader will only compute the CRC32 over a prescribed portion of the flash. This frees the user application, if it wishes, to store and re-write data in upper portions of the flash without impacting the CRC32 protection.
0 commit comments