From 0383dcb39eac09572e42c36bf451f88f42507638 Mon Sep 17 00:00:00 2001 From: morris Date: Fri, 18 Sep 2026 10:51:56 +0800 Subject: [PATCH] feat(lcd): enable Linux host compilation for esp_lcd Register LCD and I2S HAL on the POSIX simulator and compile the software panel ops path without hardware-only drivers. --- components/esp_hal_i2s/CMakeLists.txt | 4 --- components/esp_hal_lcd/CMakeLists.txt | 3 -- components/esp_lcd/CMakeLists.txt | 28 ++++++++++--------- .../{i80 => priv_include}/i80_io_priv.h | 0 4 files changed, 15 insertions(+), 20 deletions(-) rename components/esp_lcd/{i80 => priv_include}/i80_io_priv.h (100%) diff --git a/components/esp_hal_i2s/CMakeLists.txt b/components/esp_hal_i2s/CMakeLists.txt index a3e5700bfa7..88a55a73744 100644 --- a/components/esp_hal_i2s/CMakeLists.txt +++ b/components/esp_hal_i2s/CMakeLists.txt @@ -1,9 +1,5 @@ idf_build_get_property(target IDF_TARGET) -if(${target} STREQUAL "linux") - return() # This component is not supported by the POSIX/Linux simulator -endif() - set(srcs) set(includes "include") diff --git a/components/esp_hal_lcd/CMakeLists.txt b/components/esp_hal_lcd/CMakeLists.txt index a6883b19d8c..c25a1d7cd68 100644 --- a/components/esp_hal_lcd/CMakeLists.txt +++ b/components/esp_hal_lcd/CMakeLists.txt @@ -1,7 +1,4 @@ idf_build_get_property(target IDF_TARGET) -if(${target} STREQUAL "linux") - return() # This component is not supported by the POSIX/Linux simulator -endif() set(srcs) set(public_include "include") diff --git a/components/esp_lcd/CMakeLists.txt b/components/esp_lcd/CMakeLists.txt index 5fe569752b1..fe821dcb257 100644 --- a/components/esp_lcd/CMakeLists.txt +++ b/components/esp_lcd/CMakeLists.txt @@ -1,17 +1,19 @@ idf_build_get_property(target IDF_TARGET) -if(${target} STREQUAL "linux") - return() # This component is not supported by the POSIX/Linux simulator -endif() - -set(srcs "src/esp_lcd_common.c" - "src/esp_lcd_panel_io.c" - "src/esp_lcd_panel_ssd1306.c" - "src/esp_lcd_panel_st7789.c" - "src/esp_lcd_panel_ops.c") +set(srcs "src/esp_lcd_panel_ops.c") set(includes "include" "interface") -set(priv_requires "esp_mm" "esp_psram" "esp_pm" "esp_driver_i2s" "esp_driver_dma") -set(public_requires "esp_driver_gpio" "esp_driver_i2c" "esp_driver_spi" "esp_driver_parlio" "esp_hal_lcd") +set(priv_includes "priv_include") +set(public_requires "esp_hal_lcd" "esp_hal_gpio") +set(priv_requires) + +if(NOT ${target} STREQUAL "linux") + list(APPEND srcs "src/esp_lcd_common.c" + "src/esp_lcd_panel_io.c" + "src/esp_lcd_panel_ssd1306.c" + "src/esp_lcd_panel_st7789.c") + list(APPEND priv_requires "esp_mm" "esp_psram" "esp_pm" "esp_driver_i2s" "esp_driver_dma") + list(APPEND public_requires "esp_driver_gpio" "esp_driver_i2c" "esp_driver_spi" "esp_driver_parlio") +endif() if(CONFIG_SOC_I2C_SUPPORTED) list(APPEND srcs "i2c/esp_lcd_panel_io_i2c.c") @@ -48,9 +50,9 @@ endif() idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${includes} - PRIV_INCLUDE_DIRS "priv_include" "i80" - PRIV_REQUIRES ${priv_requires} + PRIV_INCLUDE_DIRS ${priv_includes} REQUIRES ${public_requires} + PRIV_REQUIRES ${priv_requires} LDFRAGMENTS linker.lf) if(CMAKE_C_COMPILER_ID STREQUAL "GNU") diff --git a/components/esp_lcd/i80/i80_io_priv.h b/components/esp_lcd/priv_include/i80_io_priv.h similarity index 100% rename from components/esp_lcd/i80/i80_io_priv.h rename to components/esp_lcd/priv_include/i80_io_priv.h