ESP8266官网
NodeMcu官网
ESP8266 linux环境编译工具链
ESP8266开源编译工具链源码
OSX搭建ESP8266开发环境
OSX搭建ESP8266开发环境2
$ brew tap homebrew/dupes
$ brew install binutils coreutils automake wget gawk libtool help2man gperf gnu-sed --with-default-names grep
$ export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
export PATH=/opt/local/bin:$PATH
export PATH=/opt/local/sbin:$PATH
sudo port -v selfupdate
port install gsed
$ sudo hdiutil create ~/Development/esp-open-sdk.dmg -volname "esp-open-sdk" -size 5g -fs "Case-sensitive HFS+"
$ sudo hdiutil mount ~/Development/esp-open-sdk.dmg
$ cd /Volumes/esp-open-sdk
git clone https://github.com/pfalcon/esp-open-sdk.git --recursive
cd esp-open-sdk
sed -i.bak '1s/^/gettext=\'$'\n/' crosstool-NG/kconfig/Makefile
sed -i.bak -e 's/[[:<:]]sed[[:>:]]/gsed/' Makefile
sed -i.bak -e 's/[[:<:]]awk[[:>:]]/\$(AWK)/' lx106-hal/src/Makefile.am
sed -i.bak 's/AM_PROG_AS/AM_PROG_AS\'$'\nAM_PROG_AR/' lx106-hal/configure.ac
make STANDALONE=n
==编译出错1:==
./ct-ng build
[INFO ] Performing some trivial sanity checks
[INFO ] Build started 20170408.174558
[INFO ] Building environment variables
[INFO ] =================================================================
[INFO ] Retrieving needed toolchain components' tarballs
[ERROR]
[ERROR] >>
[ERROR] >> Build failed in step 'Retrieving needed toolchain components' tarballs'
[ERROR] >> called in step '(top-level)'
[ERROR] >>
[ERROR] >> Error happened in: do_libc_get[scripts/build/libc/newlib.sh@12]
[ERROR] >> called from: main[scripts/crosstool-NG.sh@594]
[ERROR] >>
[ERROR] >> For more info on this error, look at the file: 'build.log'
[ERROR] >> There is a list of known issues, some with workarounds, in:
[ERROR] >> 'share/doc/crosstool-ng/crosstool-ng-1.22.0-60-g37b07f6f-dirty/B - Known issues.txt'
[ERROR]
[ERROR] (elapsed: 5:08.00)
[05:10] / make[2]: *** [build] Error 1
make[1]: *** [_toolchain] Error 2
make: *** [/Volumes/esp-open-sdk/esp-open-sdk/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc] Error 2
分析/Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/build.log定位源码newlib.sh 12行,原因为下载失败
do_libc_get() {
local libc_src="{http://mirrors.kernel.org/sourceware/newlib,
ftp://sourceware.org/pub/newlib}"
if [ "${CT_LIBC_NEWLIB_CUSTOM}" = "y" ]; then
CT_GetCustom "newlib" "${CT_LIBC_VERSION}" \
"${CT_LIBC_NEWLIB_CUSTOM_LOCATION}"
else # ! custom location
if echo ${CT_LIBC_VERSION} |${grep} -q linaro; then
YYMM=`echo ${CT_LIBC_VERSION} |cut -d- -f3 |${sed} -e 's,^..,,'`
CT_GetFile "newlib-${CT_LIBC_VERSION}" ${libc_src} \
https://releases.linaro.org/${YYMM}/components/toolchain/newlib-linaro \
http://cbuild.validation.linaro.org/snapshots
else
CT_GetFile "newlib-${CT_LIBC_VERSION}" ${libc_src} \
http://mirrors.kernel.org/sources.redhat.com/newlib
fi
fi # ! custom location
}
解决方法:去http://mirrors.kernel.org/sourceware/newlib手动下载newlib-2.0.0.tar.gz,放至 /Volumes/esp-open-sdk/esp-open-sdk/crosstool-NG/.build/tarballs目录,再重新执行编译
vim $HOME/.bash_profile
export PATH=$PATH:/esptools/esp-open-sdk/xtensa-lx106-elf/bin
source $HOME/.bash_profile
make COMPILE=gcc
192:dev shenhaibo$ cd /dev
192:dev shenhaibo$ ll tty.*
crw-rw-rw- 1 root wheel 20, 0 4 9 11:02 tty.Bluetooth-Incoming-Port
crw-rw-rw- 1 root wheel 20, 2 4 9 11:04 tty.usbserial
git clone https://github.com/themadinventor/esptool.git
vim $HOME/.bash_profile
export PATH=$PATH:/Users/shenhaibo/Development/ESP6288/esptool
source $HOME/.bash_profile
tar xfvz pyserial-2.7.tar.gz
cd pyserial-2.7
sudo python setup.py install
sudo esptool.py --port /dev/tty.usbserial erase_flash
sudo esptool.py --port /dev/tty.usbserial write_flash -fm dio -fs 32m -ff 40m 0x00000 ~/Desktop/nodemcu_float_0.9.6-dev_20150704.bin
==Gokit3.0 ESP8266是:Flash size 32Mbit-C1: 1024KB+1024KB==
***********************BOOT MODE***********************
download:
Flash size 8Mbit: 512KB+512KB
boot_v1.2+.bin 0x00000
user1.1024.new.2.bin 0x01000
esp_init_data_default.bin 0xfc000 (optional)
blank.bin 0x7e000 & 0xfe000
Flash size 16Mbit: 512KB+512KB
boot_v1.2+.bin 0x00000
user1.1024.new.2.bin 0x01000
esp_init_data_default.bin 0x1fc000 (optional)
blank.bin 0x7e000 & 0x1fe000
Flash size 16Mbit-C1: 1024KB+1024KB
boot_v1.2+.bin 0x00000
user1.2048.new.5.bin 0x01000
esp_init_data_default.bin 0x1fc000 (optional)
blank.bin 0xfe000 & 0x1fe000
Flash size 32Mbit: 512KB+512KB
boot_v1.2+.bin 0x00000
user1.1024.new.2.bin 0x01000
esp_init_data_default.bin 0x3fc000 (optional)
blank.bin 0x7e000 & 0x3fe000
Flash size 32Mbit-C1: 1024KB+1024KB
boot_v1.2+.bin 0x00000
user1.2048.new.5.bin 0x01000
esp_init_data_default.bin 0x3fc000 (optional)
blank.bin 0xfe000 & 0x3fe000
***********************NON-BOOT MODE***********************
download
eagle.flash.bin 0x00000
eagle.irom0text.bin 0x40000
blank.bin
Flash size 4Mbit: not supported
Flash size 8Mbit: 0x7e000 & 0xfe000
Flash size 16Mbit: 0x7e000 & 0x1fe000
Flash size 16Mbit-C1: 0xfe000 & 0x1fe000
Flash size 32Mbit: 0x7e000 & 0x3fe000
Flash size 32Mbit-C1: 0xfe000 & 0x3fe000
esp_init_data_default.bin (optional)
Flash size 8Mbit: 0xfc000
Flash size 16Mbit: 0x1fc000
Flash size 16Mbit-C1: 0x1fc000
Flash size 32Mbit: 0x3fc000
Flash size 32Mbit-C1: 0x3fc000
*NOTICE*:
UPDATE is not supported in non-boot mode
***********************************************************
Update steps
1.Make sure TE(terminal equipment) is in sta or sta+ap mode
ex. AT+CWMODE=3
OK
2.Make sure TE got ip address
ex. AT+CWJAP="ssid","12345678"
OK
AT+CIFSR
192.168.1.134
3.Let's update
ex. AT+CIUPDATE
+CIPUPDATE:1 found server
+CIPUPDATE:2 connect server
+CIPUPDATE:3 got edition
+CIPUPDATE:4 start start
OK
note. If there are mistakes in the updating, then break update and print ERROR.
==如:gokit3_SoC_ESP8266_03000003_2016120711项目==
sudo esptool.py --port /dev/tty.usbserial write_flash -fm dio -fs 32m -ff 40m 0x00000 boot_v1.6.bin
sudo esptool.py --port /dev/tty.usbserial write_flash -fm dio -fs 32m -ff 40m 0x01000 gokit3_SoC_ESP8266_03000003_2016120711
.bin
sudo esptool.py --port /dev/tty.usbserial write_flash -fm dio -fs 32m -ff 40m 0x3fc000 esp_init_data_default.bin
sudo esptool.py --port /dev/tty.usbserial write_flash -fm dio -fs 32m -ff 40m 0x3fe000 blank.bin