一、 下载
SDK(这里不用):
跳转到github
https://github.com/espressif/ESP8266_RTOS_SDK/releases
安信可SDK:
git clone --recursive https://gitee.com/xuhongv/AiThinkerProjectForESP.git
二、 安装AiThinkerIDE_V1.5.2
https://docs.ai-thinker.com/%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B72
只需要装一个AiThinkerIDE_V1.5.2.exe
删除PC里的Python环境变量,AiThinkerIDE_V1.5.2里面有Python
导入安信可SDK,AiThinkerProjectForESP
设置环境变量
CWD: //工程导入自动生成,实际工程地址
D:\ESP\demo\get-started\hello_world\
IDF_PATH: //SDK地址
E:\usr_sdk\AiThinkerProjectForESP
PATH: //IDE相关环境变量
e:\AiThinkerIDE_V1.5.2\msys32\mingw32\bin;E:\AiThinkerIDE_V1.5.2\msys32\opt\esp8266\v5.2.0_for_3.0\bin;e:\AiThinkerIDE_V1.5.2\msys32\usr\bin;
PWD: //工程导入自动生成,实际工程地址
D:\ESP\demo\get-started\hello_world\
每条环境变量的作用:
make: python: Command not found
e:\AiThinkerIDE_V1.5.2\msys32\mingw32\bin;
Error: Program “make” not found in PATH
e:\AiThinkerIDE_V1.5.2\msys32\usr\bin;
make: xtensa-lx106-elf-gcc: Command not found
E:\AiThinkerIDE_V1.5.2\msys32\opt\esp8266\v5.2.0_for_3.0\bin;
${workspace_loc:/AiThinkerProjectForESP}/examples/get-started/hello_world
此处更改,会自动更改上文中的CWD、PWD
设置编译面板
mintty.exe -e make menuconfig
编译:
删除PC里的环境变量后,不影响编译
make all
------------------------------------------------------------------------
------ --------
------ Welcome To AiThinker IDE V1.5 --------
------ Git Commit: a6fb921b38d6a2da582b2a1dd54acdcac66095f7 --------
------ SDK Version: v3.2-442-ga6fb921b-dirty --------
------ --------
------------------------------------------------------------------------
Toolchain version: crosstool-ng-1.22.0-100-ge567ec7b
Compiler version: 5.2.0
Python requirements from E:/usr_sdk/AiThinkerProjectForESP\requirements.txt are satisfied.
App "hello-world" version: e5ec3b46-dirty
CXX /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wear_levelling/WL_Ext_Safe.o
CXX /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wear_levelling/crc32.o
CXX /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wear_levelling/WL_Flash.o
CXX /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wear_levelling/wear_levelling.o
AR /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wear_levelling/libwear_levelling.a
AR /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wifi_provisioning/libwifi_provisioning.a
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/crypto/ms_funcs.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/crypto/crypto_internal-cipher.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/crypto/crypto_internal-modexp.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/crypto/bignum.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/crypto/sha1-pbkdf2.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/crypto/aes-cbc.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/crypto/md5.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/crypto/rc4.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/crypto/sha256.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/crypto/dh_groups.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/crypto/md4-internal.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/crypto/sha1-internal.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/crypto/aes-wrap.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/crypto/crypto_internal.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/crypto/dh_group5.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/crypto/des-internal.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/crypto/crypto_internal-rsa.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/crypto/aes-unwrap.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/crypto/aes-internal-dec.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/crypto/sha1.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/crypto/aes-internal.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/crypto/md5-internal.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/crypto/sha256-internal.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/crypto/aes-internal-enc.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wps/wps_enrollee.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wps/uuid.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wps/wps_attr_build.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wps/wps_registrar.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wps/wps_common.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wps/wps.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wps/wps_dev_attr.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wps/wps_attr_parse.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wps/wps_validate.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wps/wps_attr_process.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wps/eap_common.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/fast_crypto/fast_crypto_internal-cipher.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/fast_crypto/fast_crypto_internal-modexp.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/fast_crypto/fast_aes-unwrap.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/fast_crypto/fast_sha256.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/fast_crypto/fast_crypto_internal.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/fast_crypto/fast_aes-cbc.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/fast_crypto/fast_sha256-internal.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/fast_crypto/fast_aes-wrap.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/eap_peer/eap_peap_common.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/eap_peer/chap.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/eap_peer/eap_mschapv2.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/eap_peer/eap_peap.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/eap_peer/eap_ttls.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/eap_peer/eap_tls_common.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/eap_peer/eap_tls.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/eap_peer/mschapv2.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/eap_peer/eap_common.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/eap_peer/eap.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/tls/tls_internal.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/tls/tlsv1_common.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/tls/tlsv1_server_write.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/tls/bignum.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/tls/tlsv1_record.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/tls/pkcs5.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/tls/pkcs1.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/tls/tlsv1_client_write.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/tls/tlsv1_server_read.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/tls/asn1.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/tls/pkcs8.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/tls/rsa.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/tls/tlsv1_client.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/tls/tlsv1_client_read.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/tls/tlsv1_cred.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/tls/x509v3.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/tls/tlsv1_server.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/utils/ext_password.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/wpa2/utils/base64.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/src/fast_crypto_ops.o
CC /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/port/os_xtensa.o
AR /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/wpa_supplicant/libwpa_supplicant.a
Generating esp8266.project.ld
LD /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/hello-world.elf
esptool.py v2.4.0
To flash all build output, run 'make flash' or:
python /e/usr_sdk/AiThinkerProjectForESP/components/esptool_py/esptool/esptool.py --chip esp8266 --port /COM6 --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size 2MB 0x0 /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/bootloader/bootloader.bin 0x10000 /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/hello-world.bin 0x8000 /e/usr_sdk/AiThinkerProjectForESP/examples/get-started/hello_world/build/partitions_singleapp.bin
固件下载设置
make flash ESPPORT=COM6
make flash ESPPORT=COM6
------------------------------------------------------------------------
------ --------
------ Welcome To AiThinker IDE V1.5 --------
------ Git Commit: a6fb921b38d6a2da582b2a1dd54acdcac66095f7 --------
------ SDK Version: v3.2-442-ga6fb921b-dirty --------
------ --------
------------------------------------------------------------------------
Toolchain version: crosstool-ng-1.22.0-100-ge567ec7b
Compiler version: 5.2.0
Python requirements from E:/usr_sdk/AiThinkerProjectForESP\requirements.txt are satisfied.
App "hello-world" version: e5ec3b46-dirty
Flashing binaries to serial port COM6 (app at offset 0x10000)...
esptool.py v2.4.0
Connecting....
Chip is ESP8266EX
Features: WiFi
MAC: cc:7b:5c:4a:28:b6
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Compressed 10496 bytes to 7057...
Writing at 0x00000000... (100 %)
Wrote 10496 bytes (7057 compressed) at 0x00000000 in 0.6 seconds (effective 134.4 kbit/s)...
Hash of data verified.
Compressed 195088 bytes to 132656...
Writing at 0x00010000... (11 %)
Writing at 0x00014000... (22 %)
Writing at 0x00018000... (33 %)
Writing at 0x0001c000... (44 %)
Writing at 0x00020000... (55 %)
Writing at 0x00024000... (66 %)
Writing at 0x00028000... (77 %)
Writing at 0x0002c000... (88 %)
Writing at 0x00030000... (100 %)
Wrote 195088 bytes (132656 compressed) at 0x00010000 in 11.7 seconds (effective 133.5 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 83...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (83 compressed) at 0x00008000 in 0.0 seconds (effective 1866.8 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
注:
如果把SDK换成乐鑫ESP8266_RTOS_SDK-3.4
IDF_PATH直接使用github上release版的SDK,E:\usr_sdk\ESP8266_RTOS_SDK-3.4,编译
make all
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
Toolchain path: /opt/esp8266/v5.2.0_for_3.0/bin/xtensa-lx106-elf-gcc
WARNING: Toolchain version is not supported: crosstool-ng-1.22.0-100-ge567ec7b
Expected to see version: esp-2020r3-49-gd5524c1
Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.
WARNING: Compiler version is not supported: 5.2.0
Expected to see version(s): 8.4.0
Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.
Python requirements from E:/usr_sdk/ESP8266_RTOS_SDK-3.4\requirements.txt are satisfied.
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
WARNING: Toolchain version is not supported: crosstool-ng-1.22.0-100-ge567ec7b
Expected to see version: esp-2020r3-49-gd5524c1
Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.
WARNING: Compiler version is not supported: 5.2.0
Expected to see version(s): 8.4.0
Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.
CC build/bootloader/main/bootloader_start.o
AR build/bootloader/main/libmain.a
CC build/bootloader/bootloader_support/src/bootloader_random.o
CC build/bootloader/bootloader_support/src/flash_encrypt.o
CC build/bootloader/bootloader_support/src/bootloader_sha.o
CC build/bootloader/bootloader_support/src/esp_image_format.o
CC build/bootloader/bootloader_support/src/flash_partitions.o
CC build/bootloader/bootloader_support/src/secure_boot_signatures.o
CC build/bootloader/bootloader_support/src/bootloader_clock.o
CC build/bootloader/bootloader_support/src/secure_boot.o
CC build/bootloader/bootloader_support/src/bootloader_common.o
CC build/bootloader/bootloader_support/src/bootloader_utility.o
CC build/bootloader/bootloader_support/src/bootloader_init.o
E:/usr_sdk/ESP8266_RTOS_SDK-3.4/components/bootloader_support/src/bootloader_init.c: In function 'uart_console_configure':
E:/usr_sdk/ESP8266_RTOS_SDK-3.4/components/bootloader_support/src/bootloader_init.c:556:39: error: 'CONFIG_ESP8266_XTAL_FREQ' undeclared (first use in this function)
#define BOOTLOADER_CONSOLE_CLK_FREQ ((CONFIG_ESP8266_XTAL_FREQ * 2) * 1000 * 1000)
^
E:/usr_sdk/ESP8266_RTOS_SDK-3.4/components/bootloader_support/src/bootloader_init.c:628:50: note: in expansion of macro 'BOOTLOADER_CONSOLE_CLK_FREQ'
uart_div_modify(CONFIG_ESP_CONSOLE_UART_NUM, BOOTLOADER_CONSOLE_CLK_FREQ / CONFIG_ESP_CONSOLE_UART_BAUDRATE);
^
E:/usr_sdk/ESP8266_RTOS_SDK-3.4/components/bootloader_support/src/bootloader_init.c:556:39: note: each undeclared identifier is reported only once for each function it appears in
#define BOOTLOADER_CONSOLE_CLK_FREQ ((CONFIG_ESP8266_XTAL_FREQ * 2) * 1000 * 1000)
^
E:/usr_sdk/ESP8266_RTOS_SDK-3.4/components/bootloader_support/src/bootloader_init.c:628:50: note: in expansion of macro 'BOOTLOADER_CONSOLE_CLK_FREQ'
uart_div_modify(CONFIG_ESP_CONSOLE_UART_NUM, BOOTLOADER_CONSOLE_CLK_FREQ / CONFIG_ESP_CONSOLE_UART_BAUDRATE);
^
E:/usr_sdk/ESP8266_RTOS_SDK-3.4/components/bootloader_support/src/bootloader_init.c: At top level:
cc1.exe: warning: unrecognized command line option '-Wno-frame-address'
make[2]: *** [/e/usr_sdk/ESP8266_RTOS_SDK-3.4/make/component_wrapper.mk:292: src/bootloader_init.o] Error 1
make[1]: *** [/e/usr_sdk/ESP8266_RTOS_SDK-3.4/make/project.mk:571: component-bootloader_support-build] Error 2
make: *** [/e/usr_sdk/ESP8266_RTOS_SDK-3.4/components/bootloader/Makefile.projbuild:40: /e/usr_sdk/ESP8266_RTOS_SDK-3.4/examples/get-started/hello_world/build/bootloader/bootloader.bin] Error 2
后记:
上面的/COM6改为COM6
make flash ESPPORT=COM6,也可以改为make flash