简记在arduino安装esp32开发板包

发布于:2024-04-27 ⋅ 阅读:(19) ⋅ 点赞:(0)

主要参考来源:http://t.csdnimg.cn/Fuqg9,感谢原博主的文章,原文我有不够详细的地方本文会给出说明。

废话,不用看👇
本人安装时常大概2小时,按理说有离线文件了应该很快,我这2小时属实有点慢了,所以目前仍不确定离线文件是否起了作用
但是我整个安装过程很顺利,一次安装成功了,所以要不要试试自己决定吧,也可以先看原文链接吧。安装过程中最好开一下github加速器,有些东西还是需要联网的。
我没有给出所有安装文件,原因有二,1是我在本文已经说明github高速下载的方法,2是随着版本更新,文件也可能不再适用,希望这篇文章能帮到你。

查开发板json文件网址

在arduino软件内按下图操作进入开发板网址查询页面
在这里插入图片描述
进入网站后按ctrl+F开启搜索框,然后输入espressif,就可以搜索到乐鑫的链接
在这里插入图片描述
现在的网址是https://espressif.github.io/arduino-esp32/package_esp32_index.json,为避免网址更改导致失效,建议自己去查一下。

然后把网址粘贴到第一个图的框里面,能看到我已经粘贴了。粘贴完成后arduino会自动下载这个json文件到这个文件夹下
在这里插入图片描述

手动下载文件

打开这个json文件,然后找到这个位置,下载这个url的文件,当前是https://github.com/espressif/arduino-esp32/releases/download/2.0.15/esp32-2.0.15.zip
在这里插入图片描述

github文件下载方法

插件安装使用

直接把刚才的链接输入浏览器或者下载器即可下载文件,但是由于众所周知的原因,会非常慢,这里推荐一个下载方法
首先安装油猴,装好后去https://greasyfork.org/安装下图的插件
在这里插入图片描述
安装好后,打开github的releases页面的下载文件的地方,就能看见有了变化
在这里插入图片描述
我们只需要从红色的这几个选项里面选一个点击就可以高速下载,非常感谢插件作者,我已经用好久了。

使用插件下载文件

比如刚才我们获取到了文件的具体链接是https://github.com/espressif/arduino-esp32/releases/download/2.0.15/esp32-2.0.15.zip,我们只需要复链接的前面一半,复制到releases就可以了,比如https://github.com/espressif/arduino-esp32/releases,然后在浏览器回车,进入releases页面。

再根据json文件里面的版本和文件名选择下载,就像上图的绿色框部分,我根据版本号是2.0.15查找到具体文件再下载,注意版本号很重要,要严格按照json文件的版本下载,否则可能会导致安装失败。

以后的所有文件下载都是类似,先复制到releases,再根据版本号和文件名下载。

手动下载文件(续)

上面的链接是https://github.com/espressif/arduino-esp32/releases/download/2.0.15/esp32-2.0.15.zip,去下载这个文件。
再从josn文件找刚才最开始的链接下面一部分依赖

         "toolsDependencies": [
            {
              "packager": "esp32",
              "name": "xtensa-esp32-elf-gcc",
              "version": "esp-2021r2-patch5-8.4.0"
            },
            {
              "packager": "esp32",
              "name": "xtensa-esp32s2-elf-gcc",
              "version": "esp-2021r2-patch5-8.4.0"
            },
            {
              "packager": "esp32",
              "name": "xtensa-esp32s3-elf-gcc",
              "version": "esp-2021r2-patch5-8.4.0"
            },
            {
              "packager": "esp32",
              "name": "xtensa-esp-elf-gdb",
              "version": "11.2_20220823"
            },
            {
              "packager": "esp32",
              "name": "riscv32-esp-elf-gcc",
              "version": "esp-2021r2-patch5-8.4.0"
            },
            {
              "packager": "esp32",
              "name": "riscv32-esp-elf-gdb",
              "version": "11.2_20220823"
            },
            {
              "packager": "esp32",
              "name": "openocd-esp32",
              "version": "v0.12.0-esp32-20230921"
            },
            {
              "packager": "esp32",
              "name": "esptool_py",
              "version": "4.5.1"
            },
            {
              "packager": "esp32",
              "name": "mkspiffs",
              "version": "0.2.3"
            },
            {
              "packager": "esp32",
              "name": "mklittlefs",
              "version": "3.0.0-gnu12-dc7f933"
            },
            {
              "packager": "arduino",
              "name": "dfu-util",
              "version": "0.11.0-arduino5"
            }
          ]

