Skip to content

Commit ef80abd

Browse files
committed
8266 compatibility builds for older chips (another attempt t o solve #3690 and #3685)
some users have reported that releases after 0.14.0 are not working reliably. So we add a few "compat" for 8266 that try to reproduce the buildenv of 0.14.0 as much as possible. * platform and platform_packages from 0.14.0 * not using PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48 * due to smaller IRAM, we had to move some functions back from IRAM to normal flash (may cause slowdown)
1 parent 3615ab5 commit ef80abd

File tree

4 files changed

+55
-4
lines changed

4 files changed

+55
-4
lines changed

platformio.ini

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
# CI binaries
1313
; default_envs = nodemcuv2, esp8266_2m, esp01_1m_full, esp32dev, esp32_eth # ESP32 variant builds are temporarily excluded from CI due to toolchain issues on the GitHub Actions Linux environment
14-
default_envs = nodemcuv2, esp8266_2m, esp01_1m_full, nodemcuv2_160, esp8266_2m_160, esp01_1m_full_160, esp32dev, esp32_eth, esp32dev_audioreactive, lolin_s2_mini, esp32c3dev, esp32s3dev_8MB, esp32s3dev_8MB_PSRAM_opi
14+
default_envs = nodemcuv2, esp8266_2m, esp01_1m_full, nodemcuv2_compat, esp8266_2m_compat, esp01_1m_full_compat, nodemcuv2_160, esp8266_2m_160, esp01_1m_full_160, esp32dev, esp32_eth, esp32dev_audioreactive, lolin_s2_mini, esp32c3dev, esp32s3dev_8MB, esp32s3dev_8MB_PSRAM_opi
1515

1616
# Release binaries
1717
; default_envs = nodemcuv2, esp8266_2m, esp01_1m_full, esp32dev, esp32_eth, lolin_s2_mini, esp32c3dev, esp32s3dev_8MB
@@ -226,6 +226,27 @@ lib_deps =
226226
ESPAsyncUDP
227227
${env.lib_deps}
228228

229+
;; compatibilty flags - same as 0.14.0 which seems to work better on some 8266 boards. Not using PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48
230+
build_flags_compat =
231+
-DESP8266
232+
-DFP_IN_IROM
233+
;;-Wno-deprecated-declarations
234+
-Wno-misleading-indentation
235+
;;-Wno-attributes ;; silence warnings about unknown attribute 'maybe_unused' in NeoPixelBus
236+
-DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190703
237+
-DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH
238+
-DVTABLES_IN_FLASH
239+
-DMIMETYPE_MINIMAL
240+
-DWLED_SAVE_IRAM ;; needed to prevent linker error
241+
242+
;; this platform version was used for WLED 0.14.0
243+
platform_compat = [email protected]
244+
platform_packages_compat =
245+
platformio/toolchain-xtensa @ ~2.100300.220621 #2.40802.200502
246+
platformio/tool-esptool #@ ~1.413.0
247+
platformio/tool-esptoolpy #@ ~1.30000.0
248+
249+
229250
[esp32]
230251
#platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.2.3/platform-espressif32-2.0.2.3.zip
231252
@@ -336,6 +357,13 @@ build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP8266 #-DWLED
336357
lib_deps = ${esp8266.lib_deps}
337358
monitor_filters = esp8266_exception_decoder
338359

360+
[env:nodemcuv2_compat]
361+
extends = env:nodemcuv2
362+
;; using platform version and build options from WLED 0.14.0
363+
platform = ${esp8266.platform_compat}
364+
platform_packages = ${esp8266.platform_packages_compat}
365+
build_flags = ${common.build_flags} ${esp8266.build_flags_compat} -D WLED_RELEASE_NAME=ESP8266_compat #-DWLED_DISABLE_2D
366+
339367
[env:nodemcuv2_160]
340368
extends = env:nodemcuv2
341369
board_build.f_cpu = 160000000L
@@ -350,6 +378,13 @@ build_unflags = ${common.build_unflags}
350378
build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP02
351379
lib_deps = ${esp8266.lib_deps}
352380

381+
[env:esp8266_2m_compat]
382+
extends = env:esp8266_2m
383+
;; using platform version and build options from WLED 0.14.0
384+
platform = ${esp8266.platform_compat}
385+
platform_packages = ${esp8266.platform_packages_compat}
386+
build_flags = ${common.build_flags} ${esp8266.build_flags_compat} -D WLED_RELEASE_NAME=ESP02_compat #-DWLED_DISABLE_2D
387+
353388
[env:esp8266_2m_160]
354389
extends = env:esp8266_2m
355390
board_build.f_cpu = 160000000L
@@ -365,6 +400,13 @@ build_flags = ${common.build_flags_esp8266} -D WLED_RELEASE_NAME=ESP01 -D WLED_D
365400
; -D WLED_USE_UNREAL_MATH ;; may cause wrong sunset/sunrise times, but saves 7064 bytes FLASH and 975 bytes RAM
366401
lib_deps = ${esp8266.lib_deps}
367402

403+
[env:esp01_1m_full_compat]
404+
extends = env:esp01_1m_full
405+
;; using platform version and build options from WLED 0.14.0
406+
platform = ${esp8266.platform_compat}
407+
platform_packages = ${esp8266.platform_packages_compat}
408+
build_flags = ${common.build_flags} ${esp8266.build_flags_compat} -D WLED_RELEASE_NAME=ESP01_compat -D WLED_DISABLE_OTA #-DWLED_DISABLE_2D
409+
368410
[env:esp01_1m_full_160]
369411
extends = env:esp01_1m_full
370412
board_build.f_cpu = 160000000L

wled00/FX_2Dfcn.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,14 @@ void WS2812FX::setUpMatrix() {
163163
#ifndef WLED_DISABLE_2D
164164

165165
// XY(x,y) - gets pixel index within current segment (often used to reference leds[] array element)
166-
uint16_t IRAM_ATTR Segment::XY(uint16_t x, uint16_t y)
166+
uint16_t IRAM_ATTR_YN Segment::XY(uint16_t x, uint16_t y)
167167
{
168168
uint16_t width = virtualWidth(); // segment width in logical pixels (can be 0 if segment is inactive)
169169
uint16_t height = virtualHeight(); // segment height in logical pixels (is always >= 1)
170170
return isActive() ? (x%width) + (y%height) * width : 0;
171171
}
172172

173-
void IRAM_ATTR Segment::setPixelColorXY(int x, int y, uint32_t col)
173+
void IRAM_ATTR_YN Segment::setPixelColorXY(int x, int y, uint32_t col)
174174
{
175175
if (!isActive()) return; // not active
176176
if (x >= virtualWidth() || y >= virtualHeight() || x<0 || y<0) return; // if pixel would fall out of virtual segment just exit

wled00/FX_fcn.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ Segment& Segment::operator= (Segment &&orig) noexcept {
145145
}
146146

147147
bool Segment::allocateData(size_t len) {
148+
if (len == 0) return false; // nothing to do
148149
if (data && _dataLen >= len) { // already allocated enough (reduce fragmentation)
149150
if (call == 0) memset(data, 0, len); // erase buffer if called during effect initialisation
150151
return true;
@@ -659,7 +660,7 @@ uint16_t Segment::virtualLength() const {
659660
return vLength;
660661
}
661662

662-
void IRAM_ATTR Segment::setPixelColor(int i, uint32_t col)
663+
void IRAM_ATTR_YN Segment::setPixelColor(int i, uint32_t col)
663664
{
664665
if (!isActive()) return; // not active
665666
#ifndef WLED_DISABLE_2D

wled00/const.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,4 +540,12 @@
540540
#define HW_PIN_MISOSPI MISO
541541
#endif
542542

543+
// IRAM_ATTR for 8266 with 32Kb IRAM causes error: section `.text1' will not fit in region `iram1_0_seg'
544+
// this hack removes the IRAM flag for some 1D/2D functions - somewhat slower, but it solves problems with some older 8266 chips
545+
#ifdef WLED_SAVE_IRAM
546+
#define IRAM_ATTR_YN
547+
#else
548+
#define IRAM_ATTR_YN IRAM_ATTR
549+
#endif
550+
543551
#endif

0 commit comments

Comments
 (0)