製作 MicroPython Test @WiFiBoy(esp8266)

動機:可否在 WiFiBoy(esp8266) 玩 MicroPython Test 並顯示於 1.8" TFT LCD(128x160)上?!

準備環境
1.WiFiBoy(需連接USB數據線)
2.MacBook筆電
3.於Windows 10筆電安裝Oracle VM VirtualBox 5.2.4 及建立 Ubuntu 16.04虛擬機器

實作步驟
一、於Ubuntu VM平台:
1.首先,依據網頁 https://github.com/pfalcon/esp-open-sdk 指示安裝 esp sdk 所需軟體...( 請以root權限 sudo -s )
sudo apt-get install make unrar-free autoconf automake libtool gcc g++ gperf flex bison texinfo gawk ncurses-dev libexpat-dev python-dev python python-serial sed git unzip bash help2man wget bzip2
sudo apt-get install libtool-bin

2.接著,下載並構建sdk...
git clone --recursive https://github.com/pfalcon/esp-open-sdk.git
make STANDALONE=y
畫面,如下圖

此時,若有問題,可試試以下指令...
$ make clean
$ git pull
$ git submodule sync
$ git submodule update --init

記得要將PATH加入...
# export PATH=/home/davis/esp-open-sdk/xtensa-lx106-elf/bin:$PATH
也可以加入 ~/.bashrc 自動載入

3.接下來,依據網頁 https://github.com/dpgeorge/micropython 安裝 micropython
# git clone https://github.com/dpgeorge/micropython.git
# cd micropython
# git submodule update --init
# cd ports/unix
# make axtls
# make

完成後,即可測試,如下圖

4.接著,就是重點了,在 micropython for esp8266中加入 賴'r 自行開發的 wifiboy.c 模組程式,
依據 參攷6. 修改 ports/esp8266 中的 Makefile 如下(在 SRC_C 宣告):

再來是 make,如下:
# make axtls

# make
產生了許多錯誤,如下圖

5.由於需要 賴'r 的 .c, .h (8個)的源碼檔案,加上其行程匆忙,只好暫時停止執行...

二、於MacBook平台:
上述步驟大致相同,僅於 esp sdk 中略有不同,如下:
$ 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"

MacOS needs a case-sensitive filesystem
$ sudo hdiutil create ~/Documents/case-sensitive.dmg -volname "case-sensitive" -size 10g -fs "Case-sensitive HFS+"
$ sudo hdiutil mount ~/Documents/case-sensitive.dmg
$ cd /Volumes/case-sensitive


後記
在 MacOS 及 Ubuntu 平台,可以使用 ESPlorer Integrated Development Environment (IDE) for ESP8266 來開發,如下圖



參攷
1.WiFiBoy MicroPython Test (ESP-8266), https://www.youtube.com/watch?v=vuh_16WAUWI
2.micropython/micropython, https://github.com/micropython/micropython
3.dpgeorge/micropython, https://github.com/dpgeorge/micropython
4.Building from Source Code on Linux and Mac OSX, https://github.com/scantailor/scantailor/wiki/Building-from-Source-Code-on-Linux-and-Mac-OS-X
5.ESP8266 MAC(OSX)开发环境搭建, http://blog.csdn.net/ayst_shen/article/details/70172957
6.Adding a Module, http://micropython-dev-docs.readthedocs.io/en/latest/adding-module.html
7.pfalcon/esp-open-sdk, https://github.com/pfalcon/esp-open-sdk

留言