@@ -33,10 +33,16 @@ set(AVM_SYS_COMPONENT_SRCS
3333 "../../../../libAtomVM/portnifloader.c"
3434)
3535
36- if (IDF_VERSION_MAJOR GREATER_EQUAL 5)
36+ if (IDF_VERSION_MAJOR GREATER_EQUAL 6)
37+ set (ADDITIONAL_COMPONENTS "esp_partition" "esp_driver_ledc" "esp_driver_uart" )
38+ set (ADDITIONAL_PRIV_REQUIRES "esp_hw_support" )
39+ elseif (IDF_VERSION_MAJOR GREATER_EQUAL 5 AND IDF_VERSION_MAJOR LESS 6)
3740 set (ADDITIONAL_COMPONENTS "esp_partition" )
38- # available starting from v4.4
3941 set (ADDITIONAL_PRIV_REQUIRES "esp_hw_support" )
42+ elseif (IDF_VERSION_MAJOR LESS 6)
43+ # newlib component has been renamed to esp_libc.
44+ # Any `REQUIRES newlib` can simply be deleted as esp_libc is REQUIRED by default.
45+ set (ADDITIONAL_COMPONENTS "newlib" )
4046else ()
4147 set (ADDITIONAL_COMPONENTS "" )
4248 set (ADDITIONAL_PRIV_REQUIRES "" )
@@ -45,7 +51,7 @@ endif()
4551idf_component_register(
4652 SRCS ${AVM_SYS_COMPONENT_SRCS}
4753 INCLUDE_DIRS "include"
48- REQUIRES "spi_flash" "soc" "newlib" " pthread" "vfs" "mbedtls" ${ADDITIONAL_COMPONENTS}
54+ REQUIRES "spi_flash" "soc" "pthread" "vfs" "mbedtls" ${ADDITIONAL_COMPONENTS}
4955 PRIV_REQUIRES "libatomvm" "esp_timer" ${ADDITIONAL_PRIV_REQUIRES}
5056)
5157
@@ -54,8 +60,15 @@ target_compile_features(${COMPONENT_LIB} INTERFACE c_std_11)
5460idf_component_get_property(soc_dir soc COMPONENT_DIR)
5561idf_component_get_property(soc_include_dirs soc INCLUDE_DIRS)
5662idf_build_get_property(idf_target IDF_TARGET)
63+
64+ if (IDF_VERSION_MAJOR LESS 6)
5765idf_component_get_property(newlib_dir newlib COMPONENT_DIR)
5866idf_component_get_property(newlib_include_dirs newlib INCLUDE_DIRS)
67+ else ()
68+ idf_component_get_property(newlib_dir esp_libc COMPONENT_DIR)
69+ idf_component_get_property(newlib_include_dirs esp_libc INCLUDE_DIRS)
70+ endif ()
71+
5972idf_component_get_property(pthread_dir pthread COMPONENT_DIR)
6073idf_component_get_property(pthread_include_dirs pthread INCLUDE_DIRS)
6174idf_component_get_property(pthread_srcs pthread SRCS)
0 commit comments