Skip to content

Commit 714cf45

Browse files
committed
Add 8MB variant of the Waveshare panel
1 parent 957c0e6 commit 714cf45

26 files changed

Lines changed: 824 additions & 133 deletions

CHANGELOG.md

Lines changed: 400 additions & 0 deletions
Large diffs are not rendered by default.

CMakeLists.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,30 @@
11
cmake_minimum_required(VERSION 3.22)
22

3+
# PiLab Panel flash-size variant selection.
4+
# Default remains 16MB to preserve the original v6.45.41 build behavior.
5+
# Build 8MB variant with:
6+
# idf.py -B build_8mb -DPILAB_FLASH_SIZE=8MB build
7+
# Build 16MB variant with:
8+
# idf.py -B build_16mb -DPILAB_FLASH_SIZE=16MB build
9+
set(PILAB_FLASH_SIZE "16MB" CACHE STRING "PiLab Panel flash variant: 8MB or 16MB")
10+
set_property(CACHE PILAB_FLASH_SIZE PROPERTY STRINGS "8MB" "16MB")
11+
12+
if(PILAB_FLASH_SIZE STREQUAL "8MB")
13+
set(SDKCONFIG_DEFAULTS
14+
"sdkconfig.defaults.common"
15+
"sdkconfig.defaults.8mb"
16+
)
17+
elseif(PILAB_FLASH_SIZE STREQUAL "16MB")
18+
set(SDKCONFIG_DEFAULTS
19+
"sdkconfig.defaults.common"
20+
"sdkconfig.defaults.16mb"
21+
)
22+
else()
23+
message(FATAL_ERROR "Unsupported PILAB_FLASH_SIZE='${PILAB_FLASH_SIZE}'. Use 8MB or 16MB.")
24+
endif()
25+
26+
message(STATUS "PiLab Panel flash variant: ${PILAB_FLASH_SIZE}")
27+
message(STATUS "PiLab Panel sdkconfig defaults: ${SDKCONFIG_DEFAULTS}")
28+
329
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
430
project(PiLab_Panel)

README.md

Lines changed: 114 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,30 @@ The local tag database is the normalization layer. Future drivers such as PiLink
5050
Primary target:
5151

5252
- Waveshare ESP32-S3 7-inch RGB LCD touch panel
53-
- ESP32-S3 with PSRAM, commonly the N16R8-style configuration
53+
- ESP32-S3 with PSRAM
5454
- 800x480 RGB LCD
5555
- GT911 touch controller
5656
- CH422G I/O expander used by the Waveshare board
5757

5858
The firmware is not a generic ESP32-S3 display project. It contains board-specific display, touch, reset, and backlight handling for this Waveshare panel.
5959

60+
### Flash / PSRAM variants
61+
62+
The Waveshare ESP32-S3 7-inch LCD board appears to exist in at least two memory configurations:
63+
64+
- 16MB Flash / 8MB PSRAM
65+
- 8MB Flash / 8MB PSRAM
66+
67+
Both variants use the same PiLab Panel source code, but they require different ESP-IDF flash-size settings and different partition tables.
68+
69+
If the wrong firmware is flashed, the install may appear to complete, but the board can reboot before Wi-Fi starts. A typical monitor message for flashing the 16MB firmware onto an 8MB board is:
70+
71+
```text
72+
Detected size(8192k) smaller than the size in the binary image header(16384k)
73+
```
74+
75+
If you see that message, build or flash the 8MB variant.
76+
6077
## Repository layout
6178

