sipeed教程:SenseCraft 模型助手部署 | Seeed Studio Wiki
一、安装ESP-IDF
鉴于我的电脑之前安装过esp-idf v4.3版本,而ESP32-S3需要v4.4及以上版本才支持,所以将esp-idf更新到最新5.1版本。
新安装参照:ESP-IDF Windows 开发环境搭建_esp-idf-tools_火柴棍mcu的博客-CSDN博客
乐鑫开源 / esp-idf gitee仓库: https://gitee.com/EspressifSystems/esp-idf?_from=gitee_search
如果从github拉取代码比较慢,可从gitee拉取。
1、启动ESP-IDF 4.3 PowerShell应用
2、更新esp-idf
git checkout master
git pull
git submodule update --init --recursive
如遇:unable to access 'https://github.com/espressif/esp-idf.git/': Recv failure: Connection was reset
解决方法:unable to access ‘https://github.com/.../...git‘: Recv failure: Connection was reset-CSDN博客
二、获取edgelab-example-esp32代码
esp-idf目录下创建projects目录
mkdir projects
cd projects
git clone https://github.com/Seeed-Studio/edgelab-example-esp32
cd edgelab-example-esp32
git submodule init
git submodule update
三、编译例程
1、进如例程目录,查看例程:
cd examples
ls
有以下几个例程:
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2023/12/3 11:37 at_server_demo
d----- 2023/12/3 11:37 data_models_demo
d----- 2023/12/3 11:37 data_storage_demo
d----- 2023/12/3 11:37 fomo_detection_demo
d----- 2023/12/3 11:37 mobilenetv2_classification_demo
d----- 2023/12/3 11:37 network_demo
d----- 2023/12/3 11:37 pfld_meter_demo
d----- 2023/12/3 11:37 serial_echo_demo
d----- 2023/12/3 11:37 task_executor_demo
d----- 2023/12/3 11:37 yolo_detection_demo
其中data_models_demo、fomo_detection_demo、mobilenetv2_classification_demo、yolo_detection_demo几个是机器学习相关的。
2、编译data_models_demo
cd data_models_demo
idf.py set-target esp32s3
idf.py build
3、编译提示错误
错误提示1:
[3/1204] Generating ../../partition_table/partition-table.bin
FAILED: partition_table/partition-table.bin F:/esp/esp-idf/projects/edgelab-example-esp32/examples/data_models_demo/build/partition_table/partition-table.bin
解决方法:
执行idf.py menuconfig命令启动 Espressif IoT Development Framework Configuration将Flash size改为8MB,重新编译。
Serial flasher config --->
Flash size (8 MB) --->
错误提示2:
In file included from F:/esp/esp-idf/projects/edgelab-example-esp32/components/sscma-micro/porting/espressif/el_device_esp.cpp:38:
F:/esp/esp-idf/projects/edgelab-example-esp32/components/sscma-micro/porting/espressif/el_network_esp.h:32:10: fatal error: esp_event.h: No such file or directory
原因:\edgelab-example-esp32\components\sscma-micro目录下的CMakeLists.txt文件没有添加esp_event组件。
解决方法:
删除\edgelab-example-esp32\components\sscma-micro目录下的CMakeLists.txt文件,然后重新编译。
4、编译完成
Successfully created esp32s3 image.
Generated F:/esp/esp-idf/projects/edgelab-example-esp32/examples/data_models_demo/build/data_models_demo.bin
[7/7] cmd.exe /C "cd /D F:\esp\esp-idf\projects\edgelab-example-esp32\examples\data_models_de.../esp-idf/projects/edgelab-example-esp32/examples/data_models_demo/build/data_models_demo.bin
data_models_demo.bin binary size 0x35990 bytes. Smallest app partition is 0x3bc000 bytes. 0x386670 bytes (94%) free.
Project build complete. To flash, run:
idf.py flash
or
idf.py -p PORT flash
or
python -m esptool --chip esp32s3 -b 460800 --before default_reset --after hard_reset --no-stub write_flash --flash_mode dio --flash_size 8MB --flash_freq 80m 0x0 build\bootloader\bootloader.bin 0x8000 build\partition_table\partition-table.bin 0x10000 build\data_models_demo.bin
or from the "F:\esp\esp-idf\projects\edgelab-example-esp32\examples\data_models_demo\build" directory
python -m esptool --chip esp32s3 -b 460800 --before default_reset --after hard_reset --no-stub write_flash "@flash_args"
在build目录下生成了三个bin文件,分别是:
地址 文件名
0x0 bootloader\bootloader.bin
0x8000 partition_table\partition-table.bin
0x10000 data_models_demo.bin
四、烧录&运行
1、烧录
执行指令idf.py flash。
2、运行日志
Data models demo:
Geting models handler from data delegate...
Init models...
Get all model info and print ->
Check if has a specified models on the flash ->
Get a specified models info ->
Seek all plain TFLite model info again from flash and print (default is packed TFLite mode) ->
Seek all packed TFLite model info again from flash and print (faster than plain TFLite mode) ->
Seek all model info again from flash and print (all models have a unique memory address) ->
Restarting in 1000 seconds...
Restarting in 999 seconds...
Restarting in 998 seconds...
Restarting in 997 seconds...
Restarting in 996 seconds...
Restarting in 995 seconds...
Restarting in 994 seconds...
Restarting in 993 seconds...
3、烧写一个模型bin文件到flash中
运行日志
Data models demo:
Geting models handler from data delegate...
Init models...
Get all model info and print ->
model: {id: 1, type: 1, flash_address: 0x00400000, size: 565384, memory_address: 0x3c830008}
Check if has a specified models on the flash ->
model: {id: 1, type: 1, flash_address: 0x00400000, size: 565384, memory_address: 0x3c830008}
Get a specified models info ->
model: {id: 1, type: 1, flash_address: 0x00400000, size: 565384, memory_address: 0x3c830008}
Seek all plain TFLite model info again from flash and print (default is packed TFLite mode) ->
model: {id: 1, type: 0, flash_address: 0x00400008, size: 0, memory_address: 0x3c830008}
Seek all packed TFLite model info again from flash and print (faster than plain TFLite mode) ->
model: {id: 1, type: 1, flash_address: 0x00400000, size: 565384, memory_address: 0x3c830008}
Seek all model info again from flash and print (all models have a unique memory address) ->
model: {id: 1, type: 1, flash_address: 0x00400000, size: 565384, memory_address: 0x3c830008}
Restarting in 1000 seconds...
Restarting in 999 seconds...
Restarting in 998 seconds...
Restarting in 997 seconds...