本教程将介绍如何在 ESP-IDF 开发环境中集成 CoreS3 板级支持包(BSP),以便快速初始化和管理板载外设驱动,提升开发效率。
v5.4.1
. ./export.sh
指令的"."
与脚本之间有一个空格,该指令等同于source ./export.sh
git clone --recursive https://github.com/espressif/esp-idf.git
cd esp-idf
git checkout v5.4.1 # recommend
./install.sh
. ./export.sh
. ./export.sh
用于激活相关的环境变量。详细说明请参考ESP-IDF - ESP32-S3上手教程。cores3_projects
。切换路径进入文件夹后,调用esp-idf项目中export.sh
用于激活相关的环境变量。以下指令适用于项目文件夹cores3_projects与esp-idf处于同级目录,其他路径则需根据实际情况修改指令。执行以下idf.py create-project
指令创建空白项目模板,演示的项目名为my_project
。mkdir cores3_projects
cd cores3_projects
. ../esp-idf/export.sh
idf.py create-project my_project
cd my_project
idf.py add-dependency "espressif/m5stack_core_s3^3.0.0"
idf.py set-target esp32s3
Component config
->Audio Codec Device Configuration
,关闭向后兼容I2C Driver
选项。idf.py menuconfig
vim main/my_project.c
#include "freertos/FreeRTOS.h"#include "freertos/task.h"#include "esp_log.h" #include "lv_demos.h"#include "bsp/esp-bsp.h" static char *TAG = "app_main"; #define LOG_MEM_INFO (0) void app_main(void) { /* Initialize display and LVGL */ bsp_display_start(); /* Set display brightness to 100% */ bsp_display_backlight_on(); ESP_LOGI(TAG, "Display LVGL demo"); bsp_display_lock(0); lv_demo_widgets(); /* A widgets example */ // lv_demo_music(); /* A modern, smartphone-like music player demo. */ // lv_demo_stress(); /* A stress test for LVGL. */ // lv_demo_benchmark(); /* A demo to measure the performance of LVGL or // to compare different settings. */ bsp_display_unlock();}
idf.py menuconfig
进入配置菜单Component config
->LVGL Configuration
->Demos
,启用对应的LGVL案例。idf.py flash