Skip to content

Commit 4e8974a

Browse files
committed
pio: generic build env for ESP32-S2, and some cleanup
1 parent e8d3712 commit 4e8974a

File tree

2 files changed

+119
-25
lines changed

2 files changed

+119
-25
lines changed

platformio.ini

Lines changed: 69 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ default_envs =
6060
esp32_pico_4MB_M
6161
esp32_4MB_PSRAM_S
6262
esp32S3_8MB_M
63-
esp32s2_tinyUF2_PSRAM_M ;; experimental - only for adafruit -S2 boards with tinyUF2 bootloader !!!
63+
;; esp32s2_tinyUF2_PSRAM_S ;; experimental - only for adafruit -S2 boards with tinyUF2 bootloader !!!
64+
esp32s2_PSRAM_M ;; experimental
6465
esp32c3dev_4MB_M ;; experimental
6566
esp32_4MB_V4_S ;; experimental
6667
esp32_16MB_V4_M ;; experimental
@@ -1352,9 +1353,9 @@ board_build.flash_mode = qio
13521353
; RAM: [== ] 24.7% (used 80856 bytes from 327680 bytes)
13531354
; Flash: [======= ] 66.9% (used 1403489 bytes from 2097152 bytes)
13541355

1355-
;; MM max for Adafruit QT Py ESP32-S2 -> 4MB flash, PSRAM, and tinyUF2 bootloader
1356+
;; MM for Adafruit QT Py ESP32-S2 -> 4MB flash, PSRAM, and tinyUF2 bootloader
13561357
;; to ewowi - i'll optimize this entry later, as a few things can be inherited for sure. To softhack: sure ;-)
1357-
[env:esp32s2_tinyUF2_PSRAM_M]
1358+
[env:esp32s2_tinyUF2_PSRAM_S]
13581359
extends = esp32_4MB_V4_S_base
13591360
platform = ${esp32.platformV4}
13601361
platform_packages = ${esp32.platformV4_packages}
@@ -1365,27 +1366,25 @@ board_build.f_flash = 80000000L
13651366
board_build.flash_mode = qio
13661367
upload_speed = 256000 ;; 921600
13671368
build_unflags = ${common.build_unflags}
1368-
-D USERMOD_DALLASTEMPERATURE ;; disabled because it hangs during usermod setup on -S2 (autodetect broken?)
1369-
-D USE_ALT_DISPLAY ;; four line display seems to have problems with I2C - it hangs during usermod setup
1370-
-D USERMOD_FOUR_LINE_DISPLAY ;; see above
1371-
-D USERMOD_ROTARY_ENCODER_UI ;; see above
1369+
-D USERMOD_DALLASTEMPERATURE ;; disabled because it hangs during usermod setup on -S3 (autodetect broken?)
13721370
-D WLED_ENABLE_DMX ;; disabled because it does not work with ESP-IDF 4.4.x (buggy driver in SparkFunDMX)
13731371