6279
```text
@@ -73,23 +90,53 @@ panel_web/
7390
tools/ Web build helper scripts
7491
7592
tools/
76-
embed_web_assets.py Converts built HTML into C source for firmware embedding
93+
embed_web_assets.py Converts built HTML into C source for firmware embedding
94+
build_8mb.ps1 Builds the 8MB flash variant
95+
build_16mb.ps1 Builds the 16MB flash variant
96+
copyFirmware.ps1 Copies built firmware into the web flasher folder
97+
98+
webflasher/
99+
index.html ESP Web Tools browser flasher page
100+
manifest_8mb.json Web flasher manifest for 8MB flash boards
101+
manifest_16mb.json Web flasher manifest for 16MB flash boards
102+
firmware/8mb/ 8MB build output copied here for GitHub Pages
103+
firmware/16mb/ 16MB build output copied here for GitHub Pages
77104
78105
docs/
79106
Architecture, build, validation, diagnostics, and contributor notes
80107
```
81108

82109
## Quick start
83110

84-
### Build firmware only
111+
### 1. Set the ESP-IDF target
112+
113+
Run this once after cloning or unpacking the project:
85114

86115
```bash
87116
idf.py set-target esp32s3
88-
idf.py build
89-
idf.py flash monitor
90117
```
91118

92-
### Connect to the panel
119+
### 2. Choose the correct flash variant
120+
121+
PiLab Panel now supports separate 8MB and 16MB flash builds.
122+
123+
Use the 16MB build for original Waveshare ESP32-S3N16R8-style boards:
124+
125+
```bash
126+
idf.py -B build_16mb -DPILAB_FLASH_SIZE=16MB build
127+
idf.py -B build_16mb flash monitor
128+
```
129+
130+
Use the 8MB build for Waveshare boards that report 8MB flash:
131+
132+
```bash
133+
idf.py -B build_8mb -DPILAB_FLASH_SIZE=8MB build
134+
idf.py -B build_8mb flash monitor
135+
```
136+
137+
The `-B` option keeps each variant in a separate build folder. This is important because ESP-IDF stores the selected sdkconfig in the build directory.
138+
139+
### 3. Connect to the panel
93140

94141
After flashing, connect a PC, tablet, or phone to:
95142

