0

Esp32-c3在linux环境下使用Arduino的配置方法

 1 year ago
source link: https://scifx.github.io/posts/1662101047/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

首先下载Arduino IDE

然后,打开Arduino IDE,在"工具-开发板管理器"里面搜索esp32下载最新版本,点击安装

在国内,这一步就出问题了。。。

无奈只能手动安装

下面来填个坑

手动安装分析

参考esp32官方手动安装文档

sudo usermod -a -G dialout $USER && \
sudo apt-get install git && \
wget https://bootstrap.pypa.io/get-pip.py && \
sudo python3 get-pip.py && \
sudo pip3 install pyserial && \
mkdir -p ~/Arduino/hardware/espressif && \
cd ~/Arduino/hardware/espressif && \
git clone https://github.com/espressif/arduino-esp32.git esp32 && \
cd esp32/tools && \
python3 get.py

发现一眼命令蛮多还头晕?然而翻译一下,有用的信息其实是

#先安装git(应该不会没有安装吧)
sudo apt-get install git

#用pip安装pyserial(python的串口模块)
sudo pip3 install pyserial

#创建arduino下的开发板模块文件夹
mkdir -p ~/Arduino/hardware/espressif

#进到文件夹里面
cd ~/Arduino/hardware/espressif

#通过git下载,这一步就出问题了。。。。????????????????????
git clone https://github.com/espressif/arduino-esp32.git esp32

#进入到tools文件夹下
cd esp32/tools

#然后运行get.py下载依赖。。。这一步有大问题。。。????????????????
python3 get.py

解决下载问题

下载主仓库

git clone https://github.com/espressif/arduino-esp32.git esp32

直接手动去github下载仓库 https://github.com/espressif/arduino-esp32

  1. 下载完后解压文件
  2. 把文件夹重命名为esp32
  3. 并复制到下面这个文件夹里面
~/Arduino/hardware/espressif

当完成以上步骤,你下载好的文件夹路径应该是

~/Arduino/hardware/espressif/esp32/

下载Tools

esp32/package/package_esp32_index.template.json

按 Ctrl+F 搜索下面文本

x86_64-pc-linux

备注:这个文件是json格式,里面host字段代表系统架构(如果你是其他系统,同理找出host对应的关键字,此处linux就是x86_64-pc-linux)

我发现有7个高亮匹配结果

host后面紧跟的

url:“https://……tar.gz"就是我们需要下载的东西

https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch3/riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch3-linux-amd64.tar.gz

https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch3/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch3-linux-amd64.tar.gz

https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch3/xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-patch3-linux-amd64.tar.gz

https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch3/xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-patch3-linux-amd64.tar.gz

https://github.com/espressif/arduino-esp32/releases/download/2.0.4/esptool-4.2.1-linux.tar.gz

https://github.com/earlephilhower/esp-quick-toolchain/releases/download/3.0.0-gnu12/x86_64-linux-gnu.mklittlefs-c41e51a.200706.tar.gz

https://github.com/igrr/mkspiffs/releases/download/0.2.3/mkspiffs-0.2.3-arduino-esp32-linux64.tar.gz

把这7个url地址全部复制到浏览器

或者FDM下载工具直接下载就好了。

下载完成以后

把它们全部解压到文件夹

esp32/tools/

最后,重启Arduino IDE就配置好了最难搞的部分。


Arduino IDE配置

我买了的板子是9.9元的eps32-c3的简约板

据说没有ch340这个芯片

需要设置烧录模式为DIO:

打开Arduino IDE,菜单依次选择"工具-Flash Mode-DIO”


关于查看板子端口

命令行运行两遍,多出那个就是你板子的

ls /dev/tty*

其实,我用的linux下会自动识别出来,不用自己查


关于Hard resetting via RTS pin…

那是程序上传成功了,并不是错误


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK