This commit is contained in:
J. Nick Koston
2026-02-07 19:07:15 -06:00
parent 456e0f2679
commit d73384ae46
+10 -12
View File
@@ -33,9 +33,6 @@ from .const import (
CONF_UART_PORT,
FAMILIES,
FAMILY_BK7231N,
FAMILY_BK7231Q,
FAMILY_BK7231T,
FAMILY_BK7251,
FAMILY_COMPONENT,
FAMILY_FRIENDLY,
FAMILY_RTL8710B,
@@ -55,14 +52,20 @@ CODEOWNERS = ["@kuba2k2"]
AUTO_LOAD = ["preferences"]
IS_TARGET_PLATFORM = True
# BK72XX SDK options to disable unused features.
# BK7231N SDK options to disable unused features.
# Disabling BLE saves ~21KB RAM and ~200KB Flash because BLE init code is
# called unconditionally by the SDK. ESPHome doesn't use BLE on LibreTiny.
#
# This only works on BK7231N (BLE 5.x). Other BK72XX chips using BLE 4.2
# (BK7231T, BK7231Q, BK7251) cannot disable BLE via custom_options because
# the LibreTiny builder reads CFG_SUPPORT_BLE from the sys_config file at
# build-script time to decide which sources to compile - the custom_options
# override only affects C preprocessor defines, not the builder's Python logic.
#
# Other options like CFG_TX_EVM_TEST, CFG_RX_SENSITIVITY_TEST, CFG_SUPPORT_BKREG,
# CFG_SUPPORT_OTA_HTTP, and CFG_USE_SPI_SLAVE were evaluated but provide no # NOLINT
# measurable benefit - the linker already strips unreferenced code via -gc-sections.
_BK72XX_SYS_CONFIG_OPTIONS = [
_BK7231N_SYS_CONFIG_OPTIONS = [
"CFG_SUPPORT_BLE=0",
]
@@ -383,14 +386,9 @@ async def component_to_code(config):
cg.add_platformio_option("custom_fw_version", __version__)
# Apply chip-specific SDK options to save RAM/Flash
if config[CONF_FAMILY] in (
FAMILY_BK7231N,
FAMILY_BK7231Q,
FAMILY_BK7231T,
FAMILY_BK7251,
):
if config[CONF_FAMILY] == FAMILY_BK7231N:
cg.add_platformio_option(
"custom_options.sys_config#h", _BK72XX_SYS_CONFIG_OPTIONS
"custom_options.sys_config#h", _BK7231N_SYS_CONFIG_OPTIONS
)
# Disable LWIP statistics to save RAM - not needed in production