esp8266&nodemcu编译 firmware in osx

$ xcode-select --install


$ brew tap homebrew/dupes
$ brew install binutils coreutils autoconf automake wget gawk libtool gperf gnu-sed --with-default-names grep bison libvorbis
$ export PATH=/usr/local/opt/gnu-sed/libexec/gnubin:/usr/local/opt/gperf/bin:$PATH


Download and install macports   https://www.macports.org/install.php


$ sudo port install git gsed gawk binutils gperf grep gettext py-serial wget libtool autoconf automake


製作一個 "case-sensitive"(可區分大小寫檔名)的虛擬磁碟,大小是 8GB:
$ hdiutil create ./eos.dmg -volname "esp-open-sdk" -size 8g -fs "Case-sensitive HFS+"


將 ESP8266 Open SDK 下載至此虛擬磁碟:


$ hdiutil mount ./eos.dmg
$ cd /Volumes/esp-open-sdk
$ git clone --recursive https://github.com/pfalcon/esp-open-sdk.git
$ cd eos-open-sdk


編譯 "separated SDK":


$ make STANDALONE=n    如果不行就用$ make STANDALONE=y


根據畫面提示,修改 PATH 環境變數:


$ export PATH=/Volumes/ESPTools/esp-open-sdk/xtensa-lx106-elf/bin:$PATH




編譯 NodeMCU Firmware
這裡提供一份事先編譯好的 NodeMCU firmware,可至node-wot下載。再依照以下說明,將 0x00000.bin 與 0x10000.bin 檔案燒錄至 NodeMCU 即可。


先安裝 pyserial 套件:


$ git clone https://github.com/pyserial/pyserial.git
$ cd pyserial/
$ sudo python setup.py install
下載 NodeMCU firmware 原始碼:


$ git clone https://github.com/nodemcu/nodemcu-firmware
編輯 app/include/user_config.h 檔案,將以下這一行的註解移除:


#define DEVKIT_VERSION_0_9 1
完成後開始編譯:


$ make
編譯完成後,得到以下二個檔案:


bin/0x00000.bin
bin/0x10000.bin
將以上二個檔案燒錄至 NodeMCU 更新即可。在 Linux 環境編譯 NodeMCU firmware,請另行參考這篇文章(#1)說明。


删除以前的firemware
esptool.py --port /dev/cu.SLAB_USBtoUART erase_flash


更新 NodeMCU Firmware
使用 NodeMCU firmware 的 esptool.py 工具,將編譯好的 firmware 檔案,下載至 NodeMCU。在 Mac 下使用 esptool.py 更新 NodeMCU firmware 時,需額外加上 -fm 與 -fs 二個參數:


$ cd /Volumes/esp-open-sdk/nodemcu-firmware
$ ./tools/esptool.py --port /dev/cu.SLAB_USBtoUART write_flash -fm=dio -fs=32m 0x00000 bin/0x00000.bin 0x10000 bin/0x10000.bin
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值