13741372
build_flags = ${common.build_flags} ${esp32s2.build_flags}
13751373
; ${Debug_Flags.build_flags} ;ewowi: enabling debug causes Error: The program size (1463330 bytes) is greater than maximum allowed (1441792 bytes)
13761374
-D WLED_WATCHDOG_TIMEOUT=0 -D CONFIG_ASYNC_TCP_USE_WDT=0
1377-
${common_mm.build_flags_S} ${common_mm.build_flags_M}
1375+
${common_mm.build_flags_S}
13781376
-Wno-misleading-indentation -Wno-format-truncation
1379-
-D WLED_RELEASE_NAME=esp32S2_4MB_UF2_M
1377+
-D WLED_RELEASE_NAME=esp32S2_4MB_UF2_S
13801378
-DARDUINO_USB_CDC_ON_BOOT=1 ;; mandatory, otherwise USB does not work!!
13811379
-D WLED_DISABLE_ADALIGHT ;; disables serial protocols when using CDC USB (Serial RX will receive junk commands, unless its pulled down by resistor)
13821380
-DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=0
13831381
-D SERVERNAME='"WLED-S2"'
13841382
-D WLED_USE_PSRAM
1385-
-D WLED_DISABLE_INFRARED ;; save flash space
1386-
-D WLED_DISABLE_ALEXA ;; save flash space
1387-
-D WLED_DISABLE_HUESYNC ;; save flash space
1388-
-D WLED_DISABLE_LOXONE ;; save flash space
1383+
-D WLED_DISABLE_LOXONE ;; FLASH 1272 bytes
1384+
-D WLED_DISABLE_HUESYNC ;; RAM 122 bytes; FLASH 6308 bytes
1385+
-D WLED_DISABLE_ALEXA ;; RAM 116 bytes; FLASH 13524 bytes
1386+
; -D WLED_DISABLE_MQTT ;; RAM 216 bytes; FLASH 16496 bytes
1387+
-D WLED_DISABLE_INFRARED ;; RAM 136 bytes; FLASH 24492 bytes
13891388
-D LEDPIN=39 ;; onboard neopixel LED. Attach your own LEDs to GPIO 7 or GPIO 6
13901389
-D BTNPIN=0
13911390
;-D RLYPIN=6
@@ -1395,29 +1394,72 @@ build_flags = ${common.build_flags} ${esp32s2.build_flags}
13951394
-D HW_PIN_CLOCKSPI=36
13961395
-D HW_PIN_MISOSPI=37
13971396
-D AUDIOPIN=-1
1398-
-D SR_DMTYPE=1
1399-
-D I2S_SDPIN=9
1400-
-D I2S_WSPIN=8
1401-
-D I2S_CKPIN=17
1402-
-D MCLK_PIN=18
1397+
-D SR_DMTYPE=1 -D I2S_SDPIN=9 -D I2S_WSPIN=8 -D I2S_CKPIN=17 -D MCLK_PIN=18
14031398
;-D STATUSLED=-1
14041399
-D WLED_USE_MY_CONFIG
1400+
lib_deps = ${env.lib_deps} ${esp32s2.lib_deps} ${common_mm.lib_deps_S}
1401+
lib_ignore =
1402+
IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
1403+
OneWire ; not needed as we don't include USERMOD_DALLASTEMPERATURE
1404+
monitor_filters = esp32_exception_decoder
1405+
; RAM: [=== ] 25.1% (used 82348 bytes from 327680 bytes)
1406+
; Flash: [==========] 95.8% (used 1381742 bytes from 1441792 bytes)
1407+
1408+
;; MM environment for generic ESP32-S2, with PSRAM, 4MB flash (300kB filesystem to have more program space)
1409+
[env:esp32s2_PSRAM_M]
1410+
extends = esp32_4MB_V4_M_base
1411+
platform = espressif32@~5.2.0 ;; more stable on -S2 than 5.1.1
1412+
platform_packages =
1413+
1414+
board = lolin_s2_mini
1415+
board_build.partitions = tools/WLED_ESP32_4MB_256KB_FS.csv ;; 1.8MB firmware, 256KB filesystem (esptool erase_flash needed when changing from "standard WLED" partitions)
1416+
board_build.flash_mode = dio
1417+
upload_speed = 256000 ;; 921600
1418+
build_unflags = ${common.build_unflags}
1419+
-DARDUINO_USB_CDC_ON_BOOT=1
1420+
-D USERMOD_DALLASTEMPERATURE ;; disabled because it hangs during usermod setup on -S3 (autodetect broken?)
1421+
-D WLED_ENABLE_DMX ;; disabled because it does not work with ESP-IDF 4.4.x (buggy driver in SparkFunDMX)
1422+
build_flags = ${common.build_flags} ${esp32s2.build_flags}
1423+
${Debug_Flags.build_flags}
1424+
-D WLED_WATCHDOG_TIMEOUT=0 -D CONFIG_ASYNC_TCP_USE_WDT=0
1425+
${common_mm.build_flags_S} ${common_mm.build_flags_M}
1426+
-Wno-misleading-indentation -Wno-format-truncation
1427+
-D WLED_RELEASE_NAME=esp32S2_4MB_M
1428+
-DARDUINO_USB_CDC_ON_BOOT=0
1429+
-DARDUINO_USB_MSC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=0
1430+
-D WLED_DISABLE_ADALIGHT ;; disables serial protocols, as the board onl has CDC USB
1431+
-D WLED_USE_PSRAM -DBOARD_HAS_PSRAM
1432+
-D WLED_DISABLE_INFRARED ;; save flash space
1433+
-D WLED_DISABLE_ALEXA ;; save flash space
1434+
-D WLED_DISABLE_HUESYNC ;; save flash space
1435+
-D WLED_DISABLE_LOXONE ;; save flash space
1436+
-D LEDPIN=16
1437+
-D BTNPIN=-1 -D RLYPIN=-1 -D IRPIN=-1
1438+
-D HW_PIN_SCL=40 -D HW_PIN_SDA=41
1439+
-D HW_PIN_MOSISPI=35 ;WLEDMM renamed from HW_PIN_DATASPI
1440+
-D HW_PIN_CLOCKSPI=36
1441+
-D HW_PIN_MISOSPI=37
1442+
-D AUDIOPIN=-1
1443+
-D SR_DMTYPE=1 -D I2S_SDPIN=9 -D I2S_WSPIN=8 -D I2S_CKPIN=17 -D MCLK_PIN=18
1444+
-D WLED_USE_MY_CONFIG
14051445
lib_deps = ${env.lib_deps} ${esp32s2.lib_deps} ${common_mm.lib_deps_S} ${common_mm.lib_deps_V4_M}
1406-
lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
1446+
lib_ignore =
1447+
IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
1448+
OneWire ; not needed as we don't include USERMOD_DALLASTEMPERATURE
14071449
monitor_filters = esp32_exception_decoder
1408-
; RAM: [=== ] 25.4% (used 83324 bytes from 327680 bytes)
1409-
; Flash: [==========] 98.6% (used 1421778 bytes from 1441792 bytes)
1450+
; RAM: [== ] 22.9% (used 75068 bytes from 327680 bytes)
1451+
; Flash: [======== ] 78.3% (used 1487802 bytes from 1900544 bytes)
14101452

