Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the simply-static domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/html/wp-includes/functions.php on line 6121
编译esp32-c3的micropython固件

编译esp32-c3的micropython固件

1.1.2. ESP-IDF开发环境

在linux子系统命令行模式下依次执行如下指令:

cd ~
git clone https://gitee.com/EspressifSystems/esp-gitee-tools.git
git clone https://gitee.com/EspressifSystems/esp-idf.git
ls

cd esp-idf
git checkout v4.4.1
cd ~/esp-gitee-tools
./submodule-update.sh ~/esp-idf/
./install.sh ~/esp-idf/

 . /home/peter/esp-idf/export.sh

idf.py build

cd ~/esp-idf/
source export.sh

cd ~
git clone https://gitee.com/CHN_ZC/micropython.git
sudo chmod a+rwx micropython
cd ~/micropython
make -C mpy-cross
cd ports/esp32
make submodules
make

1.1.4. 测试模块

Python文件模块放在esp32下的modules文件夹,进入该文件夹:

cd modules

新建一个测试用的python文件,如下:

nano test.py

文件内容如下:

from time import sleep
def hello():
    print("hello world")
def hw(str):
    print(str)
def cycle(str):
    while True:
        print(str)
        sleep(1)

保存后回到esp32目录,执行编译操作:

cd ~/micropython   #micropython根目录

make -C mpy-cross

cd ports/esp32/

  . /home/peter/esp-idf/export.sh

编译esp32c3固件

make clean

更改ports/esp32/Makefile文件

找到 BOARD ?= GENERIC
改为 BOARD ?= GENERIC_C3

或
BOARD ?= GENERIC_C3_USB

make

留意上面的三个文件及地址,分别是烧录文件及偏移地址。

注意:

严格按照执行后的提示执行一下,否则会导致环境变量等等没有设置,为后续编译带来很多麻烦

esptool安装方法

1. 下载 esptool.py 源码

git clone https://github.com/espressif/esptool.git

2. 目录导入到全局环境变量

以 ubuntu 为例:

将 export PATH=/home/chenwu/esp/esptool:$PATH 添加到 /etc/profile 文件结尾

执行 source /etc/profile

3.安装成功后通过 esptool.py version 查看版本:

注意: esptool.py v3.0 版本后,才对 ESP32-S 系列支持。

如果使用新款芯片,可以通过 git pull 来更新 esptool.py 版本。

关于luatos的esp32-c3的烧录注意事项(USB-JTAG)

1、按住rst键不放,再按住boot键不放,此时松开rst键

2、esptool.py –chip esp32c3 –port /dev/ttyACM1 erase_flash

3、正常烧录固件

4、按下rst键盘重启

5、正常使用