Skip to content

Commit 0b02133

Browse files
committed
This may actually work
* Compilation succeeds for all seven expected products. * Compilation fails as expected for two products not yet supported (fib64 micro and nano) * Intellisense updates correctly when changing between products. To see in action, open map.cpp, then: CTRL-SHIFT-P, PlatformIO: switch project environment Select the new environment, and then wait for the intellisense index to be rebuilt. * Have NOT tested the binaries yet, but looks promising.
1 parent d96ca3a commit 0b02133

File tree

5 files changed

+285
-15
lines changed

5 files changed

+285
-15
lines changed

.gitignore

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ build/
44
buildcache/
55
arduino.json
66
c_cpp_properties.json
7-
.vscode
87

9-
/platformio-override.ini
10-
/release/
8+
/.vscode/
9+
/release
10+
/platformio_override.ini
11+
/.pio/
12+
/esp8266-fastled-webserver/esp8266-fastled-webserver.ino.cpp

esp8266-fastled-webserver/config.h

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,21 @@
2424
// When compiling from Arduino, you can edit this file.
2525
// When compiling from PlatformIO, this is a reference for compiler flags.
2626

27-
#define PRODUCT_DEFAULT
28-
// #define PRODUCT_FIBONACCI512
29-
// #define PRODUCT_FIBONACCI256
30-
// #define PRODUCT_FIBONACCI128
31-
// #define PRODUCT_FIBONACCI64_FULL // 86mm, WS2812B-5050, ~60mA/pixel
32-
// #define PRODUCT_FIBONACCI64_MINI // 64mm, WS2812B-3535, ~60mA/pixel
33-
// #define PRODUCT_FIBONACCI64_MICRO // 40mm, WS2812C-2020, ~5mA/pixel
34-
// #define PRODUCT_FIBONACCI64_NANO // 33mm, SK6805-EC15, ~5mA/pixel
35-
// #define PRODUCT_FIBONACCI32
36-
// #define PRODUCT_KRAKEN64
37-
// #define PRODUCT_ESP8266_THING // aka parallel (6-output)
38-
// #define PRODUCT_1628_RINGS
27+
#if !defined(BUILDING_USING_PLATFORMIO)
28+
#define PRODUCT_DEFAULT
29+
// #define PRODUCT_FIBONACCI512
30+
// #define PRODUCT_FIBONACCI256
31+
// #define PRODUCT_FIBONACCI128
32+
// #define PRODUCT_FIBONACCI64_FULL // 86mm, WS2812B-5050, ~60mA/pixel
33+
// #define PRODUCT_FIBONACCI64_MINI // 64mm, WS2812B-3535, ~60mA/pixel
34+
// #define PRODUCT_FIBONACCI64_MICRO // 40mm, WS2812C-2020, ~5mA/pixel
35+
// #define PRODUCT_FIBONACCI64_NANO // 33mm, SK6805-EC15, ~5mA/pixel
36+
// #define PRODUCT_FIBONACCI32
37+
// #define PRODUCT_KRAKEN64
38+
// #define PRODUCT_ESP8266_THING // aka parallel (6-output)
39+
// #define PRODUCT_1628_RINGS
40+
#endif /// !defined(BUILDING_USING_PLATFORMIO)
41+
3942

4043
// ////////////////////////////////////////////////////////////////////////////////////////////////////
4144
// Additional configuration options ... defaults shown

pio-scripts/obj-dump.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Little convenience script to get an object dump
2+
3+
Import('env')
4+
5+
def obj_dump_after_elf(source, target, env):
6+
print("Create firmware.asm")
7+
env.Execute("xtensa-lx106-elf-objdump "+ "-D " + str(target[0]) + " > "+ "${PROGNAME}.asm")
8+
9+
env.AddPostAction("$BUILD_DIR/${PROGNAME}.elf", [obj_dump_after_elf])

pio-scripts/strip-floats.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Import('env')
2+
3+
#
4+
# Dump build environment (for debug)
5+
#print env.Dump()
6+
#
7+
8+
flags = " ".join(env['LINKFLAGS'])
9+
flags = flags.replace("-u _printf_float", "")
10+
flags = flags.replace("-u _scanf_float", "")
11+
newflags = flags.split()
12+
13+
env.Replace(
14+
LINKFLAGS=newflags
15+
)

platformio.ini