根据nameversion去下载文件。下载链接直接在json文件中搜索,比如我要下载"name": "xtensa-esp32-elf-gcc", "version": "esp-2021r2-patch5-8.4.0",我就可以在json文件中按ctrl+F搜索这个名称,能找到对应的链接,比如我的搜索结果是这样
在这里插入图片描述
搜索结果如下
在这里插入图片描述
多看几个注意版本号要严格一致,找到链接https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch5-win64.zip再去下载对应文件按,我是windows10系统,所以只给出windows链接

链接汇总

如果自己懒得一个一个查,我在这里给出我当前的所有链接,不过我仍然建议你自己查,以防版本更新或链接更新导致文件失效。

"toolsDependencies": [
            {
              "packager": "esp32",
              "name": "xtensa-esp32-elf-gcc",
              "version": "esp-2021r2-patch5-8.4.0",
              "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch5-win64.zip",
              "archiveFileName": "xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch5-win64.zip"
            },
            {
              "packager": "esp32",
              "name": "xtensa-esp32s2-elf-gcc",
              "version": "esp-2021r2-patch5-8.4.0",
              "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-patch5-win64.zip",
              "archiveFileName": "xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-patch5-win64.zip"
            },
            {
              "packager": "esp32",
              "name": "xtensa-esp32s3-elf-gcc",
              "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-patch5-win64.zip",
              "archiveFileName": "xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-patch5-win64.zip"
            },
            {
              "packager": "esp32",
            "name": "xtensa-esp-elf-gdb",
              "version": "11.2_20220823",
              "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v11.2_20220823/xtensa-esp-elf-gdb-11.2_20220823-x86_64-w64-mingw32.zip",
              "archiveFileName": "xtensa-esp-elf-gdb-11.2_20220823-x86_64-w64-mingw32.zip"
            },
            {
              "packager": "esp32",
              "name": "riscv32-esp-elf-gcc",
              "version": "esp-2021r2-patch5-8.4.0",
              "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch5-win64.zip",
              "archiveFileName": "riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch5-win64.zip"
            },
            {
              "packager": "esp32",
              "name": "riscv32-esp-elf-gdb",
              "version": "11.2_20220823",
              "url": "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v11.2_20220823/riscv32-esp-elf-gdb-11.2_20220823-x86_64-w64-mingw32.zip",
              "archiveFileName": "riscv32-esp-elf-gdb-11.2_20220823-x86_64-w64-mingw32.zip"
            },
            {
              "packager": "esp32",
              "name": "openocd-esp32",
              "version": "v0.12.0-esp32-20230921",
              "url": "https://github.com/espressif/openocd-esp32/releases/download/v0.12.0-esp32-20230921/openocd-esp32-win32-0.12.0-esp32-20230921.zip",
              "archiveFileName": "openocd-esp32-win32-0.12.0-esp32-20230921.zip"
            },
            {
              "packager": "esp32",
              "name": "esptool_py",
              "version": "4.5.1",
              "url": "https://github.com/espressif/arduino-esp32/releases/download/2.0.7/esptool-v4.5.1-win64.zip",
              "archiveFileName": "esptool-v4.5.1-win64.zip"
            },
            {
              "packager": "esp32",
              "name": "mkspiffs",
              "version": "0.2.3",
              "url": " download/0.2.3/mkspiffs-0.2.3-arduino-esp32-win32.zip",
              "archiveFileName": "mkspiffs-0.2.3-arduino-esp32-win32.zip"
            },
            {
              "packager": "esp32",
              "name": "mklittlefs",
              "version": "3.0.0-gnu12-dc7f933",
              "url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/3.0.0-gnu12/x86_64-w64-mingw32.mklittlefs-c41e51a.200706.zip",
              "archiveFileName": "x86_64-w64-mingw32.mklittlefs-c41e51a.200706.zip"
            },
            {
              "packager": "arduino",
              "name": "dfu-util",
              "version": "0.11.0-arduino5"
            }
          ]