1411-
;; MM max environment for ESP32-C3 -> 4MB flash, no PSRAM
1412-
;; to ewowi - i'll optimize this entry later ;-) really, I mean
1453+
;; MM environment for ESP32-C3 -> 4MB flash, no PSRAM
14131454
[env:esp32c3dev_4MB_M]
14141455
extends = esp32_4MB_V4_S_base
14151456
;platform = ${esp32.platformV4}
14161457
;platform_packages = ${esp32.platformV4_packages}
14171458
platform = espressif32@~5.2.0 ;; alternative platform, might help in case you experience bootloops due to corrupted flash filesystem
14181459
platform_packages =
14191460
board = esp32-c3-devkitm-1
1420-
;board_build.partitions = tools/WLED_ESP32_2MB_noOTA.csv ;; for boards with 2MB flash only (like some Ai-Thinker ESP32-C3-12F models)
1461+
;board_build.partitions = tools/WLED_ESP32_4MB_256KB_FS.csv ;; 1.8MB firmware, 256KB filesystem (esptool erase_flash needed when changing from "standard WLED" partitions)
1462+
;board_build.partitions = tools/WLED_ESP32_2MB_noOTA.csv ;; use this for boards with 2MB flash (like some Ai-Thinker ESP32-C3-12F models)
14211463
upload_speed = 256000 ;; 921600
14221464

14231465
build_unflags = ${common.build_unflags}
@@ -1428,11 +1470,11 @@ build_unflags = ${common.build_unflags}
14281470
-D WLED_ENABLE_DMX ;; disabled because it does not work with ESP-IDF 4.4.x (buggy driver in SparkFunDMX)
14291471

14301472
build_flags = ${common.build_flags} ${esp32c3.build_flags}
1473+
; -D WLED_DISABLE_OTA ;; OTA is not possible for boards with 2MB flash only (like some Ai-Thinker ESP32-C3-12F models)
14311474
-D WLED_WATCHDOG_TIMEOUT=0 -D CONFIG_ASYNC_TCP_USE_WDT=0
14321475
${common_mm.build_flags_S} ${common_mm.build_flags_M}
14331476
-Wno-misleading-indentation -Wno-format-truncation
14341477
-D WLED_RELEASE_NAME=esp32c3dev_4MB_M
1435-
; -D WLED_DISABLE_OTA ;; OTA is not possible for boards with 2MB flash only (like some Ai-Thinker ESP32-C3-12F models)
14361478
; -DARDUINO_USB_CDC_ON_BOOT=1 ;; enable CDC USB -> needed for debugging over serial USB
14371479
; -D WLED_DISABLE_ADALIGHT ;; to disable serial protocols when using CDC USB (Serial RX will receive junk commands, unless its pulled down by resistor)
14381480
-DARDUINO_USB_CDC_ON_BOOT=0 ;; disable CDC USB
@@ -1452,6 +1494,8 @@ build_flags = ${common.build_flags} ${esp32c3.build_flags}
14521494
lib_deps = ${env.lib_deps} ${esp32c3.lib_deps} ${common_mm.lib_deps_S} ${common_mm.lib_deps_V4_M}
14531495
;lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
14541496
;monitor_filters = esp32_exception_decoder
1497+
; RAM: [== ] 23.1% (used 75620 bytes from 327680 bytes)
1498+
; Flash: [==========] 95.8% (used 1506216 bytes from 1572864 bytes)
14551499

