-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
software/scripts: Split firmware flash and micropython update
Add a 2nd script to update the micropython code separately from reflashing the firmware image
- Loading branch information
Showing
2 changed files
with
63 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/sh | ||
|
||
if [ -z "$AMPY_PORT" ]; then | ||
echo This script updates all MicroPython code to the | ||
echo Lolibot. | ||
echo | ||
echo Please provide the AMPY_PORT environment variable | ||
echo containing the device name of the lolin32. | ||
echo e.g. AMPY_PORT=/dev/ttyUSB0 "$0" | ||
exit 1 | ||
fi | ||
|
||
echo '### Remove boot.py ###' | ||
ampy rm boot.py >/dev/null 2>&1 # TODO: Fix this command failing | ||
|
||
echo '### Make directories ###' | ||
for d in configuration lib lib/aiko lib/umqtt; do | ||
if ampy ls $d 2>&1 | grep RuntimeErr > /dev/null; then | ||
ampy mkdir $d | ||
fi | ||
done | ||
|
||
echo '### Copy configuration/*.py ###' | ||
ampy put configuration/led.py configuration/led.py | ||
ampy put configuration/lolibot.py configuration/lolibot.py | ||
ampy put configuration/mqtt.py configuration/mqtt.py | ||
ampy put configuration/services.py configuration/services.py | ||
ampy put configuration/wifi.py configuration/wifi.py | ||
|
||
echo '### Copy lib/aiko/*.py ###' | ||
ampy put lib/aiko/led.py lib/aiko/led.py | ||
ampy put lib/aiko/mqtt.py lib/aiko/mqtt.py | ||
ampy put lib/aiko/services.py lib/aiko/services.py | ||
ampy put lib/aiko/wifi.py lib/aiko/wifi.py | ||
|
||
echo '### Copy lolibot.py ###' | ||
ampy put lib/lolibot.py lib/lolibot.py | ||
|
||
echo '### Copy mpu9250.py ###' | ||
ampy put lib/mpu9250.py lib/mpu9250.py | ||
|
||
echo '### Copy lib/umqtt ###' | ||
ampy put lib/umqtt/simple.py lib/umqtt/simple.py | ||
ampy put lib/umqtt/robust.py lib/umqtt/robust.py | ||
|
||
echo '### Copy boot.py ###' | ||
ampy put boot.py | ||
|
||
echo '### Complete ###' | ||
|
||
# miniterm.py $AMPY_PORT 115200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,19 @@ | ||
#!/bin/sh | ||
|
||
if [ -z "$AMPY_PORT" ]; then | ||
echo This script re-flashes the firmware and copies | ||
echo all MicroPython scripts to the board. | ||
echo | ||
echo Please provide the AMPY_PORT environment variable | ||
echo containing the device name of the lolin32. | ||
echo e.g. AMPY_PORT=/dev/ttyUSB0 "$0" | ||
exit 1 | ||
fi | ||
|
||
D="`dirname $0`" | ||
|
||
echo '### Erase flash ###' | ||
esptool.py --chip esp32 --port $AMPY_PORT erase_flash | ||
|
||
echo '### Flash microPython ###' | ||
esptool.py --chip esp32 --port $AMPY_PORT write_flash -z 0x1000 firmware/esp32-20171122-v1.9.2-443-g236297f4.bin | ||
|
||
echo '### Remove boot.py ###' | ||
ampy rm boot.py >/dev/null 2>&1 # TODO: Fix this command failing | ||
|
||
echo '### Make directories ###' | ||
ampy mkdir configuration | ||
ampy mkdir lib | ||
ampy mkdir lib/aiko | ||
ampy mkdir lib/umqtt | ||
|
||
echo '### Copy configuration/*.py ###' | ||
ampy put configuration/led.py configuration/led.py | ||
ampy put configuration/lolibot.py configuration/lolibot.py | ||
ampy put configuration/mqtt.py configuration/mqtt.py | ||
ampy put configuration/services.py configuration/services.py | ||
ampy put configuration/wifi.py configuration/wifi.py | ||
|
||
echo '### Copy lib/aiko/*.py ###' | ||
ampy put lib/aiko/led.py lib/aiko/led.py | ||
ampy put lib/aiko/mqtt.py lib/aiko/mqtt.py | ||
ampy put lib/aiko/services.py lib/aiko/services.py | ||
ampy put lib/aiko/wifi.py lib/aiko/wifi.py | ||
|
||
echo '### Copy lolibot.py ###' | ||
ampy put lib/lolibot.py lib/lolibot.py | ||
|
||
echo '### Copy mpu9250.py ###' | ||
ampy put lib/mpu9250.py lib/mpu9250.py | ||
|
||
echo '### Copy lib/umqtt ###' | ||
ampy put lib/umqtt/simple.py lib/umqtt/simple.py | ||
ampy put lib/umqtt/robust.py lib/umqtt/robust.py | ||
|
||
echo '### Copy boot.py ###' | ||
ampy put boot.py | ||
|
||
echo '### Complete ###' | ||
|
||
# miniterm.py $AMPY_PORT 115200 |