ESP8266开发环境搭建(Windows)

ESP8266开发环境搭建

乐鑫官方配置教程
ESP8266官方编程手册

一、下载ESP8266_RTOS_SDK源码

(1)推荐方式

  1. 这里使用了徐宏大佬同步到gitee 的乐鑫仓库,下载速度快一些,先不拉取子模块,git 指令如下:
   git clone https://gitee.com/xuhongv/esp-idf.git
  1. 记事本打开.gitmodules,全部替换为下面内容:
#
# All the relative URL paths are intended to be GitHub ones
# For Espressif's public projects please use '../../espressif/proj', not a '../proj'
#

[submodule "components/esptool_py/esptool"]
	path = components/esptool_py/esptool
	url = https://gitee.com/xuhongv/esptool.git

[submodule "components/bt/controller/lib"]
	path = components/bt/controller/lib
	url = https://gitee.com/xuhongv/esp32-bt-lib.git

[submodule "components/bootloader/subproject/components/micro-ecc/micro-ecc"]
	path = components/bootloader/subproject/components/micro-ecc/micro-ecc
	url = https://gitee.com/xuhongv/micro-ecc.git

[submodule "components/coap/libcoap"]
	path = components/coap/libcoap
	url = https://gitee.com/xuhongv/libcoap.git

[submodule "components/nghttp/nghttp2"]
	path = components/nghttp/nghttp2
	url = https://gitee.com/xuhongv/nghttp2.git

[submodule "components/libsodium/libsodium"]
	path = components/libsodium/libsodium
	url = https://gitee.com/xuhongv/libsodium.git

[submodule "components/spiffs/spiffs"]
	path = components/spiffs/spiffs
	url = https://gitee.com/xuhongv/spiffs.git

[submodule "components/json/cJSON"]
	path = components/json/cJSON
	url = https://gitee.com/xuhongv/cJSON.git

[submodule "components/mbedtls/mbedtls"]
	path = components/mbedtls/mbedtls
	url = https://gitee.com/xuhongv/mbedtls.git

[submodule "components/asio/asio"]
	path = components/asio/asio
	url = https://gitee.com/xuhongv/asio.git

[submodule "components/expat/expat"]
	path = components/expat/expat
	url = https://gitee.com/xuhongv/libexpat.git

[submodule "components/lwip/lwip"]
	path = components/lwip/lwip
	url = https://gitee.com/xuhongv/esp-lwip.git

[submodule "components/mqtt/esp-mqtt"]
	path = components/mqtt/esp-mqtt
	url = https://gitee.com/xuhongv/esp-mqtt.git

[submodule "components/protobuf-c/protobuf-c"]
	path = components/protobuf-c/protobuf-c
	url = https://gitee.com/xuhongv/protobuf-c.git

[submodule "components/unity/unity"]
	path = components/unity/unity
	url = https://gitee.com/xuhongv/Unity.git

[submodule "examples/build_system/cmake/import_lib/main/lib/tinyxml2"]
	path = examples/build_system/cmake/import_lib/main/lib/tinyxml2
	url = https://gitee.com/xuhongv/tinyxml2.git

[submodule "components/bt/host/nimble/nimble"]
	path = components/bt/host/nimble/nimble
	url = https://gitee.com/xuhongv/esp-nimble.git

[submodule "components/cbor/tinycbor"]
	path = components/cbor/tinycbor
	url = https://gitee.com/xuhongv/tinycbor.git

[submodule "components/esp_wifi/lib"]
	path = components/esp_wifi/lib
	url = https://gitee.com/xuhongv/esp32-wifi-lib.git

[submodule "components/tinyusb/tinyusb"]
	path = components/tinyusb/tinyusb
	url = https://gitee.com/xuhongv/tinyusb.git

[submodule "examples/peripherals/secure_element/atecc608_ecdsa/components/esp-cryptoauthlib"]
	path = examples/peripherals/secure_element/atecc608_ecdsa/components/esp-cryptoauthlib
	url = https://gitee.com/xuhongv/esp-cryptoauthlib.git

[submodule "components/cmock/CMock"]
	path = components/cmock/CMock
	url = https://gitee.com/xuhongv/CMock.git
	

  1. 更新子模块,进入ESP8266_RTOS_SDK文件夹下,git指令如下:
git submodule update --init --recursive

(2)官方方式

使用子模块递归方式拉取GitHub仓库,慢的要命,

但还是记录一下,指令如下:

git clone --recursive  https://github.com/espressif/ESP8266_RTOS_SDK.git

二、下载预制编译环境和工具链

  1. 预制编译环境

    下载完成后解压到自定义目录,文件夹名msys32

    https://dl.espressif.com/dl/esp32_win32_msys2_environment_and_esp2020r2_toolchain-20200601.zip

  2. 工具链

    点击下方地址进入,查看Readme,选择适合自己的平台下载

    ESP8266_RTOS_SDK
    在这里插入图片描述
    我下载的是:xtensa-lx106-elf-win32-1.22.0-100-ge567ec7-5.2.0.zip

​ 解压后将xtensa-lx106-elf整个放到\msys32\opt路径下

三、添加工具链路径

找到\msys32\etc\profile.d\esp32_toolchain.sh这个文件,

记事本打开,修改内容,下面是我的路径,需要根据你自己的路径做修改:

# This file was created by ESP-IDF windows_install_prerequisites.sh
# and will be overwritten if that script is run again.

export PATH="$PATH:/opt/xtensa-lx106-elf/bin"
export IDF_PATH="D:/ESP-IDF/msys32/home/William/ESP8266_RTOS_SDK"

四、编译测试

在这里插入图片描述

双击mingw32.exe,第一次打开会初始化home文件夹内容

在这里插入图片描述

ESP8266_RTOS_SDK\examples\复制一个例程出来,编译就行了。

make all

参考链接1

  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值