为esp32-c2编译esp-at工程报错

Moderator: ESP_XCGuang

dding832
Posts: 6
Joined: Fri Sep 06, 2024 10:23 am

为esp32-c2编译esp-at工程报错

Postby dding832 » Fri Sep 06, 2024 10:47 am

PC环境:WIN11+INTEL
芯片:ESP32-C2,具体芯片为ESP8684-H2
目的:在PC上建立开发环境
问题
1、最开始目的在VSCODE里编译esp-at工程,添加自定义AT命令,安装VSCODE后安装ESP-IDF插件,并选择安装了ESP-IDF的最新版(v5.3),安装成功,可以创建HELLOWORLD工程,编译并烧录到芯片运行。(奇怪的是不论PC机用哪个波特率均不能从芯片的UART0收到正常数据,全是乱码,但输出内容的时间间隔等是和代码匹配的),之后我在GITHUB上下载master支持的esp-at代码,在vscode中打开它的文件夹,在VSCODE底边栏选择ESP-C2时提示错误,如下:
[Error: non zero exit code 2

CMake Error at CMakeLists.txt:9 (string):
string no output variable specified

Adding "set-target"'s dependency "fullclean" to list of commands with default set of options.
Executing action: fullclean
Executing action: set-target
Set Target to: esp32c2, new sdkconfig will be created.
Running cmake in directory D:\DH\ESP32\IDF-Projects\esp-at\esp-at\build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DPYTHON=d:\DH\ESP32\IDF-TOOL\python_env\idf5.3_py3.11_env\Scripts\python.exe -DESP_PLATFORM=1 -DIDF_TARGET=esp32c2 -DCCACHE_ENABLE=0 D:\DH\ESP32\IDF-Projects\esp-at\esp-at"...
-- silence:0, sdkconfig:D:/DH/ESP32/IDF-Projects/esp-at/esp-at/module_config/module__default/sdkconfig.defaults
-- partition_table_dir: D:/DH/ESP32/IDF-Projects/esp-at/esp-at

CMake Error at CMakeLists.txt:10 (string):
string sub-command STRIP requires two arguments.


CMake Error at CMakeLists.txt:14 (string):
string begin index: 9 is out of range 0 - 0


CMake Error at CMakeLists.txt:15 (string):
string sub-command STRIP requires two arguments.


CMake Error at CMakeLists.txt:16 (string):
string no output variable specified


esp-at branch: master
esp-at docs version: latest
no extra component dirs
CMake Warning at esp-idf/tools/cmake/idf.cmake:18 (message):
IDF_PATH environment variable is different from inferred IDF_PATH.

Check if your project's top-level CMakeLists.txt includes the right
CMake files. Environment IDF_PATH will be used for the build:
D:/DH/ESP32/IDF-SDK/v5.3/esp-idf
Call Stack (most recent call first):
esp-idf/tools/cmake/project.cmake:12 (include)
CMakeLists.txt:119 (include)


-- Found Git: D:/DH/ESP32/IDF-TOOL/tools/idf-git/2.39.2/cmd/git.exe (found version "2.39.2.windows.1")
CMake Error at esp-idf/tools/cmake/idf.cmake:50 (include):
include could not find requested file:

uf2
Call Stack (most recent call first):
esp-idf/tools/cmake/project.cmake:12 (include)
CMakeLists.txt:119 (include)


-- Component directory D:/DH/ESP32/IDF-Projects/esp-at/esp-at/components/fs_image does not contain a CMakeLists.txt file. No component will be added
-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0
-- The ASM compiler identification is GNU
-- Found assembler: D:/DH/ESP32/IDF-TOOL/tools/riscv32-esp-elf/esp-13.2.0_20240530/riscv32-esp-elf/bin/riscv32-esp-elf-gcc.exe
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: D:/DH/ESP32/IDF-TOOL/tools/riscv32-esp-elf/esp-13.2.0_20240530/riscv32-esp-elf/bin/riscv32-esp-elf-gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: D:/DH/ESP32/IDF-TOOL/tools/riscv32-esp-elf/esp-13.2.0_20240530/riscv32-esp-elf/bin/riscv32-esp-elf-g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at esp-idf/tools/cmake/project.cmake:506 (message):
SDKCONFIG_DEFAULTS
'D:/DH/ESP32/IDF-Projects/esp-at/esp-at/module_config/module__default/sdkconfig.defaults'
does not exist.
Call Stack (most recent call first):
CMakeLists.txt:121 (project)


-- Configuring incomplete, errors occurred!
See also "D:/DH/ESP32/IDF-Projects/esp-at/esp-at/build/CMakeFiles/CMakeOutput.log".
cmake failed with exit code 1, output of the command is in the D:\DH\ESP32\IDF-Projects\esp-at\esp-at\build\log\idf_py_stderr_output_4292 and D:\DH\ESP32\IDF-Projects\esp-at\esp-at\build\log\idf_py_stdout_output_4292

at ChildProcess.<anonymous> (\dist\extension.js:2:1421636)
at ChildProcess.emit (node:events:517:28)
at ChildProcess._handle.onexit (node:internal/child_process:292:12)]