14561500
# ------------------------------------------------------------------------------
14571501
# custom board environments

wled00/wled.cpp

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,56 @@
1212
#include "../tools/ESP32-Chip_info.hpp"
1313
#endif
1414

15+
16+
// WLEDMM some buildenv sanity checks
17+
18+
#ifdef ARDUINO_ARCH_ESP32 // ESP32
19+
#if !defined(ESP32)
20+
#error please fix your build environment. ESP32 is not defined.
21+
#endif
22+
#if defined(ESP8266) || defined(ARDUINO_ARCH_ESP8266)
23+
#error please fix your build environment. ESP32 and ESP8266 are both defined.
24+
#endif
25+
// only one of ARDUINO_ARCH_ESP32S2, ARDUINO_ARCH_ESP32S3, ARDUINO_ARCH_ESP32C3 allowed
26+
#if defined(ARDUINO_ARCH_ESP32S3) && ( defined(ARDUINO_ARCH_ESP32S2) || defined(ARDUINO_ARCH_ESP32C3) )
27+
#error please fix your build environment. only one of ARDUINO_ARCH_ESP32S3, ARDUINO_ARCH_ESP32S2, ARDUINO_ARCH_ESP32C3 may be defined
28+
#endif
29+
#if defined(ARDUINO_ARCH_ESP32S2) && ( defined(ARDUINO_ARCH_ESP32S3) || defined(ARDUINO_ARCH_ESP32C3) )
30+
#error please fix your build environment. only one of ARDUINO_ARCH_ESP32S3, ARDUINO_ARCH_ESP32S2, ARDUINO_ARCH_ESP32C3 may be defined
31+
#endif
32+
#if defined(CONFIG_IDF_TARGET_ESP32) && ( defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32C3))
33+
#error please fix your build environment. only one CONFIG_IDF_TARGET may be defined
34+
#endif
35+
// make sure we have a supported CONFIG_IDF_TARGET_
36+
#if !defined(CONFIG_IDF_TARGET_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32S3) && !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3)
37+
#error please fix your build environment. No supported CONFIG_IDF_TARGET was defined
38+
#endif
39+
#if CONFIG_IDF_TARGET_ESP32_SOLO || CONFIG_IDF_TARGET_ESP32SOLO
40+
#warning ESP32 SOLO (single core) is not supported.
41+
#endif
42+
// only one of CONFIG_IDF_TARGET_ESP32, CONFIG_IDF_TARGET_ESP32S2, CONFIG_IDF_TARGET_ESP32S3, CONFIG_IDF_TARGET_ESP32C3 is allowed
43+
#if defined(CONFIG_IDF_TARGET_ESP32) && ( defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32C3))
44+
#error please fix your build environment. only one CONFIG_IDF_TARGET may be defined
45+
#endif
46+
#if defined(CONFIG_IDF_TARGET_ESP32S3) && ( defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32C3))
47+
#error please fix your build environment. only one CONFIG_IDF_TARGET may be defined
48+
#endif
49+
#if defined(CONFIG_IDF_TARGET_ESP32C3) && ( defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32S2))
50+
#error please fix your build environment. only one CONFIG_IDF_TARGET may be defined
51+
#endif
52+
53+
#else // 8266
54+
#if !defined(ARDUINO_ARCH_ESP8266) && !defined(ARDUINO_ARCH_ESP8265)
55+
#error please fix your build environment. Neither ARDUINO_ARCH_ESP8266 nor ARDUINO_ARCH_ESP32 are defined
56+
#else
57+
#if !defined(ESP8266) && !defined(ESP8265)
58+
#error please fix your build environment. ESP8266 is not defined.
59+
#endif
60+
#endif
61+
#endif
62+
// WLEDMM end
63+
64+
1565
/*
1666
* Main WLED class implementation. Mostly initialization and connection logic
1767
*/

0 commit comments

Comments
 (0)