mirror of
https://github.com/esphome/esphome.git
synced 2025-10-27 05:03:48 +00:00
wip
This commit is contained in:
@@ -105,30 +105,31 @@ if testing_mode:
|
|||||||
# Create custom linker script immediately (before linker command is built)
|
# Create custom linker script immediately (before linker command is built)
|
||||||
build_dir = env.subst("$BUILD_DIR")
|
build_dir = env.subst("$BUILD_DIR")
|
||||||
ldscript = env.GetProjectOption("board_build.ldscript", "")
|
ldscript = env.GetProjectOption("board_build.ldscript", "")
|
||||||
|
assert ldscript, "No linker script configured in board_build.ldscript"
|
||||||
|
|
||||||
if ldscript:
|
framework_dir = env.PioPlatform().get_package_dir("framework-arduinoespressif8266")
|
||||||
framework_dir = env.PioPlatform().get_package_dir("framework-arduinoespressif8266")
|
assert framework_dir is not None, "Could not find framework-arduinoespressif8266 package"
|
||||||
if framework_dir:
|
|
||||||
sdk_ld = os.path.join(framework_dir, "tools", "sdk", "ld", ldscript)
|
|
||||||
custom_ld = os.path.join(build_dir, f"testing_{ldscript}")
|
|
||||||
|
|
||||||
if os.path.exists(sdk_ld) and not os.path.exists(custom_ld):
|
sdk_ld = os.path.join(framework_dir, "tools", "sdk", "ld", ldscript)
|
||||||
# Read and patch the SDK linker script
|
custom_ld = os.path.join(build_dir, f"testing_{ldscript}")
|
||||||
with open(sdk_ld, "r") as f:
|
|
||||||
content = f.read()
|
|
||||||
|
|
||||||
patched_content = apply_memory_patches(content)
|
if os.path.exists(sdk_ld) and not os.path.exists(custom_ld):
|
||||||
|
# Read and patch the SDK linker script
|
||||||
|
with open(sdk_ld, "r") as f:
|
||||||
|
content = f.read()
|
||||||
|
|
||||||
# Write custom linker script
|
patched_content = apply_memory_patches(content)
|
||||||
with open(custom_ld, "w") as f:
|
|
||||||
f.write(patched_content)
|
|
||||||
|
|
||||||
print(f"ESPHome: Created custom linker script: {custom_ld}")
|
# Write custom linker script
|
||||||
|
with open(custom_ld, "w") as f:
|
||||||
|
f.write(patched_content)
|
||||||
|
|
||||||
# Tell the linker to use our custom script
|
print(f"ESPHome: Created custom linker script: {custom_ld}")
|
||||||
if os.path.exists(custom_ld):
|
|
||||||
env.Replace(LDSCRIPT_PATH=custom_ld)
|
# Tell the linker to use our custom script
|
||||||
print(f"ESPHome: Using custom linker script with patched memory limits")
|
assert os.path.exists(custom_ld), f"Custom linker script not found: {custom_ld}"
|
||||||
|
env.Replace(LDSCRIPT_PATH=custom_ld)
|
||||||
|
print(f"ESPHome: Using custom linker script with patched memory limits")
|
||||||
|
|
||||||
# Hook to patch local.eagle.app.v6.common.ld after it's created
|
# Hook to patch local.eagle.app.v6.common.ld after it's created
|
||||||
env.AddPreAction("$BUILD_DIR/${PROGNAME}.elf", patch_local_linker_script)
|
env.AddPreAction("$BUILD_DIR/${PROGNAME}.elf", patch_local_linker_script)
|
||||||
|
|||||||
Reference in New Issue
Block a user