mirror of
https://github.com/esphome/esphome.git
synced 2026-08-22 22:26:21 +00:00
Route board_build.ldscript through to the native ESP8266 generator too
Published configs override it to reserve a filesystem region (SmartIntercom's eagle.flash.4m2m.ld) or to correct a board's assumed flash size (2 MB ESP8285 plugs pinning eagle.flash.2m.ld); dropping it changes the flash layout under them.
This commit is contained in:
+10
-6
@@ -593,12 +593,16 @@ async def _add_platformio_options(pio_options: dict[str, str | list[str]]) -> No
|
||||
# platformio/library.py); filters top-level libraries and
|
||||
# discovered dependencies
|
||||
cg.add_platformio_option(key, vals)
|
||||
elif key == "board_build.f_cpu" and CORE.using_toolchain_arduino:
|
||||
# A real-world overclock knob (many published ESP8266 configs
|
||||
# pin 160000000L for timing-sensitive integrations); the
|
||||
# esp8266 native generator reads it for -DF_CPU. Other native
|
||||
# toolchains have no equivalent and fall through to the
|
||||
# warning.
|
||||
elif (
|
||||
key in ("board_build.f_cpu", "board_build.ldscript")
|
||||
and CORE.using_toolchain_arduino
|
||||
):
|
||||
# Real-world knobs many published ESP8266 configs rely on:
|
||||
# f_cpu 160000000L for timing-sensitive integrations, and a
|
||||
# custom ldscript to reserve a filesystem region or correct
|
||||
# a board's flash size. The esp8266 native generator reads
|
||||
# both; other native toolchains have no equivalent and fall
|
||||
# through to the warning.
|
||||
cg.add_platformio_option(key, val)
|
||||
elif key != "upload_speed":
|
||||
# upload_speed needs no handling: it is read from the raw
|
||||
|
||||
@@ -1408,13 +1408,16 @@ async def test_add_platformio_options_native_arduino(
|
||||
await config._add_platformio_options(
|
||||
{
|
||||
"board_build.f_cpu": "160000000L",
|
||||
"board_build.ldscript": "eagle.flash.4m2m.ld",
|
||||
"board_build.filesystem": "littlefs",
|
||||
"upload_speed": "115200",
|
||||
}
|
||||
)
|
||||
|
||||
assert CORE.platformio_options["board_build.f_cpu"] == "160000000L"
|
||||
assert CORE.platformio_options["board_build.ldscript"] == "eagle.flash.4m2m.ld"
|
||||
assert "board_build.f_cpu is ignored" not in caplog.text
|
||||
assert "board_build.ldscript is ignored" not in caplog.text
|
||||
assert (
|
||||
"esphome->platformio_options->board_build.filesystem is ignored" in caplog.text
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user