Skip to content

Commit e19420c

Browse files
committed
Fix firmware merge
1 parent 4c81d5c commit e19420c

File tree

4 files changed

+53
-7
lines changed

4 files changed

+53
-7
lines changed

esp/lcd_8048s070c.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ static esp_err_t app_lcd_init(void) {
7474
backlight_init(PIN_BL, 50);
7575

7676
ESP_LOGD(TAG, "Install LCD driver");
77+
// See e.g. https://github.com/MMlodzinski/Sunton_ESP32-8048S070c_ESP_IDF_LVGL_example/blob/main/example/main/bsp.h
7778
const esp_lcd_rgb_panel_config_t panel_config = {
7879
.clk_src = LCD_CLK_SRC_PLL160M,
7980
.timings =

scripts/merge_firmware.sh

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,56 @@
11
#!/usr/bin/env bash
22

3-
esptool.py --chip esp32 merge_bin \
3+
# Detect target - priority: command line arg > IDF_TARGET env var > sdkconfig fallback
4+
if [ $# -gt 0 ]; then
5+
TARGET="$1"
6+
echo "Using target from command line: $TARGET"
7+
elif [ -n "$IDF_TARGET" ]; then
8+
TARGET="$IDF_TARGET"
9+
echo "Using target from IDF_TARGET environment variable: $TARGET"
10+
else
11+
echo "Error: No target specified. Use:"
12+
echo " $0 <target> # Command line argument"
13+
echo " IDF_TARGET=<target> # Environment variable"
14+
echo ""
15+
echo "Supported targets: esp32, esp32s3"
16+
exit 1
17+
fi
18+
19+
# Set parameters based on target
20+
case "$TARGET" in
21+
"esp32")
22+
CHIP="esp32"
23+
FLASH_MODE="qio"
24+
FLASH_FREQ="80m"
25+
FLASH_SIZE="4MB"
26+
APP_OFFSET="0x10000"
27+
WWW_OFFSET="0x300000"
28+
;;
29+
"esp32s3")
30+
CHIP="esp32s3"
31+
FLASH_MODE="qio"
32+
FLASH_FREQ="80m"
33+
FLASH_SIZE="16MB"
34+
APP_OFFSET="0x10000"
35+
WWW_OFFSET="0xEE0000"
36+
;;
37+
*)
38+
echo "Error: Unsupported target $TARGET"
39+
exit 1
40+
;;
41+
esac
42+
43+
echo "Building merged firmware for $TARGET..."
44+
echo " Flash mode: $FLASH_MODE"
45+
echo " Flash freq: $FLASH_FREQ"
46+
echo " Flash size: $FLASH_SIZE"
47+
48+
esptool.py --chip "$CHIP" merge_bin \
449
-o ../build/merged-firmware.bin \
5-
--flash_mode dio \
6-
--flash_freq 80m \
7-
--flash_size 4MB \
50+
--flash_mode "$FLASH_MODE" \
51+
--flash_freq "$FLASH_FREQ" \
52+
--flash_size "$FLASH_SIZE" \
853
0x1000 ../build/bootloader/bootloader.bin \
954
0x8000 ../build/partition_table/partition-table.bin \
10-
0x20000 ../build/suntransit.bin \
11-
0x300000 ../build/www.bin \
55+
"$APP_OFFSET" ../build/suntransit.bin \
56+
"$WWW_OFFSET" ../build/www.bin

sdkconfig.defaults.esp32s3

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CONFIG_IDF_TARGET="esp32s3"
22
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
3-
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_esp32s3.csv"
3+
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_esp32s2.csv"
44
CONFIG_SPIRAM=y
55
CONFIG_SPIRAM_MODE_OCT=y
66
CONFIG_SPIRAM_XIP_FROM_PSRAM=y

0 commit comments

Comments
 (0)