Quellcode durchsuchen

soc_caps: Introduce SOC_LEDC_SUPPORTED and SOC_I2C_SUPPORTED caps to IDF

Wrap the ledc, i2c source files with the new caps in CMakeLists and linker.lf.
This could avoid potential source file not found warning during linking time.
Song Ruo Jing vor 3 Jahren
Ursprung
Commit
6a60ecf780

+ 8 - 2
components/driver/CMakeLists.txt

@@ -4,8 +4,6 @@ set(srcs
     "gpio/gpio.c"
     "gpio/rtc_io.c"
     "gptimer.c"
-    "i2c.c"
-    "ledc.c"
     "sdspi_crc.c"
     "sdspi_host.c"
     "sdspi_transaction.c"
@@ -23,6 +21,14 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${target}/include")
     list(APPEND includes "${target}/include")
 endif()
 
+if(CONFIG_SOC_LEDC_SUPPORTED)
+    list(APPEND srcs "ledc.c")
+endif()
+
+if(CONFIG_SOC_I2C_SUPPORTED)
+    list(APPEND srcs "i2c.c")
+endif()
+
 if(CONFIG_SOC_ADC_SUPPORTED)
     list(APPEND srcs "deprecated/adc_legacy.c")
 endif()

+ 8 - 4
components/hal/CMakeLists.txt

@@ -32,10 +32,6 @@ if(NOT BOOTLOADER_BUILD)
         "spi_slave_hal_iram.c"
         "timer_hal.c"
         "timer_hal_iram.c"
-        "ledc_hal.c"
-        "ledc_hal_iram.c"
-        "i2c_hal.c"
-        "i2c_hal_iram.c"
         "gpio_hal.c"
         "uart_hal.c"
         "uart_hal_iram.c"
@@ -50,6 +46,14 @@ if(NOT BOOTLOADER_BUILD)
         list(APPEND srcs "systimer_hal.c")
     endif()
 
+    if(CONFIG_SOC_LEDC_SUPPORTED)
+        list(APPEND srcs "ledc_hal.c" "ledc_hal_iram.c")
+    endif()
+
+    if(CONFIG_SOC_I2C_SUPPORTED)
+        list(APPEND srcs "i2c_hal.c" "i2c_hal_iram.c")
+    endif()
+
     if(CONFIG_SOC_RMT_SUPPORTED)
         list(APPEND srcs "rmt_hal.c")
     endif()

+ 4 - 2
components/hal/linker.lf

@@ -12,8 +12,10 @@ entries:
         uart_hal_iram (default)
     spi_flash_hal_iram (noflash)
     spi_flash_encrypt_hal_iram (noflash)
-    ledc_hal_iram (noflash)
-    i2c_hal_iram (noflash)
+    if SOC_LEDC_SUPPORTED = y:
+        ledc_hal_iram (noflash)
+    if SOC_I2C_SUPPORTED = y:
+        i2c_hal_iram (noflash)
     if HAL_WDT_USE_ROM_IMPL = n:
         wdt_hal_iram (noflash)
     if SOC_SYSTIMER_SUPPORTED = y && HAL_SYSTIMER_USE_ROM_IMPL = n:

+ 8 - 0
components/soc/esp32/include/soc/Kconfig.soc_caps.in

@@ -91,6 +91,14 @@ config SOC_SDM_SUPPORTED
     bool
     default y
 
+config SOC_LEDC_SUPPORTED
+    bool
+    default y
+
+config SOC_I2C_SUPPORTED
+    bool
+    default y
+
 config SOC_SUPPORT_COEXISTENCE
     bool
     default y

+ 2 - 0
components/soc/esp32/include/soc/soc_caps.h

@@ -82,6 +82,8 @@
 #define SOC_I2S_SUPPORTED           1
 #define SOC_RMT_SUPPORTED           1
 #define SOC_SDM_SUPPORTED           1
+#define SOC_LEDC_SUPPORTED          1
+#define SOC_I2C_SUPPORTED           1
 #define SOC_SUPPORT_COEXISTENCE     1
 #define SOC_AES_SUPPORTED           1
 #define SOC_MPI_SUPPORTED           1

+ 8 - 0
components/soc/esp32c2/include/soc/Kconfig.soc_caps.in

@@ -43,6 +43,14 @@ config SOC_TEMP_SENSOR_SUPPORTED
     bool
     default y
 
+config SOC_LEDC_SUPPORTED
+    bool
+    default y
+
+config SOC_I2C_SUPPORTED
+    bool
+    default y
+
 config SOC_SHA_SUPPORTED
     bool
     default y

+ 2 - 0
components/soc/esp32c2/include/soc/soc_caps.h

@@ -35,6 +35,8 @@
 #define SOC_EFUSE_KEY_PURPOSE_FIELD     0
 #define SOC_EFUSE_CONSISTS_OF_ONE_KEY_BLOCK 1
 #define SOC_TEMP_SENSOR_SUPPORTED       1
+#define SOC_LEDC_SUPPORTED              1
+#define SOC_I2C_SUPPORTED               1
 #define SOC_SHA_SUPPORTED               1
 #define SOC_ECC_SUPPORTED               1
 #define SOC_FLASH_ENC_SUPPORTED         1

+ 8 - 0
components/soc/esp32c3/include/soc/Kconfig.soc_caps.in

@@ -75,6 +75,14 @@ config SOC_SDM_SUPPORTED
     bool
     default y
 
+config SOC_LEDC_SUPPORTED
+    bool
+    default y
+
+config SOC_I2C_SUPPORTED
+    bool
+    default y
+
 config SOC_SYSTIMER_SUPPORTED
     bool
     default y

+ 2 - 0
components/soc/esp32c3/include/soc/soc_caps.h

@@ -43,6 +43,8 @@
 #define SOC_I2S_SUPPORTED               1
 #define SOC_RMT_SUPPORTED               1
 #define SOC_SDM_SUPPORTED               1
+#define SOC_LEDC_SUPPORTED              1
+#define SOC_I2C_SUPPORTED               1
 #define SOC_SYSTIMER_SUPPORTED          1
 #define SOC_SUPPORT_COEXISTENCE         1
 #define SOC_AES_SUPPORTED               1

+ 8 - 0
components/soc/esp32h2/include/soc/Kconfig.soc_caps.in

@@ -63,6 +63,14 @@ config SOC_SDM_SUPPORTED
     bool
     default y
 
+config SOC_LEDC_SUPPORTED
+    bool
+    default y
+
+config SOC_I2C_SUPPORTED
+    bool
+    default y
+
 config SOC_SYSTIMER_SUPPORTED
     bool
     default y

+ 2 - 0
components/soc/esp32h2/include/soc/soc_caps.h

@@ -48,6 +48,8 @@
 #define SOC_I2S_SUPPORTED               1
 #define SOC_RMT_SUPPORTED               1
 #define SOC_SDM_SUPPORTED               1
+#define SOC_LEDC_SUPPORTED              1
+#define SOC_I2C_SUPPORTED               1
 #define SOC_SYSTIMER_SUPPORTED          1
 #define SOC_AES_SUPPORTED               1
 #define SOC_MPI_SUPPORTED               1

+ 8 - 0
components/soc/esp32s2/include/soc/Kconfig.soc_caps.in

@@ -99,6 +99,14 @@ config SOC_SDM_SUPPORTED
     bool
     default y
 
+config SOC_LEDC_SUPPORTED
+    bool
+    default y
+
+config SOC_I2C_SUPPORTED
+    bool
+    default y
+
 config SOC_SYSTIMER_SUPPORTED
     bool
     default y

+ 2 - 0
components/soc/esp32s2/include/soc/soc_caps.h

@@ -63,6 +63,8 @@
 #define SOC_I2S_SUPPORTED               1
 #define SOC_RMT_SUPPORTED               1
 #define SOC_SDM_SUPPORTED               1
+#define SOC_LEDC_SUPPORTED              1
+#define SOC_I2C_SUPPORTED               1
 #define SOC_SYSTIMER_SUPPORTED          1
 #define SOC_SUPPORT_COEXISTENCE         0
 #define SOC_AES_SUPPORTED               1

+ 8 - 0
components/soc/esp32s3/include/soc/Kconfig.soc_caps.in

@@ -151,6 +151,14 @@ config SOC_SDM_SUPPORTED
     bool
     default y
 
+config SOC_LEDC_SUPPORTED
+    bool
+    default y
+
+config SOC_I2C_SUPPORTED
+    bool
+    default y
+
 config SOC_SYSTIMER_SUPPORTED
     bool
     default y

+ 2 - 0
components/soc/esp32s3/include/soc/soc_caps.h

@@ -52,6 +52,8 @@
 #define SOC_I2S_SUPPORTED               1
 #define SOC_RMT_SUPPORTED               1
 #define SOC_SDM_SUPPORTED               1
+#define SOC_LEDC_SUPPORTED              1
+#define SOC_I2C_SUPPORTED               1
 #define SOC_SYSTIMER_SUPPORTED          1
 #define SOC_SUPPORT_COEXISTENCE         1
 #define SOC_TEMP_SENSOR_SUPPORTED       1