参考链接: 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...
离线
执行 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
出现了这个错误。
离线
这里下载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/outputNo boot needed.
Generate eagle.flash.bin and eagle.irom0text.bin successully in BIN_PATH
eagle.flash.bin-------->0x00000
eagle.irom0text.bin---->0x20000
离线
晕哥,有esp8266驱动wm8978的代码吗
离线
路过看看,,,
离线