点击构建依然报错,如下:
Call Stack (most recent call first):
esp-idf/tools/cmake/project.cmake:12 (include)
CMakeLists.txt:119 (include)


-- Found Git: D:/DH/ESP32/IDF-TOOL/tools/idf-git/2.39.2/cmd/git.exe (found version "2.39.2.windows.1")
CMake Error at esp-idf/tools/cmake/idf.cmake:50 (include):
include could not find requested file:

uf2
Call Stack (most recent call first):
esp-idf/tools/cmake/project.cmake:12 (include)
CMakeLists.txt:119 (include)


-- Component directory D:/DH/ESP32/IDF-Projects/esp-at/esp-at/components/fs_image does not contain a CMakeLists.txt file. No component will be added
-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0
-- The ASM compiler identification is GNU
-- Found assembler: D:/DH/ESP32/IDF-TOOL/tools/riscv32-esp-elf/esp-13.2.0_20240530/riscv32-esp-elf/bin/riscv32-esp-elf-gcc.exe
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: D:/DH/ESP32/IDF-TOOL/tools/riscv32-esp-elf/esp-13.2.0_20240530/riscv32-esp-elf/bin/riscv32-esp-elf-gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: D:/DH/ESP32/IDF-TOOL/tools/riscv32-esp-elf/esp-13.2.0_20240530/riscv32-esp-elf/bin/riscv32-esp-elf-g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at esp-idf/tools/cmake/project.cmake:506 (message):
SDKCONFIG_DEFAULTS
'D:/DH/ESP32/IDF-Projects/esp-at/esp-at/module_config/module__default/sdkconfig.defaults'
does not exist.
Call Stack (most recent call first):
CMakeLists.txt:121 (project)


-- Configuring incomplete, errors occurred!
See also "D:/DH/ESP32/IDF-Projects/esp-at/esp-at/build/CMakeFiles/CMakeOutput.log".

* 终端进程“d:\DH\ESP32\IDF-TOOL\tools\cmake\3.24.0\bin\cmake.exe '-G=Ninja', '-DPYTHON_DEPS_CHECKED=1', '-DESP_PLATFORM=1', '-B=d:\DH\ESP32\IDF-Projects\esp-at\esp-at\build', '-S=d:\DH\ESP32\IDF-Projects\esp-at\esp-at'”已终止,退出代码: 1。


发现VSCODE+ESP-IDF插件不能编译后,参照官方文档https://docs.espressif.com/projects/esp-at/zh_CN/latest/esp32c2/Compile_and_Develop/How_to_clone_project_and_compile_it.html#esp-at-install-env进行编译,python和cmake路径我是用的VSCODE安装插件时内置下载的版本,并添加到环境变量中,具体为C:\Users\lych\.espressif\tools\cmake\3.24.0\bin和C:\Users\lych\.espressif\python_env\idf5.0_py3.11_env\Scripts,python build.py install、menuconfig均正常,但其在第6步python build.py build出错,,出错内容如下:

