From 3f1af1690b7387a20a939325441aca8b28e1042e Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Thu, 15 Dec 2022 21:27:59 +0100 Subject: [PATCH 1/4] Support non-multiarch toolchains on 32-bit ARM (#4191) fixes https://github.com/esphome/issues/issues/3904 --- docker/Dockerfile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index a49ad5a9ef..0dd505a9b8 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -12,6 +12,9 @@ FROM debian:bullseye-20221024-slim AS base-docker FROM base-${BASEIMGTYPE} AS base +ARG TARGETARCH +ARG TARGETVARIANT + RUN \ apt-get update \ # Use pinned versions so that we get updates with build caching @@ -36,6 +39,14 @@ ENV \ # Store globally installed pio libs in /piolibs PLATFORMIO_GLOBALLIB_DIR=/piolibs +# Support legacy binaries on Debian multiarch system. There is no "correct" way +# to do this, other than using properly built toolchains... +# See: https://unix.stackexchange.com/questions/553743/correct-way-to-add-lib-ld-linux-so-3-in-debian +RUN \ + if [ "$TARGETARCH$TARGETVARIANT" = "armv7" ]; then \ + ln -s /lib/arm-linux-gnueabihf/ld-linux.so.3 /lib/ld-linux.so.3; \ + fi + RUN \ # Ubuntu python3-pip is missing wheel pip3 install --no-cache-dir \ From e6d8ef98d3ddbccbda644fc088e92e2977b62938 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Fri, 16 Dec 2022 10:09:07 +1300 Subject: [PATCH 2/4] Mark ESP32-S2 as not having Bluetooth (#4194) --- esphome/components/esp32_ble/__init__.py | 13 ++++++++++++- esphome/components/esp32_ble_beacon/__init__.py | 3 +++ esphome/components/esp32_ble_tracker/__init__.py | 3 +++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/esphome/components/esp32_ble/__init__.py b/esphome/components/esp32_ble/__init__.py index 4b5c741ad9..c6bb296cdc 100644 --- a/esphome/components/esp32_ble/__init__.py +++ b/esphome/components/esp32_ble/__init__.py @@ -2,12 +2,14 @@ import esphome.codegen as cg import esphome.config_validation as cv from esphome.const import CONF_ID from esphome.core import CORE -from esphome.components.esp32 import add_idf_sdkconfig_option +from esphome.components.esp32 import add_idf_sdkconfig_option, get_esp32_variant, const DEPENDENCIES = ["esp32"] CODEOWNERS = ["@jesserockz"] CONFLICTS_WITH = ["esp32_ble_tracker", "esp32_ble_beacon"] +NO_BLUTOOTH_VARIANTS = [const.VARIANT_ESP32S2] + esp32_ble_ns = cg.esphome_ns.namespace("esp32_ble") ESP32BLE = esp32_ble_ns.class_("ESP32BLE", cg.Component) @@ -19,6 +21,15 @@ CONFIG_SCHEMA = cv.Schema( ).extend(cv.COMPONENT_SCHEMA) +def validate_variant(_): + variant = get_esp32_variant() + if variant in NO_BLUTOOTH_VARIANTS: + raise cv.Invalid(f"{variant} does not support Bluetooth") + + +FINAL_VALIDATE_SCHEMA = validate_variant + + async def to_code(config): var = cg.new_Pvariable(config[CONF_ID]) await cg.register_component(var, config) diff --git a/esphome/components/esp32_ble_beacon/__init__.py b/esphome/components/esp32_ble_beacon/__init__.py index c3bd4ee418..311919dcd4 100644 --- a/esphome/components/esp32_ble_beacon/__init__.py +++ b/esphome/components/esp32_ble_beacon/__init__.py @@ -3,6 +3,7 @@ import esphome.config_validation as cv from esphome.const import CONF_ID, CONF_TYPE, CONF_UUID, CONF_TX_POWER from esphome.core import CORE, TimePeriod from esphome.components.esp32 import add_idf_sdkconfig_option +from esphome.components import esp32_ble DEPENDENCIES = ["esp32"] CONFLICTS_WITH = ["esp32_ble_tracker"] @@ -54,6 +55,8 @@ CONFIG_SCHEMA = cv.All( validate_config, ) +FINAL_VALIDATE_SCHEMA = esp32_ble.validate_variant + async def to_code(config): uuid = config[CONF_UUID].hex diff --git a/esphome/components/esp32_ble_tracker/__init__.py b/esphome/components/esp32_ble_tracker/__init__.py index a3938faff2..c20491e701 100644 --- a/esphome/components/esp32_ble_tracker/__init__.py +++ b/esphome/components/esp32_ble_tracker/__init__.py @@ -17,6 +17,7 @@ from esphome.const import ( ) from esphome.core import CORE from esphome.components.esp32 import add_idf_sdkconfig_option +from esphome.components import esp32_ble DEPENDENCIES = ["esp32"] @@ -187,6 +188,8 @@ CONFIG_SCHEMA = cv.Schema( } ).extend(cv.COMPONENT_SCHEMA) +FINAL_VALIDATE_SCHEMA = esp32_ble.validate_variant + ESP_BLE_DEVICE_SCHEMA = cv.Schema( { cv.GenerateID(CONF_ESP32_BLE_ID): cv.use_id(ESP32BLETracker), From 9c69b98a49ff85c91d4c8a796788b458258696c1 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Fri, 16 Dec 2022 10:38:52 +1300 Subject: [PATCH 3/4] Fix i2s_audio media_player compiling for esp32-s2 (#4195) --- .../i2s_audio/i2s_audio_media_player.cpp | 6 ++++++ .../components/i2s_audio/i2s_audio_media_player.h | 4 ++++ esphome/components/i2s_audio/media_player.py | 15 ++++++++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/esphome/components/i2s_audio/i2s_audio_media_player.cpp b/esphome/components/i2s_audio/i2s_audio_media_player.cpp index f1f1dc0d51..2b00a5ec26 100644 --- a/esphome/components/i2s_audio/i2s_audio_media_player.cpp +++ b/esphome/components/i2s_audio/i2s_audio_media_player.cpp @@ -103,9 +103,11 @@ void I2SAudioMediaPlayer::stop_() { void I2SAudioMediaPlayer::setup() { ESP_LOGCONFIG(TAG, "Setting up Audio..."); +#if SOC_I2S_SUPPORTS_DAC if (this->internal_dac_mode_ != I2S_DAC_CHANNEL_DISABLE) { this->audio_ = make_unique