diff --git a/components/soc/CMakeLists.txt b/components/soc/CMakeLists.txt index 1bb0e31ef..7116f7261 100644 --- a/components/soc/CMakeLists.txt +++ b/components/soc/CMakeLists.txt @@ -37,7 +37,11 @@ elseif(CONFIG_IDF_TARGET_ESP32S2) target_sources(${COMPONENT_LIB} PRIVATE "src/hal/spi_flash_hal_gpspi.c") endif() +# Since there can be chip-specific HAL headers which can include the common +# HAL header via include_next, process the build scripts here first so that +# include directories appear first in the compile command. +add_subdirectory(src/${target}) +target_include_directories(${COMPONENT_LIB} PUBLIC include) + add_subdirectory(soc) target_link_libraries(${COMPONENT_LIB} PUBLIC "soc_${target}") - -add_subdirectory(src/${target}) diff --git a/components/soc/component.mk b/components/soc/component.mk index b86e9f8d0..96d220493 100644 --- a/components/soc/component.mk +++ b/components/soc/component.mk @@ -1,10 +1,14 @@ SOC_NAME := $(IDF_TARGET) COMPONENT_SRCDIRS := src src/hal +COMPONENT_ADD_INCLUDEDIRS := -COMPONENT_ADD_INCLUDEDIRS := include +# Since there can be chip-specific HAL headers which can include the common +# HAL header via include_next, process the build scripts here first so that +# include directories appear first in the compile command. +-include $(COMPONENT_PATH)/src/$(SOC_NAME)/component.mk +COMPONENT_ADD_INCLUDEDIRS += include -include $(COMPONENT_PATH)/soc/component.mk --include $(COMPONENT_PATH)/src/$(SOC_NAME)/component.mk COMPONENT_ADD_LDFRAGMENTS += linker.lf diff --git a/components/soc/include/hal/touch_sensor_hal.h b/components/soc/include/hal/touch_sensor_hal.h index dc2023f19..3d2f715b8 100644 --- a/components/soc/include/hal/touch_sensor_hal.h +++ b/components/soc/include/hal/touch_sensor_hal.h @@ -25,12 +25,6 @@ #include "hal/touch_sensor_ll.h" #include "hal/touch_sensor_types.h" -#ifdef CONFIG_IDF_TARGET_ESP32 -#include "hal/touch_sensor_hal_esp32.h" -#elif CONFIG_IDF_TARGET_ESP32S2 -#include "hal/touch_sensor_hal_esp32s2.h" -#endif - typedef struct { touch_high_volt_t refh; touch_low_volt_t refl; diff --git a/components/soc/src/esp32/include/hal/touch_sensor_hal_esp32.h b/components/soc/src/esp32/include/hal/touch_sensor_hal.h similarity index 99% rename from components/soc/src/esp32/include/hal/touch_sensor_hal_esp32.h rename to components/soc/src/esp32/include/hal/touch_sensor_hal.h index 82f8b799e..5ff2155dd 100644 --- a/components/soc/src/esp32/include/hal/touch_sensor_hal_esp32.h +++ b/components/soc/src/esp32/include/hal/touch_sensor_hal.h @@ -25,6 +25,8 @@ #include "hal/touch_sensor_ll.h" #include "hal/touch_sensor_types.h" +#include_next "hal/touch_sensor_hal.h" + /** * Set touch sensor measurement time. * diff --git a/components/soc/src/esp32s2/include/hal/touch_sensor_hal_esp32s2.h b/components/soc/src/esp32s2/include/hal/touch_sensor_hal.h similarity index 99% rename from components/soc/src/esp32s2/include/hal/touch_sensor_hal_esp32s2.h rename to components/soc/src/esp32s2/include/hal/touch_sensor_hal.h index ff0315abb..76e77e2d0 100644 --- a/components/soc/src/esp32s2/include/hal/touch_sensor_hal_esp32s2.h +++ b/components/soc/src/esp32s2/include/hal/touch_sensor_hal.h @@ -25,6 +25,8 @@ #include "hal/touch_sensor_ll.h" #include "hal/touch_sensor_types.h" +#include_next "hal/touch_sensor_hal.h" + /** * Reset the whole of touch module. *