Refactor `set_partition_table.py` (#18072)

This commit is contained in:
Jason2866 2023-02-28 12:15:19 +01:00 committed by GitHub
parent 5cdd9791f4
commit deeed56610
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 44 additions and 60 deletions

View File

@ -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")))

View File

@ -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")))

View File

@ -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")))

View File

@ -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

View File

@ -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}

View File

@ -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"'