创建工程
- 文件结构:
ESP32C3
├── CMakeLists.txt
└── main
├── CMakeLists.txt
└── main.c
CMakeLists.txt
cmake_minimum_required(VERSION 3.16)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(ESP32C3_Minimal)
main/CMakeLists.txt
idf_component_register(SRCS "main.c" INCLUDE_DIRS "")
main/main.c
#include <stdio.h>
#include "sdkconfig.h"
void app_main(void)
{
printf("Hello world!\n");
fflush(stdout);
}
工程配置与烧写测试
idf.py set-target esp32c3
idf.py menuconfig
idf.py build
idf.py flash monitor