8000 mimxrt/boards: Update the deploy instructions for the UF2 bootloader. · micropython/micropython@600851f · GitHub
[go: up one dir, main page]

Skip to content

Commit 600851f

Browse files
committed
mimxrt/boards: Update the deploy instructions for the UF2 bootloader.
Signed-off-by: robert-hh <robert@hammelrath.com>
1 parent 750937b commit 600851f

File tree

4 files changed

+123
-169
lines changed

4 files changed

+123
-169
lines changed
Lines changed: 9 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -1,141 +1,11 @@
11
## 1. Deploy the MicroPython firmware to the Metro M7 board.
22

3-
### 1.1 Deploy the firmware using the serial bootloader.
4-
5-
For initial deployment of the firmware a few preparation steps are required, which
6-
have to be done once.
7-
8-
1. Get the files ufconv.py and uf2families.json from the micropython/tools directory,
9-
e.g. at https://github.com/micropython/micropython/tree/master/tools.
10-
11-
2. Get the NXP program sdphost for your operating system, e.g. from
12-
https://github.com/adafruit/tinyuf2/tree/master/ports/mimxrt10xx/sdphost.
13-
You can also get them from the NXP web sites.
14-
15-
3. Get the UF2 boot-loader package https://github.com/adafruit/tinyuf2/releases/download/0.9.0/tinyuf2-imxrt1010_evk-0.9.0.zip
16-
and extract the file tinyuf2-imxrt1010_evk-0.9.0.bin.
17-
18-
Now you have all files at hand that you will need for updating.
19-
20-
1. Get the firmware you want to upload from the MicroPython download page.
21-
22-
2. Set the two BOOTSEL DIP switches to the 1/0 position, which is the opposite position of the normal use mode.
23-
24-
3. Push the reset button.
25-
26-
4. Run the commands:
27-
28-
```
29-
sudo ./sdphost -u 0x1fc9,0x0145 -- write-file 0x20206400 tinyuf2-imxrt1010_evk-0.9.0.bin
30-
sudo ./sdphost -u 0x1fc9,0x0145 -- jump-address 0x20207000
31-
```
32-
Wait until a drive icon appears on the computer (or mount it explicitly), and then run:
33-
```
34-
python3 uf2conv.py <firmware_xx.yy.zz.hex> --base 0x60000400 -f 0x4fb2d5bd
35-
```
36-
You can put all of that in a script. Just add a short wait before the 3rd command to let the drive connect.
37-
38-
5. Once the upload is finished, set the BOOTSEL DIP switches back to the 0/1 position and push reset.
39-
40-
Using sudo is Linux specific. You may not need it at all, if the access rights are set properly,
41-
and you will not need it for Windows.
42-
43-
### 1.2 Deploy the firmware using a JTAG adapter.
44-
45-
With a JTAG adapter the firmware can be easily installed. Appropriate tools are Segger JFlash Lite and
46-
the Segger Edu Mini adapter. Just use the firmware.hex file for loading, which will be loaded at the
47-
proper address.
48-
49-
50-
## 2. Deploy the WiFi firmware.
51-
52-
The NINA firmware in the NINA module has to be updated for use with MicroPython. That can be done
53-
using MicroPython and two small Python scripts.
54-
55-
The firmware binaries are available at
56-
https://github.com/micropython/micropython-lib/tree/master/micropython/espflash
57-
or https://github.com/robert-hh/Shared-Stuff. For the Metro M7 board, the
58-
NINA_FW_v1.5.0_Airlift.bin file is needed.
59-
60-
For firmware upload, the following connections to the WiFi module are required:
61-
62-
- Pin Reset (as above)
63-
- Pin GPIO0
64-
- UART RX
65-
- UART TX
66-
67-
The GPIO pins and UART device id varies between boards. At the Adafruit Metro M7 board,
68-
the UART is UART(1), and the Pin names for reset and GPIO0 are ESP_RESET and ESP_GPIO0.
69-
The firmware can be uploaded, using the espflash.py module, a short script
70-
using espflash.py and mpremote. espflash.py is available at
71-
https://github.com/micropython/micropython-lib/tree/master/micropython/espflash.
72-
This place also holds the example script.
73-
74-
```
75-
import espflash
76-
from machine import Pin
77-
from machine import UART
78-
import sys
79-
sys.path.append("/flash")
80-
81-
reset = Pin("ESP_RESET", Pin.OUT)
82-
gpio0 = Pin("ESP_GPIO0", Pin.OUT)
83-
uart = UART(0, 115200, timeout=350)
84-
85-
md5sum = b"b0b9ab23da820a469e597c41364acb3a"
86-
path = "/remote/NINA_FW_v1.5.0_Airlift.bin"
87-
88-
esp = espflash.ESPFlash(reset, gpio0, uart)
89-
# Enter bootloader download mode, at 115200
90-
esp.bootloader()
91-
# Can now change to higher/lower baud rate
92-
esp.set_baudrate(921600)
93-
# Must call this first before any flash functions.
94-
esp.flash_attach()
95-
# Read flash size
96-
size = esp.flash_read_size()
97-
# Configure flash parameters.
98-
esp.flash_config(size)
99-
# Write firmware image from internal storage.
100-
esp.flash_write_file(path)
101-
# Compares file and flash MD5 checksum.
102-
esp.flash_verify_file(path, md5sum)
103-
# Resets the ESP32 chip.
104-
esp.reboot()
105-
```
106-
107-
The script shows the set-up for the Metro M7 board.
108-
The md5sum is the one of the WiFi firmware. It may change and
109-
can be recalculated using e.g. the Linux `md5sum` command. It is used to
110-
verify the firmware upload. To upload the firmware, place the firmware
111-
and the above script (let's call it ninaflash.py) into the same directory
112-
on your PC, and run the command:
113-
```
114-
mpremote connect <port> mount . run ninaflash.py
115-
```
116-
After a while, the upload will start. A typical start sequence looks like:
117-
```
118-
Local directory . is mounted at /remote
119-
Failed to read response to command 8.
120-
Failed to read response to command 8.
121-
Changing baudrate => 921600
122-
Flash attached
123-
Flash size 2.0 MBytes
124-
Flash write size: 1310720 total_blocks: 320 block size: 4096
125-
Writing sequence number 0/320...
126-
Writing sequence number 1/320...
127-
Writing sequence number 2/320...
128-
Writing sequence number 3/320...
129-
Writing sequence number 4/320...
130-
....
131-
....
132-
Writing sequence number 317/320...
133-
Writing sequence number 318/320...
134-
Writing sequence number 319/320...
135-
Flash write finished
136-
Flash verify: File MD5 b'b0b9ab23da820a469e597c41364acb3a'
137-
Flash verify: Flash MD5 b'b0b9ab23da820a469e597c41364acb3a'
138-
Firmware verified.
139-
```
140-
The initial messages `Failed to read response to command 8.`
141-
can be ignored.
3+
The Metro M7 board comes pre-installed with a UF2 bootloader. It can
4+
be started by pushing reset twice. Then the bootloader drive will
5+
appear. If that does not happen or the bootloader was lost, you can
6+
reinstall the bootloader using the instructions by Adafruit
7+
here: https://learn.adafruit.com/adafruit-metro-m7-microsd/installing-the-bootloader
8+
9+
Once the bootloader is installed and started, you can install MicroPython
10+
by copying the .uf2 version of the firmware file to the bootloader
11+
drive. When the firmware is installed, the drive will disappear.
Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,43 @@
1-
For initial deployment of the firmware a few preparation steps are required, which
2-
have to be done once.
1+
The Olimex RT1011 board is delivered without firmware. The best option to
2+
install MicroPython is installing a UF2 bootstrap loader first, which then can be
3+
used to install and update MicroPython. The bootloader has to be installed
4+
only once.
35

4-
1. Get the files ufconv.py and uf2families.json from the micropython/tools directory,
5-
e.g. at https://github.com/micropython/micropython/tree/master/tools.
6+
For initial deployment of the bootloader a few preparation steps are required, which
7+
have to be done once.
68

7-
2. Get the NXP program sdphost for your operating system, e.g. from
9+
1. Get the NXP program sdphost for your operating system, e.g. from
810
https://github.com/adafruit/tinyuf2/tree/master/ports/mimxrt10xx/sdphost.
911
You can also get them from the NXP web sites.
1012

11-
3. Get the UF2 boot-loader package https://github.com/adafruit/tinyuf2/releases/download/0.9.0/tinyuf2-imxrt1010_evk-0.9.0.zip
12-
and extract the file tinyuf2-imxrt1010_evk-0.9.0.bin.
13+
2. Get the UF2 boot-loader package https://github.com/adafruit/tinyuf2/releases/tag/0.20.1/tinyuf2-imxrt1010_evk-0.20.1.zip and extract the files `tinyuf2-imxrt1010_evk-0.20.1.bin`
14+
. You may as well go for a newer release.
1315

1416
Now you have all files at hand that you will need for updating.
1517

16-
1. Get the firmware you want to upload from the MicroPython download page.
18+
1. Get the firmware file you want to upload with the .uf2 extension from the MicroPython download page.
1719

1820
2. Push and hold the "Boot" button, then press "Reset", and release both buttons.
1921

2022
3. Run the commands:
2123

2224
```
23-
sudo ./sdphost -u 0x1fc9,0x0145 -- write-file 0x20206400 tinyuf2-imxrt1010_evk-0.9.0.bin
25+
sudo ./sdphost -u 0x1fc9,0x0145 -- write-file 0x20206400 tinyuf2-imxrt1010_evk-0.20.1.bin
2426
sudo ./sdphost -u 0x1fc9,0x0145 -- jump-address 0x20207000
2527
```
26-
Wait until a drive icon appears on the computer (or mount it explicitly), and then run:
27-
```
28-
python3 uf2conv.py <firmware_xx.yy.zz.hex> --base 0x60000400 -f 0x4fb2d5bd
29-
```
30-
You can put all of that in a script. Just add a short wait before the 3rd command to let the drive connect.
31-
32-
4. Once the upload is finished, push Reset again.
28+
Wait until a drive icon appears on the computer (or mount it explicitly). Then the UF2 bootloader
29+
is permanently installed.
3330

3431
Using sudo is Linux specific. You may not need it at all, if the access rights are set properly,
3532
and you will not need it for Windows.
3633

37-
Once the generic boot-loader is available, this procedure is only required for the first
38-
firmware load or in case the flash is corrupted and the existing firmware is not functioning
39-
any more.
34+
4. Once the upload of the bootloader is finished, push Reset twice.
35+
36+
The bootloader should start and show a drive icon. Copy the .uf2 version of MicroPython
37+
to this drive to install or update MicroPython.
38+
39+
Once the UF2 bootloader is installed, only step 4 is required to deploy MicroPython. If
40+
MicroPython is already installed, the bootloader can as well be invoked by calling
41+
`machine.bootloader()`.
42+
43+
If at any time the flash content is corrupted you can always start over from the beginning.
Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,52 @@
1-
Firmware upload to the Seed ARCH MIX board can be done using the J-Link interface
2-
For that, follow the instructions given by Seed in their Wiki at
3-
https://wiki.seeedstudio.com/Arch_Mix/#flashing-arduino-bootloader-to-arch-mix.
4-
You will need a J-Link debug probe and software. What has been tested was the
5-
Segger JLlink edu or Segger JLink edu mini. As matching loader tool you can use
6-
Segger JFlashLite. The target address for loading is 0x60000000.
1+
The Seeed Arch Mix board is delivered without firmware. The best option to
2+
install MicroPython is installing a UF2 bootstrap loader first, which then can be
3+
used to install and update MicroPython. The bootloader has to be installed
4+
only once.
5+
6+
For initial deployment of the bootloader a few preparation steps are required, which
7+
have to be done once.
8+
9+
1. Get the NXP program sdphost for your operating system, e.g. from
10+
https://github.com/adafruit/tinyuf2/tree/master/ports/mimxrt10xx/sdphost.
11+
You can also get them from the NXP web sites.
12+
13+
2. Get the UF2 boot-loader package https://github.com/adafruit/tinyuf2/releases/tag/0.20.1/tinyuf2-imxrt1050_evkb-0.20.1.zip and extract the files `tinyuf2-imxrt1050_evkb-0.20.1.bin`.
14+
You may as well go for a newer release.
15+
16+
Now you have all files at hand that you will need for updating.
17+
18+
1. Get the firmware file you want to upload with the .uf2 extension from the MicroPython download page.
19+
20+
2. At the Seeed Arch Mix board, connect the RX pin (J3-19) with 3.3V, and change the DIP switches
21+
3 an 4 at SW1 from 1-0 to 0-1.
22+
23+
3. Push Reset.
24+
25+
4. Run the commands:
26+
27+
```
28+
sudo ./sdphost -u 0x1fc9,0x0130 -- write-file 0x1000 tinyuf2-imxrt1050_evkb-0.20.1.bin
29+
sudo ./sdphost -u 0x1fc9,0x0130 -- jump-address 0x2000
30+
```
31+
Wait until a drive icon appears on the computer (or mount it explicitly). When using the above
32+
mentioned bootloader, it has the label `RT1050BOOT`. Then the UF2 bootloader
33+
is permanently installed.
34+
35+
Using sudo is Linux specific. You may not need it at all, if the access rights are set properly,
36+
and you will not need it for Windows.
37+
38+
5. At the Seeed Arch Mix board, disconnect the RX pin (J3-19) with 3.3V, and change the DIP switches
39+
3 an 4 at SW1 back to 1-0.
40+
41+
6. Once the upload of the bootloader is finished or when it is already installed, push Reset twice.
42+
43+
The bootloader should start and show a drive icon. Do not push too fast. The i.MX RT MCU
44+
have no dedicated Reset Pin and are reset through power cycling, which may be slow.
45+
Copy the .uf2 version of MicroPython to this drive to install or update MicroPython.
46+
If after steps 1-4 the bootloader drive is already shown, you do not have to reset again.
47+
48+
Once the UF2 bootloader is installed, only step 6 is required to deploy MicroPython. If
49+
MicroPython is already installed, the bootloader can as well be invoked by calling
50+
`machine.bootloader()` or switching the USB baud rate at the PC to 1200 baud and back.
51+
52+
If at any time the flash content is corrupted you can always start over from the beginning.

ports/mimxrt/boards/deploy_mimxrt.md

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,45 @@
1-
Firmware can be loaded to the MIMXRT development boards in various ways. The most convenient
2-
one is using the built-in support MCU. When a PC is connected to the debug USB port, a drive
3-
icon will appear. Firmware can be uploaded to the board by copying it to this drive. The copy
4-
and flashing will take a few moments. At the end of the upload, the drive icon will disappear
5-
and reappear again. Then the reset button has to be pushed, which starts the MicroPython firmware.
1+
## Firmware installation options
2+
3+
There are two ways to load the MicroPython firmware to the device:
4+
5+
1. Load the MicroPython firmware directly to the device. The MicroPython
6+
firmware files for that method have the extension .bin or .hex and are available
7+
at the MicroPython download site.
8+
2. Install a resident UF2 bootstrap loader to the device first and use that later for loading
9+
MicroPython. The MicroPython firmware files for that method have the extension .uf2
10+
and are available at the MicroPython download site. The UF2 bootstrap loader can be obtained
11+
from the site https://github.com/adafruit/tinyuf2. Open the recent release page and
12+
get the version of the bootloader for your board. If there is no specific bootloader
13+
for a specific board, get versions for the respective imxrt10xx-evk board. The file
14+
with the .bin or .hex extension is the one to be installed first.
15+
16+
## Direct loading of MicroPython or installation of the UF2 bootloader
17+
18+
The MicroPython firmware or the UF2 bootstrap loader can be loaded to the MIMXRT development
19+
boards in various ways. The most convenient one is using the built-in support MCU. When a PC
20+
is connected to the debug USB port, a drive icon will appear. Firmware can be uploaded to
21+
the board by copying it to this drive. The copy and flashing will take a few moments.
22+
At the end of the upload, the drive icon will disappear and reappear again. Then the reset
23+
button has to be pushed, which starts the MicroPython firmware.
624

725
Depending on the power jumper settings, both the debug USB and OTG USB port have to be powered
826
during firmware upload.
927

1028
You may as well load the firmware using the JLink port or openSDA interface with the appropriate tools.
1129
For more options, consult the user guide of the board.
30+
31+
## Installing the MicroPython firmware using the UF2 bootloader
32+
33+
When using the UF2 bootloader, the OTG USB port will be used.
34+
Once the UF2 bootloader is installed, it has to be started to upload MicroPython.The
35+
methods to start the bootloader are:
36+
37+
- Push reset twice.
38+
- Call machine.bootloader() e.g. from REPL.
39+
- Switch the USB port shortly to 1200 baud and back. That requires MicroPython to be
40+
installed.
41+
42+
If there is no valid Firmware on the device, the bootloader will start automatically.
43+
Once it's started, a drive ICON will appear. The MicroPyhton firmware file with .uf2
44+
extension must then be copied to that drive. When the file is copied and MicroPython
45+
is installed, the drive disappears and MicroPython starts.

0 commit comments

Comments
 (0)
0