环境
- 系统:Ubuntu 20.04 LTS
- 依赖:
- make 4.2.1
- gcc 9.4.0
- cmake 3.16.3
- python 3.8.10
- pip 20.0.2
sudo apt install gcc make cmake
获取MicroPython源码
git clone -b v1.19.1 --recursive https://github.com/micropython/micropython.git
构建交叉编译器
$ cd mpy-cross
$ make
编译esp32固件
参考文档https://github.com/micropython/micropython/tree/master/ports/esp32
安装ESP-IDF
cd ~
git clone -b v4.4.4 --recursive https://github.com/espressif/esp-idf.git
cd esp-idf
./install.sh
source export.sh
期间需要下载一些文件,如果无法下载,手动下载后放到对应目录,一般是./.espressif/dist
编译固件
cd ~/micropython/ports/esp32
make submodules
make