サンプルをコンパイルしてみる
いよいよコンパイルを行うことにします。
まずは、SDKをダウンロードします。Espressifのサポートページで検索して、最新のNon OS SDKをGitHubからダウンロードします。執筆時点では、Ver. 2.2.0でした。
$ wget -O ESP8266_NOOSSDK_V2.2.0.zip https://github.com/espressif/ESP8266_NONOS_SDK/archive/v2.2.0.zip ↵ --2018-04-11 18:55:20-- https://github.com/espressif/ESP8266_NONOS_SDK/archive/v2.2.0.zip Resolving github.com (github.com)... 192.30.255.112, 192.30.255.113 Connecting to github.com (github.com)|192.30.255.112|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://codeload.github.com/espressif/ESP8266_NONOS_SDK/zip/v2.2.0 [following] --2018-04-11 18:55:20-- https://codeload.github.com/espressif/ESP8266_NONOS_SDK/zip/v2.2.0 Resolving codeload.github.com (codeload.github.com)... 192.30.255.121, 192.30.255.120 Connecting to codeload.github.com (codeload.github.com)|192.30.255.121|:443... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified [application/zip] Saving to: ‘ESP8266_NOOSSDK_V2.2.0.zip’ ESP8266_NOOSSDK_V2.2.0.zip [ <=> ] 6.48M 233KB/s in 47s 2018-04-11 18:56:08 (140 KB/s) - ‘ESP8266_NOOSSDK_V2.2.0.zip’ saved [6790267]
次に、ヘッダファイルをダウンロードします。
$ wget -O include.tgz https://github.com/esp8266/esp8266-wiki/raw/master/include.tgz ↵ --2018-04-11 18:56:45-- https://github.com/esp8266/esp8266-wiki/raw/master/include.tgz Resolving github.com (github.com)... 192.30.255.113, 192.30.255.112 Connecting to github.com (github.com)|192.30.255.113|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://raw.githubusercontent.com/esp8266/esp8266-wiki/master/include.tgz [following] --2018-04-11 18:56:46-- https://raw.githubusercontent.com/esp8266/esp8266-wiki/master/include.tgz Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.72.133 Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.72.133|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 979111 (956K) [application/octet-stream] Saving to: ‘include.tgz’ include.tgz 100%[=================================================>] 956.16K 2.90MB/s in 0.3s 2018-04-11 18:56:47 (2.90 MB/s) - ‘include.tgz’ saved [979111/979111]
続いて、ライブラリをダウンロードします。
$ wget -O libhal.a https://github.com/esp8266/esp8266-wiki/raw/master/libs/libhal.a ↵ --2018-04-11 18:57:36-- https://github.com/esp8266/esp8266-wiki/raw/master/libs/libhal.a Resolving github.com (github.com)... 192.30.255.113, 192.30.255.112 Connecting to github.com (github.com)|192.30.255.113|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://raw.githubusercontent.com/esp8266/esp8266-wiki/master/libs/libhal.a [following] --2018-04-11 18:57:36-- https://raw.githubusercontent.com/esp8266/esp8266-wiki/master/libs/libhal.a Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.72.133 Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.72.133|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 347624 (339K) [application/octet-stream] Saving to: ‘libhal.a’ libhal.a 100%[=================================================>] 339.48K --.-KB/s in 0.05s 2018-04-11 18:57:37 (6.77 MB/s) - ‘libhal.a’ saved [347624/347624]
ダウンロードしたファイルを解凍して、コンパイルの準備をします。
$ unzip ESP8266_NOOSSDK_V2.2.0.zip ↵ The program 'unzip' is currently not installed. You can install it by typing: sudo apt install unzip
あれ?!unzipがない?
unzipをインストールしましょう。
$ sudo apt-get -y install unzip ↵ Reading package lists... Done Building dependency tree Reading state information... Done The following package was automatically installed and is no longer required: libfreetype6 Use 'sudo apt autoremove' to remove it. Suggested packages: zip The following NEW packages will be installed: unzip 0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded. Need to get 158 kB of archives. After this operation, 530 kB of additional disk space will be used. Get:1 http://archive.ubuntu.com/ubuntu xenial/main amd64 unzip amd64 6.0-20ubuntu1 [158 kB] Fetched 158 kB in 1s (98.9 kB/s) Selecting previously unselected package unzip. (Reading database ... 32731 files and directories currently installed.) Preparing to unpack .../unzip_6.0-20ubuntu1_amd64.deb ... Unpacking unzip (6.0-20ubuntu1) ... Processing triggers for mime-support (3.59ubuntu1) ... Processing triggers for man-db (2.7.5-1) ... Setting up unzip (6.0-20ubuntu1) ...
では気を取り直して再び。
$ unzip ESP8266_NOOSSDK_V2.2.0.zip ↵
Archive: ESP8266_NOOSSDK_V2.2.0.zip
fcdedd636cc847d54f5576e804e4cde7e1147ea5
creating: ESP8266_NONOS_SDK-2.2.0/
:
inflating: ESP8266_NONOS_SDK-2.2.0/tools/rmfile.sh
$ tar -zxf include.tgz ↵
$ cd /mnt/c/Users/<プロジェクト用ディレクトリ> ↵
$ cp -R ~/ESP8266_NONOS_SDK-2.2.0 ./ ↵
$ cp -R ~/include ./ESP8266_NONOS_SDK-2.2.0/ ↵
$ cp ~/libhal.a ./ESP8266_NONOS_SDK-2.2.0/lib/ ↵
$ cd ESP8266_NONOS_SDK-2.2.0/ ↵
$ mv examples/IoT_Demo/ ./ ↵
いざ、コンパイルです。
$ cd IoT_Demo/ ↵
$ ./gen_misc.sh ↵
gen_misc.sh version 20150511
Please follow below steps(1-5) to generate specific bin(s):
STEP 1: choose boot version(0=boot_v1.1, 1=boot_v1.2+, 2=none)
enter(0/1/2, default 2): ↵
boot mode: none
STEP 2: choose bin generate(0=eagle.flash.bin+eagle.irom0text.bin, 1=user1.bin, 2=user2.bin)
enter (0/1/2, default 0): ↵
generate bin: eagle.flash.bin+eagle.irom0text.bin
STEP 3: choose spi speed(0=20MHz, 1=26.7MHz, 2=40MHz, 3=80MHz)
enter (0/1/2/3, default 2): ↵
spi speed: 40 MHz
STEP 4: choose spi mode(0=QIO, 1=QOUT, 2=DIO, 3=DOUT)
enter (0/1/2/3, default 0): ↵
spi mode: QIO
STEP 5: choose spi size and map
0= 512KB( 256KB+ 256KB)
2=1024KB( 512KB+ 512KB)
3=2048KB( 512KB+ 512KB)
4=4096KB( 512KB+ 512KB)
5=2048KB(1024KB+1024KB)
6=4096KB(1024KB+1024KB)
7=4096KB(2048KB+2048KB) not support ,just for compatible with nodeMCU board
8=8192KB(1024KB+1024KB)
9=16384KB(1024KB+1024KB)
enter (0/2/3/4/5/6/7/8/9, default 0): ↵
spi size: 512KB
spi ota map: 256KB + 256KB
start...
make[1]: Entering directory '/mnt/c/Users/<プロジェクト用ディレクトリ>/ESP8266_NONOS_SDK-2.2.0/IoT_Demo/user'
:
!!!
make: python: Command not found
../Makefile:257: recipe for target '.output/eagle/debug/bin/eagle.app.v6.bin' failed
make: *** [.output/eagle/debug/bin/eagle.app.v6.bin] Error 127
やはりpythonが必要なようです。
インストールしましょう。
$ sudo apt-get -y install python ↵
Reading package lists... Done
:
Setting up python (2.7.12-1~16.04) ...
再びチャレンジしてみましょう。
$ ./gen_misc.sh ↵
gen_misc.sh version 20150511
Please follow below steps(1-5) to generate specific bin(s):
STEP 1: choose boot version(0=boot_v1.1, 1=boot_v1.2+, 2=none)
enter(0/1/2, default 2): ↵
boot mode: none
STEP 2: choose bin generate(0=eagle.flash.bin+eagle.irom0text.bin, 1=user1.bin, 2=user2.bin)
enter (0/1/2, default 0): ↵
generate bin: eagle.flash.bin+eagle.irom0text.bin
STEP 3: choose spi speed(0=20MHz, 1=26.7MHz, 2=40MHz, 3=80MHz)
enter (0/1/2/3, default 2): ↵
spi speed: 40 MHz
STEP 4: choose spi mode(0=QIO, 1=QOUT, 2=DIO, 3=DOUT)
enter (0/1/2/3, default 0): ↵
spi mode: QIO
STEP 5: choose spi size and map
0= 512KB( 256KB+ 256KB)
2=1024KB( 512KB+ 512KB)
3=2048KB( 512KB+ 512KB)
4=4096KB( 512KB+ 512KB)
5=2048KB(1024KB+1024KB)
6=4096KB(1024KB+1024KB)
7=4096KB(2048KB+2048KB) not support ,just for compatible with nodeMCU board
8=8192KB(1024KB+1024KB)
9=16384KB(1024KB+1024KB)
enter (0/2/3/4/5/6/7/8/9, default 0): ↵
spi size: 512KB
spi ota map: 256KB + 256KB
start...
make[1]: Entering directory '/mnt/c/Users/<プロジェクト用ディレクトリ>/ESP8266_NONOS_SDK-2.2.0/IoT_Demo/user'
:
!!!
No boot needed.
Generate eagle.flash.bin and eagle.irom0text.bin successully in folder bin.
eagle.flash.bin-------->0x00000
eagle.irom0text.bin---->0x10000
!!!
コンパイルができたようです。