-- The C compiler identification is GNU 11.2.0
-- The CXX compiler identification is GNU 11.2.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/Users/lych/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/riscv32-esp-elf-gcc.exe
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Users/lych/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/riscv32-esp-elf-gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Users/lych/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/riscv32-esp-elf-g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32c2
Dependencies lock doesn't exist, solving dependencies.
.....NOTICE: Updating lock file at D:\DH\ESP32\IDF-Projects\esp-at-release-v3.1.0.0_my\esp-at\esp-idf\components\bootloader\subproject\dependencies.lock
Processing 4 dependencies:
[4/4] idf (5.0.6)-- Project sdkconfig file D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/sdkconfig
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of time_t
-- Check size of time_t - done
-- Adding linker script D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/soc/esp32c2/ld/esp32c2.peripherals.ld
-- App "bootloader" version: v5.0.6-dirty
-- Adding linker script D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/esp_rom/esp32c2/ld/esp32c2.rom.ld
-- Adding linker script D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/esp_rom/esp32c2/ld/esp32c2.rom.api.ld
-- Adding linker script D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/esp_rom/esp32c2/ld/esp32c2.rom.rvfp.ld
-- Adding linker script D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/esp_rom/esp32c2/ld/esp32c2.rom.newlib.ld
-- Adding linker script D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/bootloader/subproject/managed_components/espressif__bootloader_support_plus/ld/esp32c2/linker.lf
-- BOOTLOADER_SUPPORT_PLUS: 0.2.2
-- Adding linker script D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/bootloader/subproject/main/ld/esp32c2/bootloader.ld
-- Adding linker script D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/bootloader/subproject/main/ld/esp32c2/bootloader.rom.ld
-- Components: bootloader bootloader_support efuse esp_app_format esp_common esp_hw_support esp_rom esp_system espressif__bootloader_support_plus espressif__cmake_utilities espressif__xz esptool_py freertos hal log main micro-ecc newlib partition_table riscv soc spi_flash
-- Component paths: D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/bootloader D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/bootloader_support D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/efuse D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/esp_app_format D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/esp_common D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/esp_hw_support D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/esp_rom D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/esp_system D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/bootloader/subproject/managed_components/espressif__bootloader_support_plus D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/bootloader/subproject/managed_components/espressif__cmake_utilities D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/bootloader/subproject/managed_components/espressif__xz D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/esptool_py D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/freertos D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/hal D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/log D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/bootloader_components/main D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/bootloader/subproject/components/micro-ecc D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/newlib D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/partition_table D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/riscv D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/soc D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/spi_flash
-- Configuring done
-- Generating done
-- Build files have been written to: D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/build/bootloader
[693/831] Performing build step for 'bootloader'FAILED: bootloader-prefix/src/bootloader-stamp/bootloader-build bootloader/bootloader.elf bootloader/bootloader.bin bootloader/bootloader.map D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/build/bootloader-prefix/src/bootloader-stamp/bootloader-build D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/build/bootloader/bootloader.elf D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/build/bootloader/bootloader.bin D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/build/bootloader/bootloader.map
cmd.exe /C "cd /D D:\DH\ESP32\IDF-Projects\esp-at-release-v3.1.0.0_my\esp-at\build\bootloader && C:\Users\lych\.espressif\tools\cmake\3.24.0\bin\cmake.exe --build ."
[103/104] Generating binary image from built executableFAILED: .bin_timestamp D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/build/bootloader/.bin_timestamp
cmd.exe /C "cd /D D:\DH\ESP32\IDF-Projects\esp-at-release-v3.1.0.0_my\esp-at\build\bootloader && D:\DH\ESP32\IDF-TOOL\tools\idf-python\3.11.2\python.exe D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32c2 elf2image --flash_mode dio --flash_freq 60m --flash_size 2MB --min-rev-full 100 --max-rev-full 199 -o D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/build/bootloader/bootloader.bin D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/build/bootloader/bootloader.elf && C:\Users\lych\.espressif\tools\cmake\3.24.0\bin\cmake.exe -E echo "Generated D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/build/bootloader/bootloader.bin" && C:\Users\lych\.espressif\tools\cmake\3.24.0\bin\cmake.exe -E md5sum D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/build/bootloader/bootloader.bin > D:/DH/ESP32/IDF-Projects/esp-at-release-v3.1.0.0_my/esp-at/build/bootloader/.bin_timestamp"
D:\DH\ESP32\IDF-TOOL\tools\idf-python\3.11.2\python.exe: No module named esptool
ninja: build stopped: subcommand failed.
[702/831] Building C object esp-idf/protobuf-c/CMakeFiles/__idf_protobuf-c.dir/protobuf-c/protobuf-c/protobuf-c.c.objninja: build stopped: subcommand failed.
ninja failed with exit code 1, output of the command is in the D:\DH\ESP32\IDF-Projects\esp-at-release-v3.1.0.0_my\esp-at\build\log\idf_py_stderr_output_27608 and D:\DH\ESP32\IDF-Projects\esp-at-release-v3.1.0.0_my\esp-at\build\log\idf_py_stdout_output_27608
A fatal error occurred: idf.py build failed
PS D:\DH\ESP32\IDF-Projects\esp-at-release-v3.1.0.0_my\esp-at>

尝试pip install esptool后报一堆错误,附件是报错的截图,请帮忙看下是什么问题,谢谢。
Attachments
微信图片_20240906184448.png
微信图片_20240906184448.png (216.02 KiB) Viewed 2929 times
微信图片_20240906184443.png
微信图片_20240906184443.png (157.57 KiB) Viewed 2929 times
screenshot-20240906-184505.png
screenshot-20240906-184505.png (337.41 KiB) Viewed 2929 times

dding832
Posts: 6
Joined: Fri Sep 06, 2024 10:23 am

Re: 为esp32-c2编译esp-at工程报错

Postby dding832 » Mon Sep 09, 2024 7:46 am

请版主支持一下,或者有什么其它方式可以成功编译ESP-AT工程?

dding832
Posts: 6
Joined: Fri Sep 06, 2024 10:23 am

Re: 为esp32-c2编译esp-at工程报错

Postby dding832 » Tue Sep 10, 2024 10:55 am

问题解决,
应该是PC电脑的软件环境不对,可以参见我的博客
https://blog.csdn.net/dding832/article/ ... .3001.5502

ESP_Sun
Posts: 326
Joined: Thu Dec 30, 2021 9:52 am

Re: 为esp32-c2编译esp-at工程报错

Postby ESP_Sun » Wed Sep 11, 2024 11:16 am

👍

Who is online

Users browsing this forum: No registered users and 36 guests