Hy,
I am quite new to developing with esp-idf and platformio. I have a project, which should connect to the google cloud iot core and publish sensor datas.
Previous I used the arduino platform to program the esp32 and the connection to the google cloud iot core worked already. However, with the arduino platform, i did not get the required performance, so I want to switch to the esp-idf.
Thanks a lot for your fast response @maxgerhardt
I tried to include the component, as mentioned in the documentation, but somehow, something is not working correctly…
As you can see in the following picture, I´ve the project “Test_EspIdf”. In this project, I´ve created the components folder and there I´ve included the whole esp-google-iot-master project (just downloaded from the branch)
Finally I added the private_key in the certs folder of my sourcefolder and edited the component.mk & the cmakelist:
component.mk:
COMPONENT_EMBED_TXTFILES := certs/private_key.pem
ifndef IDF_CI_BUILD
$(COMPONENT_PATH)/certs/private_key.pem:
@echo "Missing PEM file $@. This file identifies the ESP32 to Google Cloud IoT Core for the example."
exit 1
else
$(COMPONENT_PATH)/certs/private_key.pem:
@echo "Dummy certificate data for continuous integration" > $@
endif
CMakeList.txt:
# The commented lines has been the previous content:
# FILE(GLOB_RECURSE app_sources ${CMAKE_SOURCE_DIR}/src/*.*)
# idf_component_register(SRCS ${app_sources})
set(COMPONENT_SRCS "main.c")
set(COMPONENT_ADD_INCLUDEDIRS ".")
register_component()
if(IDF_CI_BUILD)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/certs/private_key.pem
COMMAND echo "Dummy certificate data for continuous integration" >
certs/private_key.pem
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
VERBATIM)
add_custom_target(example_certificates DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/certs/private_key.pem)
add_dependencies(${COMPONENT_TARGET} example_certificates)
target_add_binary_data(${COMPONENT_TARGET} "${CMAKE_CURRENT_BINARY_DIR}/certs/private_key.pem" TEXT)
else()
target_add_binary_data(${COMPONENT_TARGET} "certs/private_key.pem" TEXT)
endif()
In my src/main.c where the current program is running, I just included some example methods (just copied from the example “smart outlet” from the branch to see if it is working).
If I try to build, I always get following error:
*** [.pio\build\esp32dev\esp-idf.pio\build\esp32dev\private_key.pem.S.o] Source .pio\build\esp32dev\private_key.pem.S' not found, needed by target .pio\build\esp32dev\esp-idf.pio\build\esp32dev\private_key.pem.S.o’.