硬件部分:esp32-s3 –wroom-1
软件部分: esp-idf-v4.4.2
开发环境:Wondows 7
IDE: Eclipse IDE for C/C++ Developers Version: 2022-06 (4.24.0)
问题描述:
原本在keil c mdk 用AT command开发蛮顺手的,但后来转到IDF确让我挫折满满,编译后出现一堆问题,在网上没有找当我想找的答案,虚心求教一下
出现问题描述:
undefined reference to `app_main'
undefined reference to `app_main'
Symbol 'NULL' could not be resolved
Symbol 'ESP_ERR_NVS_NO_FREE_PAGES' could not be resolved
Symbol 'ESP_ERR_NVS_NEW_VERSION_FOUND' could not be resolved
esp-idf/freertos/libfreertos.a(port_common.c.obj): in func
tion `main_task':
设定步骤
1. 开启idf 专案
2. 挂载
https://github.com/espressif/esp-aws-iot 项目内容(esp-aws-iot-masterexampleshttp)透过import -> file system 方式把*.c
*.h挂载进来
3. Cmakelist.txt不知道该如何修改
CMakeList.txt
1.
set(COMPONENT_SRCS
"app_main.c"
"http_demo_mutual_auth.c"
"http_demo_utils.c"
)
set(COMPONENT_ADD_INCLUDEDIRS
"."
"${CMAKE_CURRENT_LIST_DIR}"
)
idf_component_register(SRCS "${COMPONENT_SRCS}"
INCLUDE_DIRS ${COMPONENT_ADD_INCLUDEDIRS}
)
2.
# The following five lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
set(EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/examples/common_components/protocol_examples_common"
"${CMAKE_CURRENT_LIST_DIR}/../../../libraries/coreHTTP"
"${CMAKE_CURRENT_LIST_DIR}/../../../libraries/backoffAlgorithm"
"${CMAKE_CURRENT_LIST_DIR}/../../../libraries/common/posix_compat"
)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(http_mutual_auth)
target_add_binary_data(${CMAKE_PROJECT_NAME}.elf "main/certs/root_cert_auth.pem" TEXT)
target_add_binary_data(${CMAKE_PROJECT_NAME}.elf "main/certs/client.crt" TEXT)
target_add_binary_data(${CMAKE_PROJECT_NAME}.elf "main/certs/client.key" TEXT)
3.
# The following lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
get_filename_component(ProjectId ${CMAKE_CURRENT_LIST_DIR} NAME)
string(REPLACE " " "_" ProjectId ${ProjectId})
project(${ProjectId})