因micropython官方固件对esp32支持还不完善,但是国外厂商有基于micropython对esp32针对性的支持(代码优先自家板子后续再提交到micropython官方合并),且python语法有所升级。所以手头上有esp32板子且想体验较为完善的micropython可以编译pycom的固件烧录到自己的板子上。
系统环境:
ubuntu-16.04.2-desktop-amd64
假设你工作目录为:/home/esp/esp/pycom/build
安装依赖:
sudo apt update
sudo apt upgrade
sudo apt-get install git wget make libncurses-dev flex bison gperf python python-serial curl
一, 安装PYCOM-IDF
1. cd /home/esp/esp/pycom/build
2. git clone --recursive https://github.com/pycom/pycom-esp-idf.git
3. cd pycom-esp-idf
4. git submodule update --init
5. export IDF_PATH=/home/esp/esp/pycom/build/pycom-esp-idf
二,安装pycom-micropython-sigfox
1. cd /home/esp/esp/pycom/build
2. git clone --recursive https://github.com/pycom/pycom-micropython-sigfox.git
3. git submodule update --init
三, 安装XTENSA
1. cd /home/esp/esp/pycom/build
2. curl -O https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-61-gab8375a-5.2.0.tar.gz
3. tar -xzf xtensa-esp32-elf-linux64-1.22.0-61-gab8375a-5.2.0.tar.gz
4. export PATH=$PATH:/home/esp/esp/pycom/build/xtensa-esp32-elf/bin
四,构建app & bootloader
1. cd /home/esp/esp/pycom/build/pycom-micropython-sigfox
2. make -C mpy-cross
3. cd esp32
4. make BOARD=WIPY -j4 TARGET=boot
5. make BOARD=WIPY -j4 TARGET=app
备注:
如果你的板子不是pycom出品,请修改pycom-micropython-sigfox/esp32/boards/wipy/pins.csv文件中的引脚定义再编译即可。
pycom-micropython-sigfox/esp32/boards/wipy/目录下有固件烧录配置以及其他板子配置文件定义,请自行查看按需修改。
参考链接: