如何安装安信可一体化开发环境http://wiki.ai-thinker.com/ai_ide_install
http://pan.baidu.com/s/1skRvR1j
安装过程参考:安装到D盘了
https://blog.csdn.net/wowocpp/article/details/81023015
https://www.espressif.com/zh-hans/support/download/sdks-demos
https://github.com/espressif/ESP8266_RTOS_SDK/releases/tag/v2.0.0
名称为:ESP8266_RTOS_SDK-2.0.0.zip 大小为 6.29M
安信可开发工具清单: http://wiki.ai-thinker.com/tools
文件名字是:flash_download_tools_v3.6.2.2_1.zip
将ESP8266_RTOS_SDK-2.0.0.zip 解压到E盘:
ESP8266的FreeRTOS SDK,采用了SDK和工程文件夹分离的方式,所以我们需要手动创建一个 app 目录。
1. 将 sdk 目录下的 driver_lib 重命名为 app
2. 拷贝 examples/project_template 下的所有文件到刚才的 app 目录(提示覆盖则确认),完成后目录结构如下:
3.将 ESP8266_RTOS_SDK-2.0.0/third_party/makefile 重命名为 makefile.bak ,以防止编译时报错
2.双击 打开AiThinker_IDE.exe
因为分离了sdk和project目录
所以编译之前必须先指定一个 SDK_PATH 和 BIN_PATH
修改 ESP8266_RTOS_SDK/app 目录下的 makefile,添加以下内容
parent_dir:=$(abspath $(shell pwd)/$(lastword $(MAKEFILE_LIST)))
parent_dir:=$(shell dirname $(parent_dir))
parent_dir:=$(shell dirname $(parent_dir))
SDK_PATH= $(parent_dir)
BIN_PATH=$(SDK_PATH)/bin
鼠标选中 ESP8266_RTOS_SDK-2.0.0,点击右键出现菜单:
Build Project :编译项目
Clean Project:清理项目
控制台输出如下图即编译成功
!!!
SDK_PATH: /cygdrive/e/ESP8266_RTOS_SDK-2.0.0
BIN_PATH: /cygdrive/e/ESP8266_RTOS_SDK-2.0.0/bin
No boot needed.
Generate eagle.flash.bin and eagle.irom0text.bin successully in BIN_PATH
eagle.flash.bin-------->0x00000
eagle.irom0text.bin---->0x20000
!!!
make[1]: Leaving directory '/cygdrive/e/ESP8266_RTOS_SDK-2.0.0/app'
10:08:52 Build Finished (took 13s.565ms)
现在生成的固件是不支持OTA,通过无线连接自我更新固件。
由于是使用的NodeMCU 4M字节的Flash
修改一下文件 E:\ESP8266_RTOS_SDK-2.0.0\Makefile
启动ESPFlashDownloadTool_v3.6.2.2.exe
代码:E:\ESP8266_RTOS_SDK-2.0.0\app\user\user_main.c
void user_init(void)
{
printf("SDK 123 version:%s\n", system_get_sdk_version());
}
由于是使用的NodeMCU 4M字节的Flash
修改一下文件 E:\ESP8266_RTOS_SDK-2.0.0\Makefile
然后clean project ,然后build project
编译的log 如下:
!!!
SDK_PATH: /cygdrive/e/ESP8266_RTOS_SDK-2.0.0
BIN_PATH: /cygdrive/e/ESP8266_RTOS_SDK-2.0.0/bin/upgrade
bin crc: 29c69a33
Support boot_v1.2 and +
Generate user1.4096.new.4.bin successully in BIN_PATH
boot.bin------------>0x00000
user1.4096.new.4.bin--->0x01000
!!!
make[1]: Leaving directory '/cygdrive/e/ESP8266_RTOS_SDK-2.0.0/app'
16:46:15 Build Finished (took 10s.812ms)
程序运行的log:
ets Jan 8 2013,rst cause:2, boot mode:(3,7)
load 0x40100000, len 2592, room 16
tail 0
chksum 0xf3
load 0x3ffe8000, len 764, room 8
tail 4
chksum 0x92
load 0x3ffe82fc, len 676, room 4
tail 0
chksum 0x22
csum 0x22
2nd boot version : 1.7(5d6f877)
SPI Speed : 40MHz
SPI Mode : DOUT
SPI Flash Size & Map: 32Mbit(512KB+512KB)
jump to run user1 @ 1000
OS SDK ver: 2.0.0(e271380) compiled @ Mar 30 2018 18:54:06
phy ver: 1055_1, pp ver: 10.7
rf cal sector: 1019
tcpip_task_hdl : 40107a00, prio:10,stack:512
idle_task_hdl : 40107ab0,prio:0, stack:384
tim_task_hdl : 40107bf8, prio:2,stack:512
SDK 666 version:2.0.0(e271380)
mode : softAP(86:f3:eb:53:49:bb)
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
add if1
bcn 100
代码修改:
void user_init(void)
{
printf("SDK 666 version:%s\n", system_get_sdk_version());
}
参考文档:
ESP8266 RTOS SDK编程手册 版本1.5
https://www.espressif.com/sites/default/files/documentation/20a-esp8266_rtos_sdk_programming_guide_cn.pdf
void user_init(void)
{
printf("SDK 777 version:%s\n", system_get_sdk_version());
printf("ESP8266 chip ID:0x%x\n", system_get_chip_id());
}
只要需要将目录E:\ESP8266_RTOS_SDK-2.0.0\examples\中的工程拷贝到 和app一个层级,在build project 的时候,就会自动的编译该example,
比如,将目录E:\ESP8266_RTOS_SDK-2.0.0\examples\wifi_station_machine_demo
复制到:
E:\ESP8266_RTOS_SDK-2.0.0\下面:
进入目录:
E:\ESP8266_RTOS_SDK-2.0.0\wifi_station_machine_demo
在eclipse 里面 刷新一下:
内容为:
parent_dir:=$(abspath $(shell pwd)/$(lastword $(MAKEFILE_LIST)))
parent_dir:=$(shell dirname $(parent_dir))
parent_dir:=$(shell dirname $(parent_dir))
SDK_PATH= $(parent_dir)
BIN_PATH=$(SDK_PATH)/bin
编译的log:
!!!
SDK_PATH: /cygdrive/e/ESP8266_RTOS_SDK-2.0.0
BIN_PATH: /cygdrive/e/ESP8266_RTOS_SDK-2.0.0/bin/upgrade
bin crc: 7a2dda16
Support boot_v1.2 and +
Generate user1.4096.new.4.bin successully in BIN_PATH
boot.bin------------>0x00000
user1.4096.new.4.bin--->0x01000
!!!
make[1]: Leaving directory '/cygdrive/e/ESP8266_RTOS_SDK-2.0.0/wifi_station_machine_demo'
18:23:18 Build Finished (took 13s.580ms)
注意:
如果在E:\ESP8266_RTOS_SDK-2.0.0\目录下面 如果同时存在app 目录和wifi_station_machine_demo目录,
那么两者都会编译,然后生成的bin文件都会存放在E:\ESP8266_RTOS_SDK-2.0.0\bin目录下,这样会互相覆盖。
可以修改为:
BIN_PATH=$(shell pwd)/bin
parent_dir:=$(abspath $(shell pwd)/$(lastword $(MAKEFILE_LIST)))
parent_dir:=$(shell dirname $(parent_dir))
parent_dir:=$(shell dirname $(parent_dir))
SDK_PATH= $(parent_dir)
BIN_PATH=$(shell pwd)/bin
这样log如下:
注意:BIN_PATH
!!!
SDK_PATH: /cygdrive/e/ESP8266_RTOS_SDK-2.0.0
BIN_PATH: /cygdrive/e/ESP8266_RTOS_SDK-2.0.0/wifi_station_machine_demo/bin/upgrade
bin crc: 7a2dda16
Support boot_v1.2 and +
Generate user1.4096.new.4.bin successully in BIN_PATH
boot.bin------------>0x00000
user1.4096.new.4.bin--->0x01000
!!!
make[1]: Leaving directory '/cygdrive/e/ESP8266_RTOS_SDK-2.0.0/wifi_station_machine_demo'
主要是设置SDK_PATH 和BIN_PATH ,然后通过eclipse 导入:
怎么设置include文件 和库文件呢,需要研究一下。
用到的 Makefile 修改方法:
parent_dir:=$(abspath $(shell pwd)/$(lastword $(MAKEFILE_LIST)))
parent_dir:=$(shell dirname $(parent_dir))
parent_dir:=$(shell dirname $(parent_dir))
SDK_PATH=/cygdrive/e/ESP8266_RTOS_SDK-2.0.0
BIN_PATH=$(shell pwd)/bin
参考网页:
http://wiki.ai-thinker.com/ai_ide_install
https://blog.csdn.net/wowocpp/article/details/81384090
export BIN_PATH=/cygdrive/e/esp8266/sdk/ESP8266_RTOS_SDK-2.0.0/bin
export SDK_PATH=/cygdrive/e/esp8266/sdk/ESP8266_RTOS_SDK-2.0.0
在弹出的窗口直接敲命令。
ls
cd app
ls
./gen_misc.sh
2018-08-04 ,欢迎交流学习