重要网址
https://www.cnblogs.com/mmmmar/p/6370549.html
https://www.cnblogs.com/mmmmar/p/6370549.html
http://blog.odonnell.nu/
1、安装依赖工具和相关库
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
备注Ubuntu16.04下安装的是
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
备注Ubuntu16.04下安装的是
sudo apt-get install gperf bison flex help2man libncurses5-dev make autoconf texinfo libtool libtool-bin g++ python unzip python-serial git screen make
2、使用git将项目克隆到本地,保存为esp-open-sdk
git clone --recursive https://github.com/pfalcon/esp-open-sdk.git
3、进入esp-open-sdk文件夹,并且编译
cd ~/esp-open-sdk
make STANDALONE=y 或make
cd ~/esp-open-sdk
make STANDALONE=y 或make
4、将交叉编译器目录添加至环境变量
gedit ~/.bashrc
在文件最后添加export PATH=/home/jzhang/esp-open-sdk/xtensa-lx106-elf/bin:$PATH
gedit ~/.bashrc
在文件最后添加export PATH=/home/jzhang/esp-open-sdk/xtensa-lx106-elf/bin:$PATH
5、使用git将micropython克隆到本地,保存为micropython, 并且进入文件夹下载子模块
git clone https://github.com/micropython/micropython.git
cd micropython
git submodule update --init
git clone https://github.com/micropython/micropython.git
cd micropython
git submodule update --init
6、编译生成固件
进入micropython目录下,执行make -C mpy-cross
进入tools目录下,执行chmod +x make-frozen.py
进入ports/esp8266目录下执行make axtls 和 make
进入micropython目录下,执行make -C mpy-cross
进入tools目录下,执行chmod +x make-frozen.py
进入ports/esp8266目录下执行make axtls 和 make
如果make出错为:
In file included from ./esp_mphal.h:73:0,
from ../../py/mphal.h:32,
from ../../py/mpprint.c:33:
./etshal.h:9:6: error: conflicting types for 'ets_delay_us'
void ets_delay_us(uint16_t us);
^
./etshal.h:9:1: note: an argument type that has a default promotion can't match an empty parameter name list declaration
void ets_delay_us(uint16_t us);
^
In file included from ./esp_mphal.h:66:0,
from ../../py/mphal.h:32,
from ../../py/mpprint.c:33:
/home/jzhang/esp-open-sdk/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/usr/include/osapi.h:33:6: note: previous declaration of 'ets_delay_us' was here
void ets_delay_us();
^
make: *** [build/py/mpprint.o] 错误 1
*/
则打开文件/home/jzhang/esp-open-sdk/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/usr/include/osapi.h,将void ets_delay_us();改为void ets_delay_us(uint16_t us);
In file included from ./esp_mphal.h:73:0,
from ../../py/mphal.h:32,
from ../../py/mpprint.c:33:
./etshal.h:9:6: error: conflicting types for 'ets_delay_us'
void ets_delay_us(uint16_t us);
^
./etshal.h:9:1: note: an argument type that has a default promotion can't match an empty parameter name list declaration
void ets_delay_us(uint16_t us);
^
In file included from ./esp_mphal.h:66:0,
from ../../py/mphal.h:32,
from ../../py/mpprint.c:33:
/home/jzhang/esp-open-sdk/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/usr/include/osapi.h:33:6: note: previous declaration of 'ets_delay_us' was here
void ets_delay_us();
^
make: *** [build/py/mpprint.o] 错误 1
*/
则打开文件/home/jzhang/esp-open-sdk/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/usr/include/osapi.h,将void ets_delay_us();改为void ets_delay_us(uint16_t us);
此外:将/home/jzhang/esp-open-sdk/ESP8266_NONOS_SDK-2.1.0-18-g61248df/lib/libgcc.a 复制到
/home/jzhang/esp-open-sdk/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.5目录下
/home/jzhang/esp-open-sdk/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.5目录下
最后make结果为:
LINK build/firmware.elf
text data bss dec hex filename
575992 1092 64424 641508 9c9e4 build/firmware.elf
Create build/firmware-combined.bin
esptool.py v1.2
('flash ', 35504)
('padding ', 1360)
('irom0text', 541620)
('total ', 578484)
('md5 ', '00980a323b527e9dea96ccf4abcfd26f')
LINK build/firmware.elf
text data bss dec hex filename
575992 1092 64424 641508 9c9e4 build/firmware.elf
Create build/firmware-combined.bin
esptool.py v1.2
('flash ', 35504)
('padding ', 1360)
('irom0text', 541620)
('total ', 578484)
('md5 ', '00980a323b527e9dea96ccf4abcfd26f')
在当前目录的build目录下就可找到生成的固件firmware-combined.bin
至此Ubuntu12.04 ESP8266固件环境搭建成功,生成了可以下载的固件。