Skip to content

Commit

Permalink
Merge pull request #5226 from TD-er/build/failing_esp32_builds
Browse files Browse the repository at this point in the history
[Build] Fix pre_custom_xxx.py files to work with pioarduino
  • Loading branch information
TD-er authored Jan 17, 2025
2 parents cf2fbf8 + 9cfbaeb commit 3b579d4
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 37 deletions.
3 changes: 1 addition & 2 deletions platformio_core_defs.ini
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,7 @@ lib_extra_dirs =

; ESP_IDF 5.3.1
[core_esp32_IDF5_3_2__3_1_0_LittleFS]
platform = https://github.com/Jason2866/platform-espressif32.git#44cb91bd1171b854c5055aef91b3819913ff7f02
;platform = https://github.com/Jason2866/platform-espressif32.git
platform = https://github.com/Jason2866/platform-espressif32.git
platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/esp32-arduino-lib-builder/releases/download/3203/framework-arduinoespressif32-all-release_v5.3-ddc10306.zip
build_flags = -DESP32_STAGE
-DESP_IDF_VERSION_MAJOR=5
Expand Down
9 changes: 3 additions & 6 deletions platformio_esp32_solo1.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
; IDF 5.3.1
[esp32_solo1_common_LittleFS]
extends = esp32_base_idf5
platform = https://github.com/Jason2866/platform-espressif32.git#44cb91bd1171b854c5055aef91b3819913ff7f02
;platform = https://github.com/Jason2866/platform-espressif32.git#Arduino/IDF53
board = esp32_solo1_4M
platform = https://github.com/Jason2866/platform-espressif32.git#Arduino/IDF53
platform_packages = framework-arduino-solo1 @ https://github.com/Jason2866/esp32-arduino-lib-builder/releases/download/3204/framework-arduinoespressif32-solo1-release_v5.3-ddc10306.zip
build_flags = ${esp32_base_idf5.build_flags}
-DFEATURE_ARDUINO_OTA=1
-DUSE_LITTLEFS
-DCORE32SOLO1
lib_ignore = ${esp32_base_idf5.lib_ignore}
extra_scripts = ${esp32_base_idf5.extra_scripts}
build_unflags = ${esp32_base_idf5.build_unflags}
-fexceptions
Expand All @@ -17,7 +18,6 @@ board_build.filesystem = littlefs

[env:custom_ESP32solo1_4M316k_LittleFS_ETH]
extends = esp32_solo1_common_LittleFS
board = esp32_solo1_4M
build_flags = ${esp32_solo1_common_LittleFS.build_flags}
-DPLUGIN_BUILD_CUSTOM
-DFEATURE_ETHERNET=1
Expand All @@ -27,7 +27,6 @@ extra_scripts = ${esp32_solo1_common_LittleFS.extra_scripts}

[env:normal_ESP32solo1_4M316k_LittleFS_ETH]
extends = esp32_solo1_common_LittleFS
board = esp32_solo1_4M
build_flags = ${esp32_solo1_common_LittleFS.build_flags}
-DFEATURE_ETHERNET=1
lib_ignore = ${esp32_solo1_common_LittleFS.lib_ignore}
Expand All @@ -36,14 +35,12 @@ lib_ignore = ${esp32_solo1_common_LittleFS.lib_ignore}

[env:energy_ESP32solo1_4M316k_LittleFS_ETH]
extends = esp32_solo1_common_LittleFS
board = esp32_solo1_4M
build_flags = ${esp32_solo1_common_LittleFS.build_flags}
-D PLUGIN_ENERGY_COLLECTION
-DFEATURE_ETHERNET=1

[env:climate_ESP32solo1_4M316k_LittleFS_ETH]
extends = esp32_solo1_common_LittleFS
board = esp32_solo1_4M
build_flags = ${esp32_solo1_common_LittleFS.build_flags}
-D PLUGIN_CLIMATE_COLLECTION
-DFEATURE_ETHERNET=1
1 change: 1 addition & 0 deletions platformio_esp32c3_envs.ini
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ extra_scripts = ${esp32_base_idf5.extra_scripts}
build_unflags = ${esp32_base_idf5.build_unflags}
-fexceptions
board_build.filesystem = littlefs
lib_ignore = ${esp32_base_idf5.lib_ignore}


[env:custom_ESP32c3_4M316k_CDC]
Expand Down
1 change: 1 addition & 0 deletions platformio_esp32s2_envs.ini
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ extra_scripts = ${esp32_base_idf5.extra_scripts}
build_unflags = ${esp32_base_idf5.build_unflags}
-fexceptions
board_build.filesystem = littlefs
lib_ignore = ${esp32_base_idf5.lib_ignore}


[env:custom_ESP32s2_4M316k_CDC]
Expand Down
37 changes: 15 additions & 22 deletions tools/pio/generate-compiletime-defines.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,36 +90,30 @@ def deduct_flags_from_pioenv():
print("\u001b[33m File System: \u001b[0m {}".format(fs_str))


def gen_compiletime_defines(node):
def gen_compiletime_defines():
"""
`node.name` - a name of File System Node
`node.get_path()` - a relative path
`node.get_abspath()` - an absolute path
"""

# do not modify node if file name does not contain "CompiletimeDefines.cpp"
if "CompiletimeDefines.cpp" not in node.name:
return node

# now, we can override ANY SCons variables (CPPDEFINES, CCFLAGS, etc.,) for the specific file
# pass SCons variables as extra keyword arguments to `env.Object()` function
# p.s: run `pio run -t envdump` to see a list with SCons variables

