mirror of
https://github.com/esphome/esphome.git
synced 2026-02-28 01:44:20 -07:00
[libretiny] Use -Os optimization for ESPHome source on BK72xx (SDK remains at -O1) (#14322)
This commit is contained in:
@@ -27,6 +27,7 @@ from esphome.storage_json import StorageJSON
|
||||
|
||||
from . import gpio # noqa
|
||||
from .const import (
|
||||
COMPONENT_BK72XX,
|
||||
CONF_GPIO_RECOVER,
|
||||
CONF_LOGLEVEL,
|
||||
CONF_SDK_SILENT,
|
||||
@@ -453,7 +454,14 @@ async def component_to_code(config):
|
||||
cg.add_platformio_option("lib_ldf_mode", "off")
|
||||
cg.add_platformio_option("lib_compat_mode", "soft")
|
||||
# include <Arduino.h> in every file
|
||||
cg.add_platformio_option("build_src_flags", "-include Arduino.h")
|
||||
build_src_flags = "-include Arduino.h"
|
||||
if FAMILY_COMPONENT[config[CONF_FAMILY]] == COMPONENT_BK72XX:
|
||||
# LibreTiny forces -O1 globally for BK72xx because the Beken SDK
|
||||
# has issues with higher optimization levels. However, ESPHome code
|
||||
# works fine with -Os (used on every other platform), so override
|
||||
# it for project source files only. GCC uses the last -O flag.
|
||||
build_src_flags += " -Os"
|
||||
cg.add_platformio_option("build_src_flags", build_src_flags)
|
||||
# dummy version code
|
||||
cg.add_define("USE_ARDUINO_VERSION_CODE", cg.RawExpression("VERSION_CODE(0, 0, 0)"))
|
||||
# decrease web server stack size (16k words -> 4k words)
|
||||
|
||||
@@ -15,6 +15,9 @@ void LTComponent::dump_config() {
|
||||
" Version: %s\n"
|
||||
" Loglevel: %u",
|
||||
LT_BANNER_STR + 10, LT_LOGLEVEL);
|
||||
#if defined(__OPTIMIZE_SIZE__) && __OPTIMIZE_LEVEL__ > 0 && __OPTIMIZE_LEVEL__ <= 3
|
||||
ESP_LOGCONFIG(TAG, " Optimization: -Os, SDK: -O" STRINGIFY_MACRO(__OPTIMIZE_LEVEL__));
|
||||
#endif
|
||||
|
||||
#ifdef USE_TEXT_SENSOR
|
||||
if (this->version_ != nullptr) {
|
||||
|
||||
Reference in New Issue
Block a user