Skip to content

Commit 39ff880

Browse files
authored
reorganize 8MB partition for MUI devices (#7860)
* reorganize 8MB partition for MUI devices * update device-install scripts to MUI 8MB partition scheme
1 parent 209157c commit 39ff880

File tree

9 files changed

+75
-40
lines changed

9 files changed

+75
-40
lines changed

bin/device-install.bat

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ SET "DEBUG=0"
77
SET "PYTHON="
88
SET "TFT_BUILD=0"
99
SET "BIGDB8=0"
10+
SET "MUIDB8=0"
1011
SET "BIGDB16=0"
1112
SET "ESPTOOL_BAUD=115200"
1213
SET "ESPTOOL_CMD="
@@ -17,7 +18,8 @@ SET "BPS_RESET=0"
1718
SET "S3=s3 v3 t-deck wireless-paper wireless-tracker station-g2 unphone t-eth-elite tlora-pager mesh-tab dreamcatcher ESP32-S3-Pico seeed-sensecap-indicator heltec_capsule_sensor_v3 vision-master icarus tracksenger elecrow-adv"
1819
SET "C3=esp32c3"
1920
@REM FIXME: Determine flash size from PlatformIO variant, this is unmaintainable.
20-
SET "BIGDB_8MB=picomputer-s3 unphone seeed-sensecap-indicator crowpanel-esp32s3 heltec_capsule_sensor_v3 heltec-v3 heltec-vision-master-e213 heltec-vision-master-e290 heltec-vision-master-t190 heltec-wireless-paper heltec-wireless-tracker heltec-wsl-v3 icarus seeed-xiao-s3 tbeam-s3-core tracksenger"
21+
SET "BIGDB_8MB=crowpanel-esp32s3 heltec_capsule_sensor_v3 heltec-v3 heltec-vision-master-e213 heltec-vision-master-e290 heltec-vision-master-t190 heltec-wireless-paper heltec-wireless-tracker heltec-wsl-v3 icarus seeed-xiao-s3 tbeam-s3-core tracksenger"
22+
SET "MUIDB_8MB=picomputer-s3 unphone seeed-sensecap-indicator"
2123
SET "BIGDB_16MB=t-deck mesh-tab t-energy-s3 dreamcatcher ESP32-S3-Pico m5stack-cores3 station-g2 t-eth-elite tlora-pager t-watch-s3 elecrow-adv"
2224

2325
GOTO getopts
@@ -162,6 +164,15 @@ FOR %%a IN (%BIGDB_8MB%) DO (
162164
)
163165
:end_loop_bigdb_8mb
164166

167+
FOR %%a IN (%MUIDB_8MB%) DO (
168+
IF NOT "!FILENAME:%%a=!"=="!FILENAME!" (
169+
@REM We are working with any of %MUIDB_8MB%.
170+
SET "MUIDB8=1"
171+
GOTO end_loop_muidb_8mb
172+
)
173+
)
174+
:end_loop_muidb_8mb
175+
165176
FOR %%a IN (%BIGDB_16MB%) DO (
166177
IF NOT "!FILENAME:%%a=!"=="!FILENAME!" (
167178
@REM We are working with any of %BIGDB_16MB%.
@@ -172,6 +183,7 @@ FOR %%a IN (%BIGDB_16MB%) DO (
172183
:end_loop_bigdb_16mb
173184

174185
IF %BIGDB8% EQU 1 CALL :LOG_MESSAGE INFO "BigDB 8mb partition selected."
186+
IF %MUIDB8% EQU 1 CALL :LOG_MESSAGE INFO "MUIDB 8mb partition selected."
175187
IF %BIGDB16% EQU 1 CALL :LOG_MESSAGE INFO "BigDB 16mb partition selected."
176188

177189
@REM Extract BASENAME from %FILENAME% for later use.
@@ -216,6 +228,12 @@ IF %BIGDB8% EQU 1 (
216228
SET "SPIFFS_OFFSET=0x670000"
217229
)
218230

231+
@REM Offsets for MUIDB 8mb.
232+
IF %MUIDB8% EQU 1 (
233+
SET "OTA_OFFSET=0x5D0000"
234+
SET "SPIFFS_OFFSET=0x670000"
235+
)
236+
219237
@REM Offsets for BigDB 16mb.
220238
IF %BIGDB16% EQU 1 (
221239
SET "OTA_OFFSET=0x650000"
@@ -232,14 +250,14 @@ IF NOT EXIST !SPIFFS_FILENAME! CALL :LOG_MESSAGE ERROR "File does not exist: "!S
232250

233251
@REM Flashing operations.
234252
CALL :LOG_MESSAGE INFO "Trying to flash "!FILENAME!", but first erasing and writing system information..."
235-
CALL :RUN_ESPTOOL !ESPTOOL_BAUD! erase-flash || GOTO eof
236-
CALL :RUN_ESPTOOL !ESPTOOL_BAUD! write-flash 0x00 "!FILENAME!" || GOTO eof
253+
CALL :RUN_ESPTOOL !ESPTOOL_BAUD! erase_flash || GOTO eof
254+
CALL :RUN_ESPTOOL !ESPTOOL_BAUD! write_flash 0x00 "!FILENAME!" || GOTO eof
237255

238256
CALL :LOG_MESSAGE INFO "Trying to flash BLEOTA "!OTA_FILENAME!" at OTA_OFFSET !OTA_OFFSET!..."
239-
CALL :RUN_ESPTOOL !ESPTOOL_BAUD! write-flash !OTA_OFFSET! "!OTA_FILENAME!" || GOTO eof
257+
CALL :RUN_ESPTOOL !ESPTOOL_BAUD! write_flash !OTA_OFFSET! "!OTA_FILENAME!" || GOTO eof
240258

241259
CALL :LOG_MESSAGE INFO "Trying to flash SPIFFS "!SPIFFS_FILENAME!" at SPIFFS_OFFSET !SPIFFS_OFFSET!..."
242-
CALL :RUN_ESPTOOL !ESPTOOL_BAUD! write-flash !SPIFFS_OFFSET! "!SPIFFS_FILENAME!" || GOTO eof
260+
CALL :RUN_ESPTOOL !ESPTOOL_BAUD! write_flash !SPIFFS_OFFSET! "!SPIFFS_FILENAME!" || GOTO eof
243261

244262
CALL :LOG_MESSAGE INFO "Script complete!."
245263

@@ -251,9 +269,9 @@ EXIT /B %ERRORLEVEL%
251269
:RUN_ESPTOOL
252270
@REM Subroutine used to run ESPTOOL_CMD with arguments.
253271
@REM Also handles %ERRORLEVEL%.
254-
@REM CALL :RUN_ESPTOOL [Baud] [erase_flash|write-flash] [OFFSET] [Filename]
272+
@REM CALL :RUN_ESPTOOL [Baud] [erase_flash|write_flash] [OFFSET] [Filename]
255273
@REM.
256-
@REM Example:: CALL :RUN_ESPTOOL 115200 write-flash 0x10000 "firmwarefile.bin"
274+
@REM Example:: CALL :RUN_ESPTOOL 115200 write_flash 0x10000 "firmwarefile.bin"
257275
IF %DEBUG% EQU 1 CALL :LOG_MESSAGE DEBUG "About to run command: !ESPTOOL_CMD! --baud %~1 %~2 %~3 %~4"
258276
CALL :RESET_ERROR
259277
!ESPTOOL_CMD! --baud %~1 %~2 %~3 %~4

bin/device-install.sh

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,33 @@ FIRMWARE_OFFSET=0x00
1111

1212
# Variant groups
1313
BIGDB_8MB=(
14-
"picomputer-s3"
15-
"unphone"
16-
"seeed-sensecap-indicator"
17-
"crowpanel-esp32s3"
18-
"heltec_capsule_sensor_v3"
19-
"heltec-v3"
20-
"heltec-vision-master-e213"
21-
"heltec-vision-master-e290"
22-
"heltec-vision-master-t190"
23-
"heltec-wireless-paper"
24-
"heltec-wireless-tracker"
25-
"heltec-wsl-v3"
26-
"icarus"
27-
"seeed-xiao-s3"
28-
"tbeam-s3-core"
29-
"tracksenger"
14+
"crowpanel-esp32s3"
15+
"heltec_capsule_sensor_v3"
16+
"heltec-v3"
17+
"heltec-vision-master-e213"
18+
"heltec-vision-master-e290"
19+
"heltec-vision-master-t190"
20+
"heltec-wireless-paper"
21+
"heltec-wireless-tracker"
22+
"heltec-wsl-v3"
23+
"icarus"
24+
"seeed-xiao-s3"
25+
"tbeam-s3-core"
26+
"tracksenger"
27+
)
28+
MUIDB_8MB=(
29+
"picomputer-s3"
30+
"unphone"
31+
"seeed-sensecap-indicator"
3032
)
3133
BIGDB_16MB=(
32-
"t-deck"
33-
"mesh-tab"
34-
"t-energy-s3"
35-
"dreamcatcher"
36-
"ESP32-S3-Pico"
37-
"m5stack-cores3"
38-
"station-g2"
34+
"t-deck"
35+
"mesh-tab"
36+
"t-energy-s3"
37+
"dreamcatcher"
38+
"ESP32-S3-Pico"
39+
"m5stack-cores3"
40+
"station-g2"
3941
"t-eth-elite"
4042
"tlora-pager"
4143
"t-watch-s3"
@@ -110,8 +112,8 @@ while [ $# -gt 0 ]; do
110112
shift
111113
;;
112114
--1200bps-reset)
113-
BPS_RESET=true
114-
;;
115+
BPS_RESET=true
116+
;;
115117
--) # Stop parsing options
116118
shift
117119
break
@@ -162,6 +164,13 @@ if [ -f "${FILENAME}" ] && [ -n "${FILENAME##*"update"*}" ]; then
162164
fi
163165
done
164166

167+
for variant in "${MUIDB_8MB[@]}"; do
168+
if [ -z "${FILENAME##*"$variant"*}" ]; then
169+
OFFSET=0x670000
170+
OTA_OFFSET=0x5D0000
171+
fi
172+
done
173+
165174
# littlefs* offset for BigDB 16mb and OTA OFFSET.
166175
for variant in "${BIGDB_16MB[@]}"; do
167176
if [ -z "${FILENAME##*"$variant"*}" ]; then
@@ -208,9 +217,9 @@ if [ -f "${FILENAME}" ] && [ -n "${FILENAME##*"update"*}" ]; then
208217
$ESPTOOL_CMD erase-flash
209218
$ESPTOOL_CMD write-flash $FIRMWARE_OFFSET "${FILENAME}"
210219
echo "Trying to flash ${OTAFILE} at offset ${OTA_OFFSET}"
211-
$ESPTOOL_CMD write-flash $OTA_OFFSET "${OTAFILE}"
220+
$ESPTOOL_CMD write_flash $OTA_OFFSET "${OTAFILE}"
212221
echo "Trying to flash ${SPIFFSFILE}, at offset ${OFFSET}"
213-
$ESPTOOL_CMD write-flash $OFFSET "${SPIFFSFILE}"
222+
$ESPTOOL_CMD write_flash $OFFSET "${SPIFFSFILE}"
214223

215224
else
216225
show_help

boards/seeed-sensecap-indicator.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"build": {
33
"arduino": {
44
"ldscript": "esp32s3_out.ld",
5-
"partitions": "default_8MB.csv",
5+
"partitions": "partition-table-8MB.csv",
66
"memory_type": "qio_opi"
77
},
88
"core": "esp32",

boards/unphone.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"arduino": {
44
"ldscript": "esp32s3_out.ld",
55
"memory_type": "qio_opi",
6-
"partitions": "default_8MB.csv"
6+
"partitions": "partition-table-8MB.csv"
77
},
88
"core": "esp32",
99
"extra_flags": [

partition-table-8MB.csv

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This is a layout for 8MB of flash for MUI devices
2+
# Name, Type, SubType, Offset, Size, Flags
3+
nvs, data, nvs, 0x9000, 0x5000,
4+
otadata, data, ota, 0xe000, 0x2000,
5+
app0, app, ota_0, 0x10000, 0x5C0000,
6+
flashApp, app, ota_1, 0x5D0000,0x0A0000,
7+
spiffs, data, spiffs, 0x670000,0x180000

variants/esp32s3/picomputer-s3/platformio.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
extends = esp32s3_base
33
board = bpi_picow_esp32_s3
44
board_check = true
5-
board_build.partitions = default_8MB.csv
5+
board_build.partitions = partition-table-8MB.csv
66
;OpenOCD flash method
77
;upload_protocol = esp-builtin
88
;Normal method

variants/esp32s3/seeed-sensecap-indicator/platformio.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ platform_packages =
66

77
board = seeed-sensecap-indicator
88
board_check = true
9-
board_build.partitions = default_8MB.csv
9+
board_build.partitions = partition-table-8MB.csv
1010
upload_protocol = esptool
1111

1212
build_flags = ${esp32_base.build_flags}

variants/esp32s3/unphone/platformio.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[env:unphone]
44
extends = esp32s3_base
55
board = unphone
6-
board_build.partitions = default_8MB.csv
6+
board_build.partitions = partition-table-8MB.csv
77
upload_speed = 921600
88
monitor_speed = 115200
99
monitor_filters = esp32_exception_decoder
@@ -20,6 +20,7 @@ build_flags =
2020
-D UNPHONE_LORA=0
2121
-D UNPHONE_FACTORY_MODE=0
2222
-D USE_SX127x
23+
-D SDCARD_CS=43
2324

2425
build_src_filter =
2526
${esp32s3_base.build_src_filter}
@@ -41,6 +42,7 @@ build_flags =
4142
-D HAS_SCREEN=1
4243
-D HAS_TFT=1
4344
-D HAS_SDCARD
45+
-D SDCARD_CS=43
4446
-D DISPLAY_SET_RESOLUTION
4547
-D RAM_SIZE=6144
4648
-D LV_CACHE_DEF_SIZE=2097152

variants/esp32s3/unphone/variant.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
#undef GPS_TX_PIN
5353

5454
#define SD_SPI_FREQUENCY 25000000
55-
#define SDCARD_CS 43
5655

5756
#define LED_PIN 13 // the red part of the RGB LED
5857
#define LED_STATE_ON 0 // State when LED is lit

0 commit comments

Comments
 (0)