mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-10-28 11:14:58 +00:00
crashmode
This commit is contained in:
+45
-15
@@ -1,26 +1,56 @@
|
||||
#!/usr/bin/env bash
|
||||
# Full fresh install of EMS-ESP on an ESP32 16MB board (s_16M_P).
|
||||
#
|
||||
# Run from the scripts folder:
|
||||
# ./do_fresh_install.sh
|
||||
#
|
||||
# Flash map (partitions/esp32_partition_16M.csv):
|
||||
# 0x1000 bootloader
|
||||
# 0x8000 partition table
|
||||
# 0xe000 otadata (boot_app0.bin selects app0)
|
||||
# 0x10000 recovery (factory / boot)
|
||||
# 0x490000 EMS-ESP (app0)
|
||||
# 0xdf0000 LittleFS
|
||||
#
|
||||
# Because otadata points at app0, the device boots EMS-ESP. Recovery stays
|
||||
# installed in factory for fallback. Do not write recovery at 0x1000 — that
|
||||
# is the bootloader, and the image overlaps the partition table at 0x8000.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
ESPTOOL=~/.platformio/penv/bin/esptool
|
||||
PORT=/dev/ttyUSB0
|
||||
BUILD=../.pio/build/s_16M_P
|
||||
BAUD=${BAUD:-2000000}
|
||||
|
||||
BUILD_BIN=../.pio/build/s_16M_P
|
||||
RECOVERY_BIN=../.pio/build/recovery_s_16M_P
|
||||
BOOT_APP0=~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin
|
||||
|
||||
# erase
|
||||
for f in \
|
||||
"$BUILD_BIN/bootloader.bin" \
|
||||
"$BUILD_BIN/partitions.bin" \
|
||||
"$BUILD_BIN/firmware.bin" \
|
||||
"$RECOVERY_BIN/firmware.bin" \
|
||||
"$BOOT_APP0"; do
|
||||
if [[ ! -f $f ]]; then
|
||||
echo "Missing $f — build s_16M_P and recovery_s_16M_P first" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# full erase, stay in download mode
|
||||
$ESPTOOL --chip esp32 --port $PORT --after no-reset erase-flash
|
||||
|
||||
# create the filesystem
|
||||
~/.platformio/penv/bin/python build_littlefs.py data $BUILD/littlefs.bin
|
||||
# create the filesystem, in case it's needed
|
||||
~/.platformio/penv/bin/python build_littlefs.py data $BUILD_BIN/littlefs.bin
|
||||
|
||||
# upload filesystem (spiffs partition @ 0xdf0000), leave halted so it doesn't boot yet
|
||||
$ESPTOOL --chip esp32 --port $PORT --baud 460800 \
|
||||
--before default-reset --after no-reset \
|
||||
write-flash -z --flash-mode dio --flash-freq 80m --flash-size detect \
|
||||
0xdf0000 $BUILD/littlefs.bin
|
||||
|
||||
# flash bootloader + partition table + app (app0 @ 0x490000), then boot
|
||||
$ESPTOOL --chip esp32 --port $PORT --baud 460800 \
|
||||
# bootloader, partitions, otadata, recovery, app, filesystem; then boot
|
||||
$ESPTOOL --chip esp32 --port $PORT --baud $BAUD \
|
||||
--before default-reset --after hard-reset \
|
||||
write-flash -z --flash-mode dio --flash-freq 80m --flash-size detect \
|
||||
0x1000 $BUILD/bootloader.bin \
|
||||
0x8000 $BUILD/partitions.bin \
|
||||
0x1000 $BUILD_BIN/bootloader.bin \
|
||||
0x8000 $BUILD_BIN/partitions.bin \
|
||||
0xe000 $BOOT_APP0 \
|
||||
0x490000 $BUILD/firmware.bin
|
||||
0x10000 $RECOVERY_BIN/firmware.bin \
|
||||
0x490000 $BUILD_BIN/firmware.bin \
|
||||
0xdf0000 $BUILD_BIN/littlefs.bin
|
||||
|
||||
Reference in New Issue
Block a user