[IDFGH-2940] sdkconfig not defining values used in component
Posted: Sun Mar 22, 2020 10:49 pm
Hi,
I'm using the idf_as_lib method and trying to add a component to my design based off the i2c_self_test example. However the sdkconfig does not seem to be defining the required variables.
For instance I expect CONFIG_I2C_SLAVE_ADDRESS to be defined in my main sdkconfig (as it is when I run i2c_self_test) and therefore available to my components/i2c_self_test/main/i2c_example.main, but it is not.
In fact my sdkconfig does not have ANY of the definitions used in the i2c_example_main.c defined. Am I missing a call to some cmake API?
I have poured through the build_system and the cmake files. I am trying to understand how kconfig detects and sets these variables, but it is a lot to learn.
Here is my toplevel CMakeLists.txt
the components/i2c_self_test/CMakeLists.txt is
I build simply by
My file structure is
-components/i2c_self_test/
-main/i2c_example_main.c
-CMakeLists.txti
CMakeLists.txt
main.c
I'm using the idf_as_lib method and trying to add a component to my design based off the i2c_self_test example. However the sdkconfig does not seem to be defining the required variables.
For instance I expect CONFIG_I2C_SLAVE_ADDRESS to be defined in my main sdkconfig (as it is when I run i2c_self_test) and therefore available to my components/i2c_self_test/main/i2c_example.main, but it is not.
In fact my sdkconfig does not have ANY of the definitions used in the i2c_example_main.c defined. Am I missing a call to some cmake API?
I have poured through the build_system and the cmake files. I am trying to understand how kconfig detects and sets these variables, but it is a lot to learn.
Here is my toplevel CMakeLists.txt
Code: Select all
cmake_minimum_required(VERSION 3.5)
project(MYPROJECT C)
set(elf_file ${CMAKE_PROJECT_NAME}.elf)
set(SUPPORTED_TARGETS esp32)
include($ENV{IDF_PATH}/tools/cmake/idf.cmake)
idf_build_component(${CMAKE_HOME_DIRECTORY}/components/i2c_self_test)
idf_build_process(esp32
COMPONENTS esp32 freertos esptool_py i2c_self_test
SDKCONFIG ${CMAKE_BINARY_DIR}/sdkconfig
BUILD_DIR ${CMAKE_BINARY_DIR})
add_executable(${elf_file} main.c)
target_link_libraries(${elf_file} idf::esp32 idf::freertos idf::spi_flash idf::i2c_self_test)
idf_build_executable(${elf_file})
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
Code: Select all
idf_component_register(SRC_DIRS main)
Code: Select all
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=$IDF_PATH/tools/cmake/toolchain-esp32.cmake -DTARGET=esp32 -G 'Unix Makefiles'
cmake --build .
-components/i2c_self_test/
-main/i2c_example_main.c
-CMakeLists.txti
CMakeLists.txt
main.c