defines = env["CPPDEFINES"]
defines.append(("SET_BUILD_BINARY_FILENAME", '\\"%s\\"' % create_binary_filename()))
defines.append(("SET_BOARD_NAME", '\\"%s\\"' % get_board_name()))
defines.append(("SET_BUILD_PLATFORM", '\\"%s\\"' % platform.platform()))
defines.append(("SET_BUILD_GIT_HEAD", '\\"%s\\"' % get_git_description()))
defines.append(("SET_BUILD_CDN_URL", '\\"%s\\"' % get_cdn_url_prefix()))
defines.append(("SET_BUILD_VERSION", compute_version_date()))
defines.append(("SET_BUILD_UNIXTIME", create_build_unixtime()))
defines.append(("SET_BUILD_TIME_RFC1123", '\\"%s\\"' % create_RFC1123_build_date()))

return env.Object(
node,
CPPDEFINES=defines,
CCFLAGS=env["CCFLAGS"]
)
defines = [
"-DSET_BUILD_BINARY_FILENAME=\\\"{}\\\"".format(create_binary_filename()),
"-DSET_BOARD_NAME=\\\"{}\\\"".format(get_board_name()),
"-DSET_BUILD_PLATFORM=\\\"{}\\\"".format(platform.platform()),
"-DSET_BUILD_GIT_HEAD=\\\"{}\\\"".format(get_git_description()),
"-DSET_BUILD_CDN_URL=\\\"{}\\\"".format(get_cdn_url_prefix()),
"-DSET_BUILD_VERSION={}".format(compute_version_date()),
"-DSET_BUILD_UNIXTIME={}".format(create_build_unixtime()),
"-DSET_BUILD_TIME_RFC1123=\\\"{}\\\"".format(create_RFC1123_build_date())
]

env.Append(CXXFLAGS=defines)


print("\u001b[32m Compile time defines \u001b[0m")
deduct_flags_from_pioenv()
Expand All @@ -143,5 +137,4 @@ def gen_compiletime_defines(node):
if "esp32" in env.BoardConfig().get("build.core"):
print("\u001b[33m memory_type: \u001b[0m {}".format(env.BoardConfig().get("build.arduino.memory_type", "-")))


env.AddBuildMiddleware(gen_compiletime_defines)
gen_compiletime_defines()
2 changes: 1 addition & 1 deletion tools/pio/pre_custom_esp32.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@

my_flags = env.ParseFlags(env['BUILD_FLAGS'])
my_defines = my_flags.get("CPPDEFINES")
env.Append(BUILD_FLAGS=custom_defines)
env.Append(CXXFLAGS=custom_defines)
#defines = {k: v for (k, v) in my_defines}

print("\u001b[32m Custom PIO configuration check \u001b[0m")
Expand Down
2 changes: 1 addition & 1 deletion tools/pio/pre_custom_esp32_IR.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@

my_flags = env.ParseFlags(env['BUILD_FLAGS'])
my_defines = my_flags.get("CPPDEFINES")
env.Append(BUILD_FLAGS=custom_defines)
env.Append(CXXFLAGS=custom_defines)
#defines = {k: v for (k, v) in my_defines}

print("\u001b[32m Custom PIO configuration check \u001b[0m")
Expand Down
2 changes: 1 addition & 1 deletion tools/pio/pre_custom_esp32c2.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@

my_flags = env.ParseFlags(env['BUILD_FLAGS'])
my_defines = my_flags.get("CPPDEFINES")
env.Append(BUILD_FLAGS=custom_defines)
env.Append(CXXFLAGS=custom_defines)
#defines = {k: v for (k, v) in my_defines}

print("\u001b[32m Custom PIO configuration check \u001b[0m")
Expand Down
2 changes: 1 addition & 1 deletion tools/pio/pre_custom_esp32c6.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@

my_flags = env.ParseFlags(env['BUILD_FLAGS'])
my_defines = my_flags.get("CPPDEFINES")
env.Append(BUILD_FLAGS=custom_defines)
env.Append(CXXFLAGS=custom_defines)
#defines = {k: v for (k, v) in my_defines}

print("\u001b[32m Custom PIO configuration check \u001b[0m")
Expand Down
2 changes: 1 addition & 1 deletion tools/pio/pre_custom_esp82xx.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@

my_flags = env.ParseFlags(env['BUILD_FLAGS'])
my_defines = my_flags.get("CPPDEFINES")
env.Append(BUILD_FLAGS=custom_defines)
env.Append(CXXFLAGS=custom_defines)
#defines = {k: v for (k, v) in my_defines}

print("\u001b[32m Custom PIO configuration check \u001b[0m")
Expand Down
2 changes: 1 addition & 1 deletion tools/pio/pre_custom_esp82xx_IR.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@

my_flags = env.ParseFlags(env['BUILD_FLAGS'])
my_defines = my_flags.get("CPPDEFINES")
env.Append(BUILD_FLAGS=custom_defines)
env.Append(CXXFLAGS=custom_defines)
#defines = {k: v for (k, v) in my_defines}

print("\u001b[32m Custom PIO configuration check \u001b[0m")
Expand Down
2 changes: 1 addition & 1 deletion tools/pio/pre_safeboot_esp32c2.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

my_flags = env.ParseFlags(env['BUILD_FLAGS'])
my_defines = my_flags.get("CPPDEFINES")
env.Append(BUILD_FLAGS=custom_defines)
env.Append(CXXFLAGS=custom_defines)
#defines = {k: v for (k, v) in my_defines}

print("\u001b[32m Custom PIO configuration check \u001b[0m")
Expand Down

0 comments on commit 3b579d4

Please sign in to comment.