适配ESP-IDF v6.0编译 补充项目相关文档 * 修复16处头文件缺失、flash配置错误、WiFi断开原因码兼容问题 * 新增ESP-IDF v6.0迁移适配文档 * 更新变更日志,补充v1.0.0功能清单及v1.1.0版本规划 * 整理讨论记录,新增v6.0适配及国内大模型接入内容
This commit is contained in:
82
docs/ESP-IDF-V6-MIGRATION.md
Normal file
82
docs/ESP-IDF-V6-MIGRATION.md
Normal file
@@ -0,0 +1,82 @@
|
||||
# ESP-IDF v6.0 编译适配记录
|
||||
|
||||
> 日期:2026-03-31
|
||||
> 目标芯片:ESP32-S3
|
||||
> ESP-IDF 版本:v6.0
|
||||
> 问题:从旧版本迁移到 ESP-IDF v6.0 后编译失败,存在多处头文件缺失、配置错误、CMakeLists 遗漏
|
||||
|
||||
---
|
||||
|
||||
## 问题清单与修复
|
||||
|
||||
### 1. Flash 大小配置错误
|
||||
|
||||
**错误信息:**
|
||||
```
|
||||
Partitions tables occupies 16.0MB of flash which does not fit in configured flash size 2MB
|
||||
```
|
||||
|
||||
**修复:** `sdkconfig` 中 flash 大小从 2MB 改为 16MB
|
||||
- `CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y` → `CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y`
|
||||
- `CONFIG_ESPTOOLPY_FLASHSIZE="2MB"` → `CONFIG_ESPTOOLPY_FLASHSIZE="16MB"`
|
||||
|
||||
### 2. WiFi 断开原因码未定义
|
||||
|
||||
**错误信息:**
|
||||
```
|
||||
error: 'WIFI_REASON_ASSOC_EXPIRE' undeclared
|
||||
```
|
||||
|
||||
**修复:** `main/wifi/wifi_manager.c` — 为所有 reason code 添加 `#ifdef` 保护(ESP-IDF v6.0 移除了部分原因码)
|
||||
|
||||
### 3. CMakeLists.txt 缺少源文件
|
||||
|
||||
**修复:** `main/CMakeLists.txt`
|
||||
- 添加 `"ota/ota_manager.c"` 到 SRCS 列表
|
||||
|
||||
### 4. 头文件缺失(共修复 16 处)
|
||||
|
||||
| 文件 | 缺失头文件 | 使用符号 |
|
||||
|------|-----------|---------|
|
||||
| `main/cli/serial_cli.c` | `llm/llm_provider.h` | `llm_provider_set_api_key` |
|
||||
| `main/llm/llm_provider.c` | `esp_http_client.h` | `esp_http_client_set_header` |
|
||||
| `main/bus/message_bus.c` | `freertos/FreeRTOS.h`, `freertos/queue.h` | `xQueueCreate`, `QueueHandle_t` |
|
||||
| `main/wifi/wifi_manager.c` | `esp_event.h` | `esp_event_handler_instance_register` |
|
||||
| `main/wifi/wifi_manager.c` | `freertos/FreeRTOS.h`, `freertos/task.h`, `freertos/event_groups.h` | `xEventGroupCreate`, `vTaskDelay` |
|
||||
| `main/ota/ota_manager.c` | `esp_system.h` | `esp_restart` |
|
||||
| `main/channels/telegram/telegram_bot.c` | `freertos/FreeRTOS.h`, `freertos/task.h` | `xTaskCreatePinnedToCore`, `vTaskDelay` |
|
||||
| `main/channels/telegram/telegram_bot.c` | `esp_err.h` | `esp_err_to_name` |
|
||||
| `main/tools/tool_registry.c` | `<stdlib.h>` | `free()` |
|
||||
| `main/proxy/http_proxy.c` | `<sys/time.h>` | `struct timeval` |
|
||||
| `main/gateway/ws_server.c` | `<stdint.h>` | `uint8_t` |
|
||||
|
||||
---
|
||||
|
||||
## ESP-IDF v6.0 API 兼容性验证
|
||||
|
||||
以下 API 在 v6.0 中**仍然可用**,无需修改:
|
||||
|
||||
| API | 位置 | 状态 |
|
||||
|-----|------|------|
|
||||
| `esp_spiffs_info()` | `esp_spiffs.h` | ✅ 存在 |
|
||||
| `esp_websocket_client_send_bin()` | `esp_websocket_client.h` | ✅ 存在 |
|
||||
| `esp_tls_set_conn_sockfd()` | `esp_tls.h` | ✅ 存在 |
|
||||
| `esp_tls_set_conn_state()` | `esp_tls.h` | ✅ 存在 |
|
||||
| `esp_console_new_repl_uart()` | `esp_console.h` | ✅ 存在 |
|
||||
| `esp_console_new_repl_usb_serial_jtag()` | `esp_console.h` | ✅ 存在 |
|
||||
| `esp_console_new_repl_usb_cdc()` | `esp_console.h` | ✅ 存在 |
|
||||
| `esp_https_ota()` + `esp_https_ota_config_t` | `esp_https_ota.h` | ✅ 存在 |
|
||||
| `esp_wifi_set_config()` | `esp_wifi.h` | ✅ 存在 |
|
||||
|
||||
---
|
||||
|
||||
## 烧录说明
|
||||
|
||||
ESP32-S3 烧录使用 **USB 口**(内置 USB Serial/JTAG 控制器):
|
||||
|
||||
```powershell
|
||||
idf.py -p COMx flash monitor
|
||||
```
|
||||
|
||||
- 插 **USB 口**(标记为 `USB`),不是 UART 口
|
||||
- 如遇连接失败,按住 **BOOT** 键再插线进入下载模式
|
||||
Reference in New Issue
Block a user