Skip to content

Commit aa32933

Browse files
committed
Merge remote-tracking branch 'origin/add-updater-script' into ble_support
2 parents 1e04c74 + 1f0c720 commit aa32933

File tree

7 files changed

+200
-1
lines changed

7 files changed

+200
-1
lines changed

unor4wifi-reboot/compile_darwin.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
CGO_ENABLED=1 CC=x86_64-apple-darwin19-clang GOOS=darwin go build
1+
CGO_ENABLED=1 CC=x86_64-apple-darwin19-clang GOOS=darwin go build -o unor4wifi-reboot-macos

unor4wifi-reboot/compile_linux.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
go build -o unor4wifi-reboot-linux64

unor4wifi-updater/README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
## On Windows
2+
* Extract the zip file
3+
* Disconnect all USB gadgets from your PC
4+
* Connect your UNO R4 WiFi
5+
* Double click on update.bat
6+
* Follow instructions on the terminal window
7+
* Disconnect and connect your UNO R4 WiFi from your PC
8+
9+
On windows `espflash `do not list the board as `Espressif USB JTAG/serial debug unit` but only as generic `COMX` port.
10+
Check the `COMX` properties from the device manager to be sure what to select.
11+
12+
![image](https://github.com/pennam/UnoR4WiFiUpdate/assets/20436476/7c219bc1-d68e-4c61-8b43-ffffbba4955c) ![image](https://github.com/pennam/UnoR4WiFiUpdate/assets/20436476/ff2dbb8f-2d6c-4d6c-aab0-5002bd1a11d9)
13+
14+
If Windows is overprotective click on `More info` and then `Run anyway`
15+
16+
![image](https://github.com/pennam/UnoR4WiFiUpdate/assets/20436476/dbd20f28-c3c5-4194-b509-f728ac6dc0df)
17+
18+
## On Linux
19+
* Extract the zip file
20+
* Disconnect all USB gadgets from your PC
21+
* Connect your UNO R4 WiFi
22+
* From the terminal emulator run `./update.sh`
23+
* Follow instructions on the terminal window
24+
* Disconnect and connect your UNO R4 WiFi from your PC
25+
26+
On some distro may be required to run the script with `sudo`.
27+
28+
## On MacOS
29+
* Extract the zip file
30+
* Disconnect all USB gadgets from your PC
31+
* Connect your UNO R4 WiFi
32+
* Double click on update.command
33+
* Follow instructions on the terminal window
34+
* Disconnect and connect your UNO R4 WiFi from your PC
35+
36+
If MacOS complains about the developer run this commands from the root folder of the extracted .zip file and then double click again on the script.
37+
38+
```
39+
chmod a+x update.command
40+
sudo xattr -d com.apple.quarantine bin/espflash
41+
sudo xattr -d com.apple.quarantine bin/unor4wifi-reboot-macos
42+
```
43+
44+
Running the script from the terminal instead of double click should avoid the commands above.
45+
46+
![image](https://github.com/pennam/UnoR4WiFiUpdate/assets/20436476/dd776469-ba93-4430-9b72-25a6ca75840f)
47+
48+
## Troubleshooting
49+
* If the script report this error: `Cannot put the board in ESP mode. (via 'unor4wifi-reboot')`
50+
51+
### Option 1
52+
Disconnect and connect again your UNO R4 WiFi from your PC and re-run the script.
53+
54+
### Option 2
55+
Manually put the UNO R4 WiFi in ESP mode
56+
57+
1. Disconnect the UNO R4 WiFi from your PC
58+
2. Short the pins highlighted in the image using a jumper wire
59+
60+
![image](https://github.com/pennam/UnoR4WiFiUpdate/assets/20436476/b271759e-5d7b-44f5-954e-15bc0f7feae9)
61+
62+
3. Connect the UNO R4 WiFi to your PC
63+
4. From the root folder of the downloaded .zip file run
64+
65+
#### Linux and MacOS
66+
`./bin/espflash write-bin -b 115200 0x0 firmware/UNOR4-WIFI-S3-0.2.0-rc1.bin`
67+
68+
#### Windows
69+
`bin\espflash write-bin -b 115200 0x0 firmware\UNOR4-WIFI-S3-0.2.0-rc1.bin`
70+
71+
5. Disconnect and connect your UNO R4 WiFi from your PC

unor4wifi-updater/package.sh

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/bin/bash
2+
3+
function package_windows() {
4+
mkdir -p unor4wifi-update-windows
5+
mkdir -p unor4wifi-update-windows/bin
6+
mkdir -p unor4wifi-update-windows/firmware
7+
8+
wget https://github.com/esp-rs/espflash/releases/download/v2.0.0/espflash-x86_64-pc-windows-msvc.zip -O /tmp/espflash-x86_64-pc-windows-msvc.zip
9+
unzip /tmp/espflash-x86_64-pc-windows-msvc.zip -d unor4wifi-update-windows/bin
10+
11+
wget https://github.com/bcmi-labs/uno-r4-wifi-usb-bridge/releases/download/0.1.0/unor4wifi-reboot-windows.zip -O /tmp/unor4wifi-reboot-windows.zip
12+
unzip /tmp/unor4wifi-reboot-windows.zip -d unor4wifi-update-windows/bin
13+
14+
cp update_windows.bat unor4wifi-update-windows/update.bat
15+
wget https://github.com/bcmi-labs/uno-r4-wifi-usb-bridge/releases/download/0.2.0/S3.bin -O unor4wifi-update-windows/firmware/UNOR4-WIFI-S3-0.2.0-rc1.bin
16+
17+
zip -r unor4wifi-update-windows.zip unor4wifi-update-windows
18+
19+
}
20+
21+
function package_linux() {
22+
mkdir -p unor4wifi-update-linux
23+
mkdir -p unor4wifi-update-linux/bin
24+
mkdir -p unor4wifi-update-linux/firmware
25+
26+
wget https://github.com/esp-rs/espflash/releases/download/v2.0.0/espflash-x86_64-unknown-linux-gnu.zip -O /tmp/espflash-x86_64-unknown-linux-gnu.zip
27+
unzip /tmp/espflash-x86_64-unknown-linux-gnu.zip -d unor4wifi-update-linux/bin
28+
29+
wget https://github.com/bcmi-labs/uno-r4-wifi-usb-bridge/releases/download/0.1.0/unor4wifi-reboot-linux64.zip -O /tmp/unor4wifi-reboot-linux64.zip
30+
unzip /tmp/unor4wifi-reboot-linux64.zip -d unor4wifi-update-linux/bin
31+
32+
cp update_linux.sh unor4wifi-update-linux/update.sh
33+
wget https://github.com/bcmi-labs/uno-r4-wifi-usb-bridge/releases/download/0.2.0/S3.bin -O unor4wifi-update-linux/firmware/UNOR4-WIFI-S3-0.2.0-rc1.bin
34+
35+
zip -r unor4wifi-update-linux.zip unor4wifi-update-linux
36+
37+
}
38+
39+
40+
function package_macos() {
41+
mkdir -p unor4wifi-update-macos
42+
mkdir -p unor4wifi-update-macos/bin
43+
mkdir -p unor4wifi-update-macos/firmware
44+
45+
wget https://github.com/esp-rs/espflash/releases/download/v2.0.0/espflash-x86_64-apple-darwin.zip -O /tmp/espflash-x86_64-apple-darwin.zip
46+
unzip /tmp/espflash-x86_64-apple-darwin.zip -d unor4wifi-update-macos/bin
47+
48+
wget https://github.com/bcmi-labs/uno-r4-wifi-usb-bridge/releases/download/0.1.0/unor4wifi-reboot-macos.zip -O /tmp/unor4wifi-reboot-macos.zip
49+
unzip /tmp/unor4wifi-reboot-macos.zip -d unor4wifi-update-macos/bin
50+
51+
cp update_mac.command unor4wifi-update-macos/update.command
52+
wget https://github.com/bcmi-labs/uno-r4-wifi-usb-bridge/releases/download/0.2.0/S3.bin -O unor4wifi-update-macos/firmware/UNOR4-WIFI-S3-0.2.0-rc1.bin
53+
54+
zip -r unor4wifi-update-macos.zip unor4wifi-update-macos
55+
56+
}
57+
58+
59+
# Cleanup before starting
60+
rm -rf unor4wifi-update-linux*
61+
rm -rf unor4wifi-update-windows*
62+
rm -rf unor4wifi-update-macos*
63+
64+
package_macos
65+
package_linux
66+
package_windows
67+
68+
69+
70+
71+

unor4wifi-updater/update_linux.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
#set -e
3+
4+
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
5+
6+
cd "$SCRIPTPATH"
7+
8+
./bin/unor4wifi-reboot-linux64
9+
if [ "$?" -ne 0 ]; then
10+
echo "Cannot put the board in ESP mode. (via 'unor4wifi-reboot')"
11+
exit 1
12+
fi
13+
14+
echo "Start flashing firmware"
15+
sleep 1
16+
./bin/espflash write-bin -b 115200 0x0 firmware/UNOR4-WIFI-S3-0.2.0-rc1.bin

unor4wifi-updater/update_mac.command

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
#set -e
3+
4+
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
5+
6+
cd "$SCRIPTPATH"
7+
8+
./bin/unor4wifi-reboot-macos
9+
if [ "$?" -ne 0 ]; then
10+
echo "Cannot put the board in ESP mode. (via 'unor4wifi-reboot')"
11+
exit 1
12+
fi
13+
14+
echo "Start flashing firmware"
15+
sleep 1
16+
./bin/espflash write-bin -b 115200 0x0 firmware/UNOR4-WIFI-S3-0.2.0-rc1.bin

unor4wifi-updater/update_windows.bat

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@ECHO OFF
2+
SETLOCAL ENABLEDELAYEDEXPANSION
3+
setlocal
4+
5+
REM go to the folder where this bat script is located
6+
cd /d %~dp0
7+
8+
CALL bin\unor4wifi-reboot
9+
10+
IF %ERRORLEVEL% NEQ 0 (
11+
GOTO ESPMODEERROR
12+
)
13+
14+
echo Start flashing firmware
15+
timeout /t 5 /nobreak > NUL
16+
CALL bin\espflash write-bin -b 115200 0x0 firmware\UNOR4-WIFI-S3-0.2.0-rc1.bin
17+
18+
@pause
19+
exit /b 0
20+
21+
:ESPMODEERROR
22+
echo Cannot put the board in ESP mode. (via 'unor4wifi-reboot')
23+
@pause
24+
exit /b 1

0 commit comments

Comments
 (0)