@@ -99,26 +146,84 @@ Password: pilabpanel
99146
URL: http://192.168.4.1
100147
```
101148

149+
If the panel has been configured to join your Wi-Fi network, it may also be reachable by mDNS:
150+
151+
```text
152+
http://pilab-panel.local
153+
```
154+
102155
### Rebuild the web editor and firmware
103156

157+
The zip intentionally does not include `node_modules`. To rebuild the browser editor and embed it into the ESP32 firmware:
158+
104159
```bash
105160
cd panel_web
106161
npm install
107162
npm run build
108163
npm run embed
109164
cd ..
110-
idf.py build
111-
idf.py flash monitor
112165
```
113166

114-
The zip intentionally does not include `node_modules`.
167+
Then build the firmware variant you need:
168+
169+
```bash
170+
idf.py -B build_16mb -DPILAB_FLASH_SIZE=16MB build
171+
```
172+
173+
or:
174+
175+
```bash
176+
idf.py -B build_8mb -DPILAB_FLASH_SIZE=8MB build
177+
```
178+
179+
## Flash variant files
180+
181+
The project uses these files for the two hardware variants:
182+
183+
```text
184+
sdkconfig.defaults.common
185+
sdkconfig.defaults.16mb
186+
sdkconfig.defaults.8mb
187+
partitions_16mb.csv
188+
partitions_8mb.csv
189+
```
190+
191+
`CMakeLists.txt` selects the correct sdkconfig defaults from the `PILAB_FLASH_SIZE` option.
192+
193+
The default is still 16MB if no option is provided.
194+
195+
## Updating the web flasher firmware files
196+
197+
After building a firmware variant, copy the generated ESP-IDF binaries into the `webflasher` folder.
198+
199+
For the 16MB variant:
200+
201+
```powershell
202+
.\tools\copyFirmware.ps1 -Variant 16mb -BuildDir build_16mb
203+
```
204+
205+
For the 8MB variant:
206+
207+
```powershell
208+
.\tools\copyFirmware.ps1 -Variant 8mb -BuildDir build_8mb
209+
```
210+
211+
The web flasher has two manifests:
212+
213+
```text
214+
webflasher/manifest_16mb.json
215+
webflasher/manifest_8mb.json
216+
```
217+
218+
The GitHub Pages web flasher page provides separate install buttons for the 8MB and 16MB firmware builds.
115219

116220
## Main documentation
117221

118222
Start with these files:
119223

120224
- [`docs/USER_GUIDE.md`](docs/USER_GUIDE.md)
121225
- [`docs/BUILD_AND_FLASH.md`](docs/BUILD_AND_FLASH.md)
226+
- [`README_FLASH_VARIANTS.md`](README_FLASH_VARIANTS.md)
122227
- [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md)
123228
- [`docs/RUNTIME_LIFECYCLE.md`](docs/RUNTIME_LIFECYCLE.md)
124229
- [`docs/DIAGNOSTICS.md`](docs/DIAGNOSTICS.md)

partitions_16mb.csv

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Name, Type, SubType, Offset, Size, Flags
2+
nvs, data, nvs, 0x9000, 0x6000,
3+
phy_init, data, phy, 0xf000, 0x1000,
4+
factory, app, factory, 0x10000, 4M,
5+
storage, data, spiffs, , 8M,

partitions_8mb.csv

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# PiLab Panel ESP32-S3 8MB flash partition table
2+
# Fits Waveshare ESP32-S3-Touch-LCD-7 variants with 8MB Flash / 8MB PSRAM.
3+
# Name, Type, SubType, Offset, Size, Flags
4+
nvs, data, nvs, 0x9000, 0x6000,
5+
phy_init, data, phy, 0xf000, 0x1000,
6+
factory, app, factory, 0x10000, 4M,
7+
storage, data, spiffs, 0x410000, 0x3F0000,

sdkconfig.defaults

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
# PiLab Panel common ESP32-S3 defaults
2+
# Variant-specific flash size and partition table settings are in:
3+
# sdkconfig.defaults.8mb
4+
# sdkconfig.defaults.16mb
5+
16
# Target
27
CONFIG_IDF_TARGET="esp32s3"
38

4-
# Flash / PSRAM for Waveshare ESP32-S3-Touch-LCD-7 N16R8 style module
5-
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
9+
# Flash bus / PSRAM for Waveshare ESP32-S3-Touch-LCD-7 style modules
610
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
711
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
812
CONFIG_SPIRAM=y
@@ -13,15 +17,10 @@ CONFIG_SPIRAM_USE_MALLOC=y
1317
# v5.21 PSRAM diagnostic: allow small malloc() allocations to spill into PSRAM.
1418
# LVGL 9 object/spec-attribute/label allocations are often small; the previous
1519
# 4096 byte threshold strongly biased those allocations toward scarce internal
16-
# RAM. This keeps only very tiny allocations internal by default.
20+
# RAM. This keeps only very tiny allocations internal by default.
1721
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=64
1822
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768
1923

20-
# Use this partition file by default
21-
CONFIG_PARTITION_TABLE_CUSTOM=y
22-
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
23-
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
24-
2524
# FreeRTOS/LVGL friendliness
2625
CONFIG_ESP_MAIN_TASK_STACK_SIZE=16384
2726
CONFIG_FREERTOS_HZ=1000
@@ -41,3 +40,9 @@ CONFIG_FREERTOS_TASK_CREATE_ALLOW_EXT_MEM=y
4140
# Diagnostic LVGL build testing: keep the task watchdog enabled, but wait longer
4241
# before panic so large staged screen builds can prove whether they complete.
4342
CONFIG_ESP_TASK_WDT_TIMEOUT_S=10
43+
# PiLab Panel ESP32-S3 16MB flash variant
44+
# For Waveshare ESP32-S3-Touch-LCD-7 boards that report 16MB flash.
45+
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
46+
CONFIG_PARTITION_TABLE_CUSTOM=y
47+
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_16mb.csv"
48+
CONFIG_PARTITION_TABLE_FILENAME="partitions_16mb.csv"

sdkconfig.defaults.16mb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# PiLab Panel ESP32-S3 16MB flash variant
2+
# For Waveshare ESP32-S3-Touch-LCD-7 boards that report 16MB flash.
3+
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
4+
CONFIG_PARTITION_TABLE_CUSTOM=y
5+
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_16mb.csv"
6+
CONFIG_PARTITION_TABLE_FILENAME="partitions_16mb.csv"

sdkconfig.defaults.8mb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# PiLab Panel ESP32-S3 8MB flash variant
2+
# For Waveshare ESP32-S3-Touch-LCD-7 boards that report 8MB flash.
3+
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
4+
CONFIG_PARTITION_TABLE_CUSTOM=y
5+
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_8mb.csv"
6+
CONFIG_PARTITION_TABLE_FILENAME="partitions_8mb.csv"

sdkconfig.defaults.common

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# PiLab Panel common ESP32-S3 defaults
2+
# Variant-specific flash size and partition table settings are in:
3+
# sdkconfig.defaults.8mb
4+
# sdkconfig.defaults.16mb
5+
6+
# Target
7+
CONFIG_IDF_TARGET="esp32s3"
8+
9+
# Flash bus / PSRAM for Waveshare ESP32-S3-Touch-LCD-7 style modules
10+
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
11+
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
12+
CONFIG_SPIRAM=y
13+
CONFIG_SPIRAM_MODE_OCT=y
14+
CONFIG_SPIRAM_SPEED_80M=y
15+
CONFIG_SPIRAM_USE_MALLOC=y
16+
17+
# v5.21 PSRAM diagnostic: allow small malloc() allocations to spill into PSRAM.
18+
# LVGL 9 object/spec-attribute/label allocations are often small; the previous
19+
# 4096 byte threshold strongly biased those allocations toward scarce internal
20+
# RAM. This keeps only very tiny allocations internal by default.
21+
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=64
22+
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768
23+
24+
# FreeRTOS/LVGL friendliness
25+
CONFIG_ESP_MAIN_TASK_STACK_SIZE=16384
26+
CONFIG_FREERTOS_HZ=1000
27+
CONFIG_LOG_DEFAULT_LEVEL_INFO=y
28+
29+
# Workaround for ESP-IDF 6.0.1 / GCC 15.x internal compiler error seen while
30+
# compiling esp_lcd/rgb/esp_lcd_panel_rgb.c with debug optimization (-Og) on Windows.
31+
# Build IDF components with size optimization (-Os) instead of debug optimization.
32+
# CONFIG_COMPILER_OPTIMIZATION_DEBUG is not set
33+
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
34+
# CONFIG_COMPILER_OPTIMIZATION_PERF is not set
35+
# CONFIG_COMPILER_OPTIMIZATION_NONE is not set
36+
37+
# Allow AngelScript compiler task stack to live in PSRAM.
38+
CONFIG_FREERTOS_TASK_CREATE_ALLOW_EXT_MEM=y
39+
40+
# Diagnostic LVGL build testing: keep the task watchdog enabled, but wait longer
41+
# before panic so large staged screen builds can prove whether they complete.
42+
CONFIG_ESP_TASK_WDT_TIMEOUT_S=10

tools/build_16mb.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Build PiLab Panel for Waveshare ESP32-S3-Touch-LCD-7 16MB Flash / 8MB PSRAM boards.
2+
$ErrorActionPreference = "Stop"
3+
$Root = Resolve-Path (Join-Path (Split-Path -Parent $MyInvocation.MyCommand.Path) "..")
4+
Push-Location $Root
5+
try {
6+
idf.py -B build_16mb -DPILAB_FLASH_SIZE=16MB build
7+
} finally {
8+
Pop-Location
9+
}

0 commit comments

Comments
 (0)