mirror of
https://github.com/esphome/esphome.git
synced 2026-10-10 05:23:07 +00:00
[esp8266] Keep switch lookup tables out of RAM (#20398)
This commit is contained in:
@@ -444,6 +444,8 @@ async def to_code(config: ConfigType) -> None:
|
||||
cg.add_build_flag("-DUSE_ARDUINO")
|
||||
cg.add_build_flag("-DUSE_ESP8266_FRAMEWORK_ARDUINO")
|
||||
cg.add_build_flag("-Wno-nonnull-compare")
|
||||
# .rodata is linked into RAM on ESP8266; keep switch lookup tables (CSWTCH) out of it
|
||||
cg.add_build_flag("-fno-tree-switch-conversion")
|
||||
if use_platformio:
|
||||
cg.add_platformio_option("framework", "arduino")
|
||||
cg.add_platformio_option("platform", conf[CONF_PLATFORM_VERSION])
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
esphome:
|
||||
name: test
|
||||
|
||||
esp8266:
|
||||
board: d1_mini
|
||||
@@ -0,0 +1,17 @@
|
||||
"""Tests for ESP8266 build flags."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable
|
||||
from pathlib import Path
|
||||
|
||||
from esphome.core import CORE
|
||||
|
||||
|
||||
def test_esp8266_keeps_switches_out_of_ram(
|
||||
generate_main: Callable[[str | Path], str],
|
||||
component_config_path: Callable[[str], Path],
|
||||
) -> None:
|
||||
generate_main(component_config_path("minimal.yaml"))
|
||||
|
||||
assert "-fno-tree-switch-conversion" in CORE.build_flags
|
||||
Reference in New Issue
Block a user