dfu-util这个在json文件没找到链接,在网上也没搜明白这个怎么下载怎么放,我就没下载,最终也安装成功了

下载文件放置与安装开发板

把刚才下载的所有文件都放在C:\Users\用户名\AppData\Local\Arduino15\staging\packages文件夹下,如图
在这里插入图片描述
然后就可以重启一下arduino,然后在左侧开发板直接搜搜esp32,然后下载Espressif的开发板,如图
在这里插入图片描述

安装成功输出信息

Downloading packages
esp32:xtensa-esp32-elf-gcc@esp-2021r2-patch5-8.4.0
esp32:xtensa-esp32s2-elf-gcc@esp-2021r2-patch5-8.4.0
esp32:xtensa-esp32s3-elf-gcc@esp-2021r2-patch5-8.4.0
esp32:xtensa-esp-elf-gdb@11.2_20220823
esp32:riscv32-esp-elf-gcc@esp-2021r2-patch5-8.4.0
esp32:riscv32-esp-elf-gdb@11.2_20220823
esp32:openocd-esp32@v0.12.0-esp32-20230921
esp32:esptool_py@4.5.1
esp32:mkspiffs@0.2.3
esp32:mklittlefs@3.0.0-gnu12-dc7f933
arduino:dfu-util@0.11.0-arduino5
esp32:esp32@2.0.15
Installing esp32:xtensa-esp32-elf-gcc@esp-2021r2-patch5-8.4.0
Configuring tool.
esp32:xtensa-esp32-elf-gcc@esp-2021r2-patch5-8.4.0 installed
Installing esp32:xtensa-esp32s2-elf-gcc@esp-2021r2-patch5-8.4.0
Configuring tool.
esp32:xtensa-esp32s2-elf-gcc@esp-2021r2-patch5-8.4.0 installed
Installing esp32:xtensa-esp32s3-elf-gcc@esp-2021r2-patch5-8.4.0
Configuring tool.
esp32:xtensa-esp32s3-elf-gcc@esp-2021r2-patch5-8.4.0 installed
Installing esp32:xtensa-esp-elf-gdb@11.2_20220823
Configuring tool.
esp32:xtensa-esp-elf-gdb@11.2_20220823 installed
Installing esp32:riscv32-esp-elf-gcc@esp-2021r2-patch5-8.4.0
Configuring tool.
esp32:riscv32-esp-elf-gcc@esp-2021r2-patch5-8.4.0 installed
Installing esp32:riscv32-esp-elf-gdb@11.2_20220823
Configuring tool.
esp32:riscv32-esp-elf-gdb@11.2_20220823 installed
Installing esp32:openocd-esp32@v0.12.0-esp32-20230921
Configuring tool.
esp32:openocd-esp32@v0.12.0-esp32-20230921 installed
Installing esp32:esptool_py@4.5.1
Configuring tool.
esp32:esptool_py@4.5.1 installed
Installing esp32:mkspiffs@0.2.3
Configuring tool.
esp32:mkspiffs@0.2.3 installed
Installing esp32:mklittlefs@3.0.0-gnu12-dc7f933
Configuring tool.
esp32:mklittlefs@3.0.0-gnu12-dc7f933 installed
Installing arduino:dfu-util@0.11.0-arduino5
Configuring tool.
arduino:dfu-util@0.11.0-arduino5 installed
Installing platform esp32:esp32@2.0.15
Configuring platform.
Platform esp32:esp32@2.0.15 installed

在这里插入图片描述

串口输出程序测试

void setup() {  
  // 初始化串行通信,设置波特率为115200  
  Serial.begin(115200); 
  }  
  
void loop() {  
  // 主循环中不执行任何操作,因为这是一个简单示例  
    // 在串行监视器上打印"Hello"  
  Serial.println("Hello world");  
  delay(500);
}

结果,注意串口波特率设置要和程序里写的一致
在这里插入图片描述
工具选项的设置如下
在这里插入图片描述