您尚未登录。

楼主 #1 2018-03-08 17:39:42

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

ESP8266 Windows 入坑记录

参考链接: setup-windows-compiler-esp8266

1. 下载git

2. 下载windows 版本工具链: xtensa-lx106-elf.7z

3. 下载esp8266 sdk: git clone https://github.com/espressif/ESP8266_RTOS_SDK.git

4. 设置环境变量:
在命令行手动设置:

export SDK_PATH=/c/projects/ESP8266_RTOS_SDK/
export BIN_PATH=/c/projects/outputs

也可以在Windows系统设置里面搞定。

5. 切换到 E:\ESP8266_RTOS_SDK\examples\spiffs_test, 执行 gen_misc.sh

6. esptool.py python脚本命令行烧录

擦除:

$ esptool.py --port COM8 erase_flash
esptool.py v2.1
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 7.0s
Hard resetting...

烧录单个文件:

$ esptool.py --port COM8 write_flash 0x00000 eagle.flash.bin
esptool.py v2.1
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0040
Compressed 33152 bytes to 23259...
Wrote 33152 bytes (23259 compressed) at 0x00000000 in 2.1 seconds (effective 128.8 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting...

烧录多个文件:

$ esptool.py --port COM8 write_flash 0x00000 eagle.flash.bin 0x20000 eagle.irom0text.bin
esptool.py v2.1
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0040
Compressed 33152 bytes to 23259...
Wrote 33152 bytes (23259 compressed) at 0x00000000 in 2.1 seconds (effective 128.7 kbit/s)...
Hash of data verified.
Compressed 304124 bytes to 216106...
Wrote 304124 bytes (216106 compressed) at 0x00020000 in 19.0 seconds (effective 127.8 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting...

读mac地址:

$ esptool.py --port COM8 read_mac
esptool.py v2.1
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266
Uploading stub...
Running stub...
Stub running...
MAC: 2c:3a:e8:42:b8:a8
Hard resetting...

读flash id:

$ esptool.py --port COM8 flash_id
esptool.py v2.1
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266
Uploading stub...
Running stub...
Stub running...
Manufacturer: 20
Device: 4016
Detected flash size: 4MB
Hard resetting...





离线

楼主 #2 2018-03-08 17:45:30

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: ESP8266 Windows 入坑记录

QQ20180308205434.png

设置环境变量并运行。





离线

楼主 #3 2018-03-08 17:45:35

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: ESP8266 Windows 入坑记录

占位





离线

楼主 #4 2018-03-08 17:46:21

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: ESP8266 Windows 入坑记录

执行 gen_misc.sh 出现了这个链接错误:

D:\Downloads\xtensa-lx106-elf\bin\xtensa-lx106-elf-ar.exe: creating .output/eagle/debug/lib/libuser.a
make[1]: 离开目录“/e/ESP8266_RTOS_SDK/examples/spiffs_test/user”
xtensa-lx106-elf-gcc  -LE:/ESP8266_RTOS_SDK/lib -Wl,--gc-sections -nostdlib -TE:/ESP8266_RTOS_SDK/ld/eagle.app.v6.ld -Wl,--no-check-sections -u call_user_start -Wl,-static -Wl,--start-group -lcirom -lgcc -lhal -lphy -lpp -lnet80211 -lwpa -lcrypto -lmain -lfreertos -llwip -lssc -lspiffs user/.output/eagle/debug/lib/libuser.a -Wl,--end-group -o .output/eagle/debug/image/eagle.app.v6.out
d:/downloads/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: cannot find -lhal
collect2.exe: error: ld returned 1 exit status
make: *** [E:/ESP8266_RTOS_SDK/Makefile:404:.output/eagle/debug/image/eagle.app.v6.out] 错误 1

出现了这个错误。





离线

楼主 #5 2018-03-08 17:53:35

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: ESP8266 Windows 入坑记录

这里下载libhal.a, libc.a: https://github.com/esp8266/esp8266-wiki/tree/master/libs


粘贴到: xtensa-lx106-elf\xtensa-lx106-elf\lib

然后顺利编译链接成功:

xtensa-lx106-elf-gcc  -LE:/ESP8266_RTOS_SDK/lib -Wl,--gc-sections -nostdlib -TE:/ESP8266_RTOS_SDK/ld/eagle.app.v6.ld -Wl,--no-check-sections -u call_user_start -Wl,-static -Wl,--start-group -lcirom -lgcc -lhal -lphy -lpp -lnet80211 -lwpa -lcrypto -lmain -lfreertos -llwip -lssc -lspiffs user/.output/eagle/debug/lib/libuser.a -Wl,--end-group -o .output/eagle/debug/image/eagle.app.v6.out

!!!
SDK_PATH: E:/ESP8266_RTOS_SDK
BIN_PATH: E:/ESP8266_RTOS_SDK/output

No boot needed.
Generate eagle.flash.bin and eagle.irom0text.bin successully in BIN_PATH
eagle.flash.bin-------->0x00000
eagle.irom0text.bin---->0x20000





离线

#6 2018-03-08 18:24:10

zhuacai
会员
注册时间: 2017-12-16
已发帖子: 234
积分: 233.5

Re: ESP8266 Windows 入坑记录

晕哥,有esp8266驱动wm8978的代码吗

离线

楼主 #7 2018-03-08 19:39:12

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: ESP8266 Windows 入坑记录

zhuacai 说:

晕哥,有esp8266驱动wm8978的代码吗

我看到网上有esp8266驱动i2s代码, 改成wm8978问题不大。





离线

#8 2018-03-18 17:06:47

lvjun0728
会员
注册时间: 2018-03-18
已发帖子: 15
积分: 10

Re: ESP8266 Windows 入坑记录

路过看看,,,

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn