当前位置: 首页 > news >正文

ESP32 Wsl2 环境搭建

1 wsl2功能开启

WSL搭建就略过了,命令 wsl -v确认是否是WSL2

2 安装usb支持工具

Releases · dorssel/usbipd-win

我们打开 PowerShell 终端,并使用数据线将 PC 机与开发板相连,然后在终端输入“usbipd list“

这里BUSID为1-1是我的设备,状态是 ”不共享“

共享开发板设备

* powershell这里要用超级管理员权限

usbipd bind -b 1-1

3 WSL(ubuntu)安装esp-idf

前置环境(ubuntu)

sudo apt-get install git wget flex bison gperf python3 python3-pip python3-venv cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0.0

 克隆ESP-IDF软件开发库

mkdir esp

cd esp

git clone https://gitee.com/EspressifSystems/esp-idf.git

# 克隆 ESP-IDF TOOLS 工具库
cd esp-idf

git clone https://gitee.com/EspressifSystems/esp-gitee-tools.git

# 更新 ESP-IDF 子模块
./esp-gitee-tools/submodule-update.sh

# 设置国内镜像

export IDF_GITHUB_ASSETS="dl.espressif.cn/github_assets"

# 安装 ESP-IDF TOOLS 工具
./esp-gitee-tools/install.sh

打开.bashrc文件,在底部添加以下代码。 alias get_idf='. ~/esp/esp-idf/export.sh'

这个是环境变量的脚本。 根据提示执行添加环境的脚本

. /home/elihe999/esp/esp-idf/export.sh

vscode 远程wsl

搜索ESP-IDF

按下快捷键“F1”或“Ctrl + Shift + P”打开“显示所有命令”界面。然后,在搜索框中输入“Configure ESP-IDF”

。。。。等待安装。。。

安装完会打开设置页面

USE EXISTING SETUP -> Search ESP-IDF in system

点击安装

        

依然等待下载

安装完了

烧录一个样例

  1.  vscode wsl打开一个路径,里面放idf样例代码

/02_key/components/BSP/KEY/key.h:26:10: fatal error: driver/gpio.h: No such file or directory

Can't proceed with flashing, since project elf file (02_key.elf) is missing from the build dir

说明没有添加相关依赖的库

解决:添加esp_driver_gpio

set(src_dirsLEDKEY)set(include_dirsLEDKEY)set(requiresdriveresp_driver_gpio)idf_component_register(SRC_DIRS ${src_dirs} INCLUDE_DIRS ${include_dirs} REQUIRES ${requires})component_compile_options(-ffast-math -O3 -Wno-error=format=-Wno-format)

点击烧录,No serial ports found. Connect a device, or use '-p PORT' option to set a specific port.

这里还没有配置串口到wsl2

install.sh esp32s3

usbipd unbind -b 1-1

usbipd bind -b 1-1

然后连接wsl
usbipd attach --wsl --busid 1-1

idf.py flash

  Memory Type Usage Summary                             
┏━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Memory Type/Section ┃ Used [bytes] ┃ Used [%] ┃ Remain [bytes] ┃ Total [bytes] ┃
┡━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ Flash Code          │        94014 │          │                │               │
│    .text            │        94014 │          │                │               │
│ DIRAM               │        48951 │    14.32 │         292809 │        341760 │
│    .text            │        34971 │    10.23 │                │               │
│    .data            │        11700 │     3.42 │                │               │
│    .bss             │         2280 │     0.67 │                │               │
│ Flash Data          │        40516 │          │                │               │
│    .rodata          │        40260 │          │                │               │
│    .appdesc         │          256 │          │                │               │
│ IRAM                │        16384 │    100.0 │              0 │         16384 │
│    .text            │        15356 │    93.73 │                │               │
│    .vectors         │         1028 │     6.27 │                │               │
│ RTC SLOW            │           36 │     0.44 │           8156 │          8192 │
│    .force_slow      │           36 │     0.44 │                │               │
│ RTC FAST            │           24 │     0.29 │           8168 │          8192 │
│    .rtc_reserved    │           24 │     0.29 │                │               │
└─────────────────────┴──────────────┴──────────┴────────────────┴───────────────┘
Total image size: 197621 bytes (.bin may be padded larger)
Note: The reported total sizes may be smaller than those in the technical reference manual due to reserved memory and application configuration. The total flash size available for the application is not included by default, as it cannot be reliably determined due to the presence of other data like the bootloader, partition table, and application partition size.

vscode代码提示

在看.vscode文件夹的内容时,发现settings里面有个idf.espIdfPathWin,这个路径是固定的,但是我window里面没有,到git上再次下载espressif/esp-idf(不是克隆到wsl)然后放到对应目录则有代码相关设置了。

其他

MicroPython

git clone https://github.com/micropython/micropythoncd micropythonmake -C mpy-crosscd ports/unixmake submodulesmake DEBUG=1 -j4 CWARN="-Wno-error=unused-variable"


Reference

Linux 和 macOS 平台工具链的标准设置 - ESP32 - — ESP-IDF 编程指南 v5.5.1 文档

(78 封私信 / 58 条消息) esp32 VScode编译入坑的一些问题解决 - 知乎


 

http://www.dtcms.com/a/609751.html

相关文章:

  • Elasticsearch:如何创建知识库并使用 AI Assistant 来配置连接器
  • Blender学习笔记(04)-- 选中实体的一部分,单独设置颜色
  • 哪个网站做攻略比较好品牌vi设计案例欣赏ppt
  • 珠海市网站建设企业网站编辑给续南明做的封面
  • 国产化Excel开发组件Spire.XLS教程:Python将列表导出为CSV文件(含一维/二维/字典列表)
  • 接口自动化测试框架实战(Pytest+Allure+Excel)
  • 苹果质量检测与分类 - YOLO13结合RFCAConv实现
  • YZ系列工具之YZ09: VBA_Excel之读心术
  • 三芯联动:“通信 + 供电 + 主控”的安全闭环与场景革命
  • EXCEL 数字编码化排序(如部门层级排序)
  • sse,短轮询,长轮询,webSocket
  • 芦笋嫩茎形态分类与识别_YOLO11-C3k2-MambaOut-SFSC模型实现_1
  • 昆明专业网站营销北京工程建设交易平台
  • 衡阳网站搜索引擎优化wordpress如何设水印图片
  • 对Docker部署的MySQL中的数据进行备份恢复
  • AI 时代企业新形态:超级个体与多智能体
  • 夜场酒吧娱乐ktv类企业网站源码网上花店网页制作素材
  • wordpress 微博链接地址南京百度网站快速优化
  • 新操作系统
  • 电商网站html模板介绍公司的简介范文
  • 卡索(CASO)汽车调查:数据智能时代,汽车产业竞争格局与战略升维路径探析
  • 新能源汽车电源环路设计:从PID补偿到数字化控制的落地实践
  • BERT 完整教程指南
  • 陆丰网站宁波微网站建设
  • 如何利用技术手段来甄选一套档案馆库房安全温湿度监控系统
  • undefined symbol: _ZN3c104cuda9SetDeviceEab
  • 工业 4.0 微观基石:整列机赋能精密零件整列,筑牢无人工厂根基
  • EG1164 DC-DC升压型同步整流电源芯片技术解析
  • 【Spring Cloud 整合Nacos和Seata实现分布式事务】
  • LeetCode hot100:4.寻找两个正序数组的中位数 题解分析