Lines changed: 241 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,241 @@
1+
; NOTE:
2+
; If "file system upload" command is missing PlatformIO UI in VSCode:
3+
; run `pio run -t uploadfs` in the terminal.
4+
; Typically, this is caused by having an invalid platformio.ini
5+
; (or platform_override.ini), and this will show a more coherent
6+
; error message in the terminal output.
7+
8+
; PlatformIO Project Configuration File
9+
;
10+
; Build options: build flags, source filter
11+
; Upload options: custom upload port, speed and extra flags
12+
; Library options: dependencies, extra library storages
13+
; Advanced options: extra scripting
14+
;
15+
; Please visit documentation for the other options and examples
16+
; https://docs.platformio.org/page/projectconf.html
17+
18+
[platformio]
19+
extra_configs = platformio_override.ini ; so users can easily override settings
20+
default_envs = fastled_webserver, fib512_d1_mini, fib256_d1_mini, fib128_d1_mini, fib64_full_d1_mini, fib64_mini_d1_mini, fib32_d1_mini
21+
; default_envs = fastled_webserver
22+
; default_envs = fib512_d1_mini
23+
; default_envs = fib256_d1_mini
24+
; default_envs = fib128_d1_mini
25+
; default_envs = fib64_full_d1_mini
26+
; default_envs = fib64_mini_d1_mini
27+
; default_envs = fib64_micro_d1_mini
28+
; default_envs = fib64_nano_d1_mini
29+
; default_envs = fib32_d1_mini
30+
src_dir = ./esp8266-fastled-webserver/
31+
data_dir = ./esp8266-fastled-webserver/data
32+
build_cache_dir = ~/.buildcache
33+
; Uncomment the below to switch from deprecated SPIFFS to LittleFS
34+
; board_build.filesystem = littlefs
35+
36+
[common]
37+
ldscript_1m128k = eagle.flash.1m128.ld
38+
ldscript_2m512k = eagle.flash.2m512.ld
39+
ldscript_2m1m = eagle.flash.2m1m.ld
40+
ldscript_4m1m = eagle.flash.4m1m.ld
41+
debug_flags =
42+
-D DEBUG=1
43+
-D DEBUG_ESP_PORT=Serial
44+
build_flags =
45+
-Wall
46+
-Wextra
47+
-fno-exceptions
48+
-D SECURE_CLIENT=SECURE_CLIENT_BEARSSL
49+
-D NDEBUG
50+
-D BUILDING_USING_PLATFORMIO
51+
52+
build_flags_esp8266 = ${common.build_flags} ${esp8266.build_flags}
53+
build_flags_esp32 = ${common.build_flags} ${esp32.build_flags}
54+
build_unflags =
55+
56+
; YES, the mismatch in version numbers is confusing.
57+
; This gives the *LATEST* espressif release for a given arduino core version.
58+
arduino_core_2_6_3 = [email protected]
59+
arduino_core_2_7_0 = [email protected]
60+
arduino_core_2_7_1 = [email protected]
61+
arduino_core_2_7_2 = [email protected]
62+
arduino_core_2_7_3 = [email protected]
63+
arduino_core_2_7_4 = [email protected]
64+
; WARNING -- Moving to v3.0.0 or higher risks MAJOR breaking changes.
65+
; See https://github.com/esp8266/Arduino/releases/tag/3.0.0
66+
; In particular, new() no longer will return nullptr ...
67+
; See https://github.com/esp8266/Arduino/pull/7536#issuecomment-683431735
68+
arduino_core_3_0_0 = [email protected]
69+
arduino_core_3_0_1 = [email protected]
70+
arduino_core_3_0_2 = [email protected]
71+
arduino_core_develop = https://github.com/platformio/platform-espressif8266#develop
72+
arduino_core_git = https://github.com/platformio/platform-espressif8266#feature/stage
73+
74+
; Define the version to use based on the Arduino Core version...
75+
platform_fibonacci_default = ${common.arduino_core_2_7_4}
76+
platform_packages = tasmota/framework-arduinoespressif8266 @ 3.20704.7
77+
platformio/toolchain-xtensa @ ~2.40802.200502
78+
platformio/tool-esptool @ ~1.413.0
79+
platformio/tool-esptoolpy @ ~1.30000.0
80+
81+
[scripts_defaults]
82+
extra_scripts =
83+
post:pio-scripts/strip-floats.py
84+
85+
[env]
86+
framework = arduino
87+
board_build.flash_mode = dout
88+
monitor_speed = 115200
89+
upload_speed = 921600
90+
lib_compat_mode = strict
91+
lib_deps =
92+
fastled/FastLED @ 3.4.0
93+
https://github.com/arduino-libraries/NTPClient.git @ 3.2.0
94+
https://github.com/tzapu/WiFiManager.git @ ^2.0.4-beta
95+
96+
extra_scripts = ${scripts_defaults.extra_scripts}
97+
98+
[esp8266]
99+
build_flags =
100+
-D ESP8266
101+
-D FP_IN_IROM
102+
-D PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190703
103+
-D PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
104+
-D VTABLES_IN_FLASH
105+
-D MIMETYPE_MINIMAL
106+
lib_deps =
107+
${env.lib_deps}
108+
109+
[esp32]
110+
build_flags =
111+
-g
112+
-D ARDUINO_ARCH_ESP32
113+
-D CONFIG_LITTLEFS_FOR_IDF_3_2
114+
lib_deps =
115+
${env.lib_deps}
116+
117+
[env:fastled_webserver]
118+
board = d1_mini
119+
platform = ${common.platform_fibonacci_default}
120+
platform_packages = ${common.platform_packages}
121+
board_build.ldscript = ${common.ldscript_4m1m}
122+
build_unflags = ${common.build_unflags}
123+
build_flags =
124+
${common.build_flags_esp8266}
125+
-D PRODUCT_DEFAULT
126+
127+
[env:fib512_d1_mini]
128+
board = d1_mini
129+
platform = ${common.platform_fibonacci_default}
130+
platform_packages = ${common.platform_packages}
131+
board_build.ldscript = ${common.ldscript_4m1m}
132+
build_unflags = ${common.build_unflags}
133+
build_flags =
134+
${common.build_flags_esp8266}
135+
-D PRODUCT_FIBONACCI512
136+
137+
[env:fib256_d1_mini]
138+
board = d1_mini
139+
platform = ${common.platform_fibonacci_default}
140+
platform_packages = ${common.platform_packages}
141+
board_build.ldscript = ${common.ldscript_4m1m}
142+
build_unflags = ${common.build_unflags}
143+
build_flags =
144+
${common.build_flags_esp8266}
145+
-D PRODUCT_FIBONACCI256
146+
147+
[env:fib128_d1_mini]
148+
board = d1_mini
149+
platform = ${common.platform_fibonacci_default}
150+
platform_packages = ${common.platform_packages}
151+
board_build.ldscript = ${common.ldscript_4m1m}
152+
build_unflags = ${common.build_unflags}
153+
build_flags =
154+
${common.build_flags_esp8266}
155+
-D PRODUCT_FIBONACCI128
156+
157+
[env:fib64_full_d1_mini]
158+
board = d1_mini
159+
platform = ${common.platform_fibonacci_default}
160+
platform_packages = ${common.platform_packages}
161+
board_build.ldscript = ${common.ldscript_4m1m}
162+
build_unflags = ${common.build_unflags}
163+
build_flags =
164+
${common.build_flags_esp8266}
165+
-D PRODUCT_FIBONACCI64_FULL
166+
167+
168+
[env:fib64_mini_d1_mini]
169+
board = d1_mini
170+
platform = ${common.platform_fibonacci_default}
171+
platform_packages = ${common.platform_packages}
172+
board_build.ldscript = ${common.ldscript_4m1m}
173+
build_unflags = ${common.build_unflags}
174+
build_flags =
175+
${common.build_flags_esp8266}
176+
-D PRODUCT_FIBONACCI64_MINI
177+
178+
179+
; NOT YET SUPPORTED.
180+
; Default board is QT Py, a ATSAMD21E18
181+
; - 32-bit Cortex M0+ @ 48 MHz 32 bit
182+
; w/256KB Flash and 32 KB RAM
183+
; Support *is* possible, but would require
184+
; factoring out all the WiFi functionality (at least).
185+
; However, may be able to enable building
186+
; using ESP8266/ESP32 more rapidly....
187+
[env:fib64_micro_d1_mini]
188+
board = d1_mini
189+
platform = ${common.platform_fibonacci_default}
190+
platform_packages = ${common.platform_packages}
191+
board_build.ldscript = ${common.ldscript_4m1m}
192+
build_unflags = ${common.build_unflags}
193+
build_flags =
194+
${common.build_flags_esp8266}
195+
-D PRODUCT_FIBONACCI64_MICRO
196+
197+
; NOT YET SUPPORTED.
198+
; Default board is QT Py, a ATSAMD21E18
199+
; - 32-bit Cortex M0+ @ 48 MHz 32 bit
200+
; w/256KB Flash and 32 KB RAM
201+
; Support *is* possible, but would require
202+
; factoring out all the WiFi functionality (at least).
203+
; However, may be able to enable building
204+
; using ESP8266/ESP32 more rapidly....
205+
[env:fib64_nano_d1_mini]
206+
board = d1_mini
207+
platform = ${common.platform_fibonacci_default}
208+
platform_packages = ${common.platform_packages}
209+
board_build.ldscript = ${common.ldscript_4m1m}
210+
build_unflags = ${common.build_unflags}
211+
build_flags =
212+
${common.build_flags_esp8266}
213+
-D PRODUCT_FIBONACCI64_NANO
214+
215+
[env:fib32_d1_mini]
216+
board = d1_mini
217+
platform = ${common.platform_fibonacci_default}
218+
platform_packages = ${common.platform_packages}
219+
board_build.ldscript = ${common.ldscript_4m1m}
220+
build_unflags = ${common.build_unflags}
221+
build_flags =
222+
${common.build_flags_esp8266}
223+
-D PRODUCT_FIBONACCI32
224+
225+
; [env:fib256_d1_mini32]
226+
; board = esp32dev
227+
; platform = [email protected]
228+
; build_unflags = ${common.build_unflags}
229+
; build_flags = ${common.build_flags_esp32}
230+
231+
; [env:travis_esp8266]
232+
; extends = env:fib256_d1_mini
233+
; build_type = debug
234+
; build_unflags = ${common.build_unflags}
235+
; build_flags = ${common.build_flags_esp8266} ${common.debug_flags} ${common.build_flags_all_features}
236+
237+
; [env:travis_esp32]
238+
; extends = env:fib256_d1_mini32
239+
; build_type = debug
240+
; build_unflags = ${common.build_unflags}
241+
; build_flags = ${common.build_flags_esp32} ${common.debug_flags} ${common.build_flags_all_features}

0 commit comments

Comments
 (0)