diff --git a/pio-tools/set_partition_table.py b/pio-tools/set_partition_table.py new file mode 100644 index 000000000..7287c73ee --- /dev/null +++ b/pio-tools/set_partition_table.py @@ -0,0 +1,40 @@ +# +# The scipt sets the missing "LDSCRIPT_PATH" when using the command `pio run -t nobuild` +# Adopted from https://github.com/platformio/platform-espressif32/issues/861#issuecomment-1241871437 +# Possible now to upload the firmware or the filesystem with (when builded already!): +# +# `pio run -t nobuild -t upload` and `pio run -t nobuild -t uploadfs` +# + +Import("env") + +import os +from SCons.Script import COMMAND_LINE_TARGETS + +board_config = env.BoardConfig() + +if "nobuild" in COMMAND_LINE_TARGETS: + if env["PIOPLATFORM"] != "espressif32": + framework_dir = env.PioPlatform().get_package_dir("framework-arduinoespressif8266") + assert os.path.isdir(framework_dir) + env.Replace( + LDSCRIPT_PATH=os.path.join( + framework_dir, + "tools", + "sdk", + "ld", + board_config.get("build.arduino.ldscript"), + ) + ) +# print("Set LDSCRIPT_PATH to: ", os.path.join(framework_dir,"tools","sdk","ld",board_config.get("build.arduino.ldscript"))) + +# +# For ESP32 sets the missing "PARTITIONS_TABLE_CSV" when using the command `pio run -t nobuild` +# + else: + env.Replace( + PARTITIONS_TABLE_CSV=os.path.join( + board_config.get("build.partitions"), + ) + ) +# print("Set PARTITIONS_TABLE_CSV to: ", os.path.join(board_config.get("build.partitions"))) diff --git a/pio-tools/set_partition_table_esp32.py b/pio-tools/set_partition_table_esp32.py deleted file mode 100644 index e123d40ec..000000000 --- a/pio-tools/set_partition_table_esp32.py +++ /dev/null @@ -1,22 +0,0 @@ -# -# The scipt sets the missing "PARTITIONS_TABLE_CSV" when using the command `pio run -t nobuild` -# Adopted from https://github.com/platformio/platform-espressif32/issues/861#issuecomment-1241871437 -# Possible now to upload the firmware or the filesystem with (when builded already!): -# -# `pio run -t nobuild -t upload` and `pio run -t nobuild -t uploadfs` -# - -Import("env") - -import os -from SCons.Script import COMMAND_LINE_TARGETS - -board_config = env.BoardConfig() - -if "nobuild" in COMMAND_LINE_TARGETS: - env.Replace( - PARTITIONS_TABLE_CSV=os.path.join( - board_config.get("build.partitions"), - ) - ) -# print("Set PARTITIONS_TABLE_CSV to: ", os.path.join(board_config.get("build.partitions"))) diff --git a/pio-tools/set_partition_table_esp8266.py b/pio-tools/set_partition_table_esp8266.py deleted file mode 100644 index a74c6cec7..000000000 --- a/pio-tools/set_partition_table_esp8266.py +++ /dev/null @@ -1,28 +0,0 @@ -# -# The scipt sets the missing "LDSCRIPT_PATH" when using the command `pio run -t nobuild` -# Adopted from https://github.com/platformio/platform-espressif32/issues/861#issuecomment-1241871437 -# Possible now to upload the firmware or the filesystem with (when builded already!): -# -# `pio run -t nobuild -t upload` and `pio run -t nobuild -t uploadfs` -# - -Import("env") - -import os -from SCons.Script import COMMAND_LINE_TARGETS - -board_config = env.BoardConfig() -framework_dir = env.PioPlatform().get_package_dir("framework-arduinoespressif8266") -assert os.path.isdir(framework_dir) - -if "nobuild" in COMMAND_LINE_TARGETS: - env.Replace( - LDSCRIPT_PATH=os.path.join( - framework_dir, - "tools", - "sdk", - "ld", - board_config.get("build.arduino.ldscript"), - ) - ) -# print("Set LDSCRIPT_PATH to: ", os.path.join(framework_dir,"tools","sdk","ld",board_config.get("build.arduino.ldscript"))) diff --git a/platformio.ini b/platformio.ini index 0805bf840..8810d8ad5 100644 --- a/platformio.ini +++ b/platformio.ini @@ -63,16 +63,14 @@ lib_extra_dirs = ; Uncomment and specify a folder where to place the firmware file(s) (default set to folder build_output) ;bin_dir = /tmp/bin_files/ -[scripts_defaults] +[esp_defaults] extra_scripts = pre:pio-tools/pre_source_dir.py pre:pio-tools/strip-floats.py + pre:pio-tools/set_partition_table.py post:pio-tools/name-firmware.py post:pio-tools/gzip-firmware.py post:pio-tools/override_copy.py post:pio-tools/download_fs.py - -[esp_defaults] -extra_scripts = ${scripts_defaults.extra_scripts} ; *** remove undesired all warnings build_unflags = -Wall ; -mtarget-align @@ -92,8 +90,6 @@ build_flags = -DCORE_DEBUG_LEVEL=0 ; ********************************************************************* [esp82xx_defaults] -extra_scripts = ${esp_defaults.extra_scripts} - pre:pio-tools/set_partition_table_esp8266.py build_flags = ${esp_defaults.build_flags} -DNDEBUG -DFP_IN_IROM diff --git a/platformio_tasmota32.ini b/platformio_tasmota32.ini index c475bd1f1..ce3551e6e 100644 --- a/platformio_tasmota32.ini +++ b/platformio_tasmota32.ini @@ -38,7 +38,6 @@ build_flags = ${esp_defaults.build_flags} -Wl,--wrap=ledcReadFreq ; `uint32_t ledcReadFreq(uint8_t chan)` extra_scripts = pre:pio-tools/add_c_flags.py pre:pio-tools/gen-berry-structures.py - pre:pio-tools/set_partition_table_esp32.py post:pio-tools/post_esp32.py ${esp_defaults.extra_scripts} diff --git a/platformio_tasmota_env.ini b/platformio_tasmota_env.ini index 270046bcb..944c4e7ff 100644 --- a/platformio_tasmota_env.ini +++ b/platformio_tasmota_env.ini @@ -5,10 +5,10 @@ framework = ${common.framework} board = ${common.board} board_build.filesystem = ${common.board_build.filesystem} build_unflags = ${common.build_unflags} -build_flags = ${common.build_flags} +build_flags = ${esp82xx_defaults.build_flags} monitor_speed = ${common.monitor_speed} upload_resetmethod = ${common.upload_resetmethod} -extra_scripts = ${common.extra_scripts} +extra_scripts = ${esp_defaults.extra_scripts} lib_ldf_mode = ${common.lib_ldf_mode} lib_compat_mode = ${common.lib_compat_mode} lib_extra_dirs = ${common.lib_extra_dirs} @@ -32,7 +32,6 @@ lib_ignore = ; Add files to Filesystem for all env (global). Remove no files entry and add add a line with the file to include custom_files_upload = no_files - [env:tasmota] build_flags = ${env.build_flags} -DOTA_URL='"http://ota.tasmota.com/tasmota/release/tasmota.bin.gz"'