mirror of
https://github.com/esphome/esphome.git
synced 2026-08-22 22:26:21 +00:00
Merge branch 'esp8266-native-toolchain-plumbing' into esp8266-native-build-infra
This commit is contained in:
@@ -593,6 +593,13 @@ 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.
|
||||
cg.add_platformio_option(key, val)
|
||||
elif key != "upload_speed":
|
||||
# upload_speed needs no handling: it is read from the raw
|
||||
# config at upload time (upload_using_esptool)
|
||||
|
||||
@@ -1397,8 +1397,8 @@ def test_esphome_build_internals_are_yaml_only() -> None:
|
||||
async def test_add_platformio_options_native_arduino(
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
"""The native ESP8266 Arduino toolchain warns about ignored options the
|
||||
same way the native IDF toolchain does."""
|
||||
"""The native ESP8266 Arduino toolchain honors board_build.f_cpu (a
|
||||
real-world overclock knob) and warns about the rest like native IDF."""
|
||||
CORE.toolchain = Toolchain.ARDUINO
|
||||
CORE.data[KEY_CORE] = {
|
||||
KEY_TARGET_PLATFORM: "esp8266",
|
||||
@@ -1408,11 +1408,16 @@ async def test_add_platformio_options_native_arduino(
|
||||
await config._add_platformio_options(
|
||||
{
|
||||
"board_build.f_cpu": "160000000L",
|
||||
"board_build.filesystem": "littlefs",
|
||||
"upload_speed": "115200",
|
||||
}
|
||||
)
|
||||
|
||||
assert "esphome->platformio_options->board_build.f_cpu is ignored" in caplog.text
|
||||
assert CORE.platformio_options["board_build.f_cpu"] == "160000000L"
|
||||
assert "board_build.f_cpu is ignored" not in caplog.text
|
||||
assert (
|
||||
"esphome->platformio_options->board_build.filesystem is ignored" in caplog.text
|
||||
)
|
||||
assert "'arduino' toolchain" in caplog.text
|
||||
assert "upload_speed" not in caplog.text
|
||||
|
||||
|
||||
Reference in New Issue
Block a user