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
Copy file name to clipboardExpand all lines: spec/format-deprecated.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ is needed in the future, but currently its use is discouraged.
13
13
> **This format is for future use only. The "512 Byte Aligned Sections" format should be used instead**.
14
14
15
15
Grouping the Universal Hex records into self-contained 512-byte blocks overcomes issues arising from receiving file blocks out of order.
16
-
Furthermore, by making the first part of each 512-byte block contain header metadata, DAPLink can parse this information right and ‘throw away’ irrelevant blocks for its target.
16
+
Furthermore, by making the first part of each 512-byte block contain header metadata, DAPLink can parse this information on every block and ‘throw away’ irrelevant blocks for its target.
17
17
18
18
Unfortunately all version of DAPLink (up to version 0254 at the time of writing) will try to validate the first line of the Intel Hex file. If the record type in that line does not correspond to a valid Intel Hex record type (`0x00` to `0x05`), it will fail validation and the file won't be processed.
19
19
For this reason the first record of each block will be an Extended Linear Address record (`0x04`), and the second record will contain the block metadata in the Block start record.
@@ -22,7 +22,7 @@ For this reason the first record of each block will be an Extended Linear Addres
22
22
23
23
> **This format is for future use only. The "512 Byte Aligned Sections" format should be used instead**.
24
24
25
-
Conventional Intel Hex for micro:bitv1 or v2:
25
+
Conventional Intel Hex for micro:bitV1 or V2:
26
26
27
27
```
28
28
Extended Linear Address record (optional if the data starts at address 0x0000_xxxx)
The goal of a micro:bit Universal Hex is to be able to create a single-file format that can be flashed into a micro:bit V1 and a micro:bit V2 successfully.
27
+
The goal of the micro:bit Universal Hex specification is to enable the creation of a single hex file that can be flashed into a micro:bit V1 and a micro:bit V2 successfully.
Universal Hex is a superset of the Intel Hex file format to be able to contain binary code for multiple micro:bit boards or subsystems.
34
+
Universal Hex is a superset of the Intel Hex file format to be able to contain data for multiple micro:bit boards or subsystems.
26
35
27
36
The microcontroller used in the micro:bit V2 (nRF52) is different than the microcontroller used in micro:bit V1 (nRF51), with a different architecture (Arm Cortex M0+ vs Cortex M4), slightly different peripherals, and different hardware components on the board.
28
37
29
-
The micro:bit V1 and V2 boards use an interface chip with the DAPLink firmware to flash the target microcontroller. DAPLink is responsible for processing the files dropped into the micro:bit MSD drive and any new file format has to be implemented in that project.
38
+
The micro:bit V1 and V2 boards use an interface chip with the DAPLink firmware to flash the target microcontroller. DAPLink is responsible for processing the files dropped into the `MICROBIT` MSD drive and any new file format has to be implemented in this project.
30
39
31
-
To easily support our users, we want the online editors to generate a single file that will work in both micro:bit V1 and micro:bit V2.
40
+
To easily support the micro:bitusers, the online editors should generate a single file that will work in both micro:bit V1 and micro:bit V2.
32
41
33
-
Therefore, a micro:bit Universal Hex is a file that contains the binary data for both micro:bit V1 and micro:bit V2, in a format that the DAPLink can process to only write to memory the data relevant to its board.
42
+
Therefore, a micro:bit Universal Hex is a file that contains the user programmes for both micro:bit V1 and micro:bit V2, in a format that DAPLink can process to only write to memory the data relevant to its board.
34
43
35
44
36
45
## Requirements
@@ -44,7 +53,7 @@ Therefore, a micro:bit Universal Hex is a file that contains the binary data for
44
53
5. The micro:bit v2 DAPLink interface shall also consume ‘standard’ Intel Hex and bin files for micro:bit V2 (eg produced by Mbed or other tools)
45
54
46
55
47
-
## DAPLink Interface Versions Shipped
56
+
## DAPLink Versions Previously Shipped
48
57
49
58
- 0234: Version shipped in the original BBC drop, over 800K units with this version
50
59
- 0241: Version shipped in the v1.3B retail version
@@ -71,7 +80,7 @@ Conclusions about DAPLink versions:
71
80
72
81
The micro:bit Universal Hex format is a superset of the [Intel Hex file format](https://en.wikipedia.org/wiki/Intel_HEX) designed to be able to include data for multiple targets into a single file.
73
82
74
-
In all the DAPLink versions we’ve tested DAPLink ignores any Intel Hex record with an unrecognised record type.
83
+
In all the DAPLink versions tested DAPLink ignores any Intel Hex record with an unrecognised record type.
75
84
The only exception is the first line of the hex file, which needs to be a valid Intel Hex record, otherwise the entire file is discarded.
76
85
77
86
This can be used to our advantage to pack micro:bit V2 data within unused record types that will be ignored in the deployed versions of DAPLink for micro:bit V1, and will be correctly processed in DAPLink for micro:bit V2.
@@ -97,10 +106,10 @@ The data field for this record has a minimum size of 2 bytes. The valid values f
97
106
98
107
| Hex Code | Data Type | Description |
99
108
|----------|--------------|-------------|
100
-
|`0x9900`| micro:bit V1 |Contains data for micro:bit V1 |
101
-
|`0x9903`| micro:bit V2 |Contains data for micro:bit V2 |
109
+
|`0x9900`| micro:bit V1 |Section/block contains data, in data records (`0x00`), for micro:bit V1 |
110
+
|`0x9903`| micro:bit V2 |Section/blopck contains data, in custom data records (`0x0D`), for micro:bit V2 |
102
111
103
-
Additional data bytes can be included but will be ignored by DAPLink.
112
+
Including additional data bytes in this record will currently be ignored by DAPLink, but are reserved for future development.
104
113
105
114
106
115
## Universal Hex Block/Section Format
@@ -110,9 +119,9 @@ There are two valid formats for packing the V1 and V2 records:
110
119
- 512 Byte Blocks
111
120
- 512 Byte Aligned Sections (recommended format)
112
121
113
-
USB packs and sends data in blocks of 512 bytes. As the DAPLink MSD drive could receive the hex file blocks out-of-order, it would be useful to create a format that contains self-contained 512-byte blocks with metadata.
122
+
USB packs and sends data in blocks of 512 bytes. As the DAPLink MSD drive could receive the hex file blocks out-of-order, it is useful to create a format that contains self-contained 512-byte blocks with metadata.
114
123
115
-
Previous versions of this specification only defined the format described in the "512 Byte Blocks" section, but testing showed DAPLink 0234 was significantly slower to process this format.
124
+
Previous versions of this specification only defined the "512 Byte Blocks" format, but testing showed DAPLink 0234 was significantly slower to process these files.
116
125
For this reason the "512 Byte Aligned Sections" format was introduced and **is the currently recommended format**.
117
126
118
127
Receiving blocks out-of-order has not been an issue yet, but in case this becomes a problem in the future (e.g. an operating system update introduces this change), DAPLink will remain compatible with the "512 Byte Blocks" format, so that any online editors could switch to it without having to update the micro:bit firmware.
@@ -123,7 +132,7 @@ In both formats a Universal Hex must contain data for at least 2 targets, one fo
123
132
124
133
> **This format is for future use only. The "512 Byte Aligned Sections" format should be used instead**.
125
134
126
-
This format can be found in the [format-deprecated.md](https://github.com/microbit-foundation/spec-universal-hex/blob/master/spec/format-deprecated.md) document, and while it is supported by DAPLink, it use is discouraged.
135
+
This format can be found in the [format-deprecated.md](https://github.com/microbit-foundation/spec-universal-hex/blob/master/spec/format-deprecated.md) document, and while it is supported by DAPLink, its use is discouraged.
127
136
128
137
### 512 Byte Aligned Sections
129
138
@@ -141,8 +150,8 @@ So, each target section:
141
150
- Is 512-byte aligned
142
151
- Starts with an Extended Linear Address record
143
152
- Followed by a Block Start custom record (`0x0A`)
144
-
- This record type includes the target metadata in the Data field
145
-
- Then it includes all the data and Extended Linear Address (`0x04`) records for the target
153
+
- This record includes "Data Type" in the Data field to identified the targetted micro:bit version
154
+
- Then it includes all the Data (`0x00`) or Custom Data (`0x0D`), and Extended Linear Address (`0x04`) records for the target
146
155
- micro:bit V1 data uses the standard Intel Hex data record (`0x00`)
147
156
- Data for any other board, like the micro:bit V2, uses the Custom Data record type (`0x0D`)
148
157
- Extended Segment Address records (`0x03`) are converted to Extended Linear Address (`0x04`) records
@@ -155,12 +164,13 @@ So, each target section:
155
164
Note that the End Of File record is excluded from the sections, only one EoF record is include as the last record of the file.
156
165
157
166
It is also recommended to:
158
-
- Use Data or Custom Data records with 32 bytes in the Data field
167
+
- Use Data or Custom Data records with 16 bytes in the Data field
159
168
- The most common Data field sizes are 16 and 32 bytes
160
169
- Although the Intel Hex format does not limit the data field length, DAPLink has a max length of 32 bytes
161
-
- Having longer records reduces the overall file size and save up over a second of flashing time
170
+
- Having longer records reduces the overall file size and saves up over a second of flashing time
171
+
- However, there is an [issue](https://github.com/ARMmbed/DAPLink/pull/936) with 32 byte records and DAPLink versions 0256 and older
162
172
- Place the micro:bit V1 Section first, followed by the micro:bit V2 Section
163
-
- DAPLink versions < 255 only halt the target microcontroller when the first flash operation starts, so in the opposite order micro:bit V1 would flash the DAPLink LED a couple of seconds before the user program on the micro:bit stops running
173
+
- DAPLink versions < 0255 only halt the target microcontroller when the first flash operation starts, so in the opposite order micro:bit V1 would flash the DAPLink LED a couple of seconds before the user program on the micro:bit stops running
164
174
165
175
#### Section Format In A Hex File
166
176
@@ -289,3 +299,14 @@ Will transform into this Universal Hex:
289
299
:00000001FF <- End Of File record with a new line
290
300
291
301
```
302
+
303
+
304
+
## Doc Updates
305
+
306
+
| Version | Changes |
307
+
|--------------|---------|
308
+
| 0.4.0 | Initial release, as implemented in DAPLink 0255. |
309
+
|[1.0.0][100]| Changed recommendation from 32 bytes per data record to 16. |
310
+
|| Other minor tweaks in the text and content without changing the specification. |
0 commit comments