Clean up some LVGL related files and content to align to MicroPython repo; add a few build and deploy scripts; update lv_binding

This commit is contained in:
Gabor Peresztegi 2025-03-04 19:42:37 +01:00
parent 22d4c25aa6
commit 323e0b2e76
26 changed files with 310 additions and 220 deletions

52
.gitignore vendored
View File

@ -1,3 +1,30 @@
# This .gitignore file is intended to be minimal.
#
# If you find that you need additional rules, such as IDE temporary
# files, please do so either via a global .gitignore file (registered
# with core.excludesFile), or by adding private repository-specific
# rules to .git/info/exclude. See https://git-scm.com/docs/gitignore
# for more information.
# Build directories
build/
build-*/
docs/genrst/
# Test failure outputs and intermediate artefacts
tests/results/*
tests/ports/unix/ffi_lib.so
# Python cache files
__pycache__/
# Customized Makefile/project overrides
GNUmakefile
user.props
# MacOS desktop metadata files
.DS_Store
# Compiled Sources
###################
*.o
@ -40,31 +67,6 @@ tags
TAGS
######################
# This .gitignore file is intended to be minimal.
#
# If you find that you need additional rules, such as IDE temporary
# files, please do so either via a global .gitignore file (registered
# with core.excludesFile), or by adding private repository-specific
# rules to .git/info/exclude. See https://git-scm.com/docs/gitignore
# for more information.
# Build directories
build/
build-*/
docs/genrst/
# Test failure outputs and intermediate artefacts
tests/results/*
tests/ports/unix/ffi_lib.so
# Python cache files
__pycache__/
# Customized Makefile/project overrides
GNUmakefile
user.props
ports/javascript/node_modules
.vscode/
# MacOS desktop metadata files
.DS_Store

View File

@ -11,11 +11,9 @@ tasks:
make -C ports/unix DEBUG=1 submodules
make -j $(nproc) -C mpy-cross DEBUG=1
make -j $(nproc) -C ports/unix DEBUG=1
# source tools/ci.sh && ci_esp32_idf44_setup
# source tools/ci.sh && ci_esp32_build
command: |
xrandr --fb 500x500 # Fix resolution for LVGL screens which are smaller
ports/unix/build-standard/micropython -i lib/lv_bindings/examples/advanced_demo.py
ports/unix/build-lvgl/micropython -i user_modules/lv_binding_micropython/examples/advanced_demo.py
vscode:
extensions:
- ms-vscode.cpptools

197
README-LVGL.md Normal file
View File

@ -0,0 +1,197 @@
# Micropython + lvgl
**Micropython bindings to LVGL for Embedded devices, Unix and JavaScript**
[![Build lv_micropython unix port](https://github.com/lvgl/lv_micropython/actions/workflows/unix_port.yml/badge.svg)](https://github.com/lvgl/lv_micropython/actions/workflows/unix_port.yml)
[![Build lv_micropython stm32 port](https://github.com/lvgl/lv_micropython/actions/workflows/stm32_port.yml/badge.svg)](https://github.com/lvgl/lv_micropython/actions/workflows/stm32_port.yml)
[![esp32 port](https://github.com/lvgl/lv_micropython/actions/workflows/ports_esp32.yml/badge.svg)](https://github.com/lvgl/lv_micropython/actions/workflows/ports_esp32.yml) [![Build lv_micropython rp2 port](https://github.com/lvgl/lv_micropython/actions/workflows/rp2_port.yml/badge.svg)](https://github.com/lvgl/lv_micropython/actions/workflows/rp2_port.yml)
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/lvgl/lv_micropython)
To quickly run Micropython + LVGL from your web browser you can also use the [Online Simulator](https://sim.lvgl.io/).
**For information about Micropython lvgl bindings please refer to [lv_binding_micropython/README.md](https://github.com/lvgl/lv_binding_micropython/blob/master/README.md)**
See also [Micropython + LittlevGL](https://blog.lvgl.io/2019-02-20/micropython-bindings) blog post. (LittlevGL is LVGL's previous name.)
For questions and discussions - please use the forum: https://forum.lvgl.io/c/micropython
Original micropython README: https://github.com/micropython/micropython/blob/master/README.md
## Relationship between `lv_micropython` and `lv_binding_micropython`
Originally, `lv_micropython` was created as an example of how to use [lv_binding_micropython](https://github.com/lvgl/lv_binding_micropython) on a Micropython fork.
As such, we try to keep changes here as minimal as possible and we try to keep it in sync with Micropython upstream releases. We also try to add changes to `lv_binding_micropython` instead of to `lv_micropython`, when possible. (for example we keep all drivers in `lv_binding_micropython`, the ESP32 CMake functionality etc.)
Eventually it turned out that many people prefer using `lv_micropython` directly and only a few use it as a reference to support LVGL on their own Micropython fork.
If you are only starting with Micropython+LVGL, it's recommended that you use `lv_micropython`, while porting a Micropython fork to LVGL is for advanced users.
## Build Instructions
First step is always to clone lv_micropython and update its submodules recursively:
```
git clone https://github.com/lvgl/lv_micropython.git
cd lv_micropython
git submodule update --init --recursive lib/lv_bindings
```
Next you should build mpy-cross
```
make -C mpy-cross
```
Port specific steps usually include updating the port's submodules with `make submodules` and running make for the port itself.
### Unix (Linux) port
1. `sudo apt-get install build-essential libreadline-dev libffi-dev git pkg-config libsdl2-2.0-0 libsdl2-dev python3.8 parallel`
Python 3 is required, but you can install some other version of python3 instead of 3.8, if needed.
2. `git clone https://github.com/lvgl/lv_micropython.git`
3. `cd lv_micropython`
4. `git submodule update --init --recursive lib/lv_bindings`
5. `make -C mpy-cross`
6. `make -C ports/unix submodules`
7. `make -C ports/unix`
8. `./ports/unix/micropython`
## Unix (MAC OS) port
1. `brew install sdl2 pkg-config`
2. `git clone https://github.com/lvgl/lv_micropython.git`
3. `cd lv_micropython`
4. `git submodule update --init --recursive lib/lv_bindings`
5. `sudo mkdir -p /usr/local/lib/`
6. `sudo cp /opt/homebrew/Cellar/sdl2/2.24.0/lib/libSDL2.dylib /usr/local/lib/`
7. `sudo cp -r /opt/homebrew/Cellar/sdl2/2.24.0/include /usr/local/`
8. `sed -i '' 's/ -Werror//' ports/unix/Makefile mpy-cross/Makefile` Remove -Werror from compiler parameters as Mac fails compilation otherwise
9. `make -C mpy-cross`
10. `make -C ports/unix submodules`
11. `make -C ports/unix`
12. `./ports/unix/build-standard/micropython`
### ESP32 port
Please run `esp-idf/export.sh` from your ESP-IDF installation directory as explained in the [Micropython ESP32 Getting Started documentation](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/get-started/#get-started-export)
ESP-IDF version needs to match Micropython expected esp-idf, otherwise a warning will be displayed (and build will probably fail)
For more details refer to [Setting up the toolchain and ESP-IDF](https://github.com/lvgl/lv_micropython/blob/master/ports/esp32/README.md#setting-up-the-toolchain-and-esp-idf)
When using IL9341 driver, the color depth need to be set to match ILI9341. This can be done from the command line.
Here is the command to build ESP32 + LVGL which is compatible with ILI9341 driver:
```
make -C mpy-cross
make -C ports/esp32 LV_CFLAGS="-DLV_COLOR_DEPTH=16" BOARD=GENERIC_SPIRAM deploy
```
Explanation about the paramters:
- `LV_CFLAGS` are used to override color depth, for ILI9341 compatibility.
- `LV_COLOR_DEPTH=16` is needed if you plan to use the ILI9341 driver.
- `BOARD` - I use WROVER board with SPIRAM. You can choose other boards from `ports/esp32/boards/` directory.
- `deploy` - make command will create ESP32 port of Micropython, and will try to deploy it through USB-UART bridge.
For more details please refer to [Micropython ESP32 README](https://github.com/micropython/micropython/blob/master/ports/esp32/README.md).
### JavaScript port
Refer to the README of the `lvgl_javascript` branch: https://github.com/lvgl/lv_micropython/tree/lvgl_javascript_v8#javascript-port
### Raspberry Pi Pico port
This port uses [Micropython infrastructure for C modules](https://docs.micropython.org/en/latest/develop/cmodules.html#compiling-the-cmodule-into-micropython) and `USER_C_MODULES` must be given:
1. `git clone https://github.com/lvgl/lv_micropython.git`
2. `cd lv_micropython`
3. `git submodule update --init --recursive lib/lv_bindings`
4. `make -C ports/rp2 BOARD=PICO submodules`
5. `make -j -C mpy-cross`
6. `make -j -C ports/rp2 BOARD=PICO USER_C_MODULES=../../lib/lv_bindings/bindings.cmake`
#### Troubleshooting
If you experience unstable behaviour, it is worth checking the value of *MICROPY_HW_FLASH_STORAGE_BASE* against the value of *__flash_binary_end* from the firmware.elf.map file.
If the storage base is lower than the binary end, parts of the firmware will be overwritten when the micropython filesystem is initialised.
## Super Simple Example
First, LVGL needs to be imported and initialized
```python
import lvgl as lv
lv.init()
```
Then event loop, display driver and input driver needs to be registered.
Refer to [Porting the library](https://docs.lvgl.io/8.0/porting/index.html) for more information.
Here is an example of registering SDL drivers on Micropython unix port:
```python
# Create an event loop and Register SDL display/mouse/keyboard drivers.
from lv_utils import event_loop
WIDTH = 480
HEIGHT = 320
event_loop = event_loop()
disp_drv = lv.sdl_window_create(WIDTH, HEIGHT)
mouse = lv.sdl_mouse_create()
keyboard = lv.sdl_keyboard_create()
keyboard.set_group(self.group)
```
Here is an alternative example, for registering ILI9341 drivers on Micropython ESP32 port:
```python
import lvgl as lv
# Import ILI9341 driver and initialized it
from ili9341 import ili9341
disp = ili9341()
# Import XPT2046 driver and initalize it
from xpt2046 import xpt2046
touch = xpt2046()
```
By default, both ILI9341 and XPT2046 are initialized on the same SPI bus with the following parameters:
- ILI9341: `miso=5, mosi=18, clk=19, cs=13, dc=12, rst=4, power=14, backlight=15, spihost=esp.HSPI_HOST, mhz=40, factor=4, hybrid=True`
- XPT2046: `cs=25, spihost=esp.HSPI_HOST, mhz=5, max_cmds=16, cal_x0 = 3783, cal_y0 = 3948, cal_x1 = 242, cal_y1 = 423, transpose = True, samples = 3`
You can change any of these parameters on ili9341/xpt2046 constructor.
You can also initalize them on different SPI buses if you want, by providing miso/mosi/clk parameters. Set them to -1 to use existing (initialized) spihost bus.
Now you can create the GUI itself:
```python
# Create a screen with a button and a label
scr = lv.obj()
btn = lv.btn(scr)
btn.align_to(lv.scr_act(), lv.ALIGN.CENTER, 0, 0)
label = lv.label(btn)
label.set_text("Hello World!")
# Load the screen
lv.scr_load(scr)
```
## More information
More info about LVGL:
- Website https://lvgl.io
- GitHub: https://github.com/lvgl/lvgl
- Documentation: https://docs.lvgl.io/master/get-started/bindings/micropython.html
- Examples: https://docs.lvgl.io/master/examples.html
- More examples: https://github.com/lvgl/lv_binding_micropython/tree/master/examples
More info about lvgl Micropython bindings:
- https://github.com/lvgl/lv_binding_micropython/blob/master/README.md
Discussions about the Micropython binding: https://github.com/lvgl/lvgl/issues/557
More info about the unix port: https://github.com/micropython/micropython/wiki/Getting-Started#debian-ubuntu-mint-and-variants

View File

@ -1,4 +1,4 @@
[![Unix CI badge](https://github.com/micropython/micropython/actions/workflows/ports_unix.yml/badge.svg)](https://github.com/micropython/micropython/actions?query=branch%3Amaster+event%3Apush) [![STM32 CI badge](https://github.com/micropython/micropython/actions/workflows/ports_stm32.yml/badge.svg)](https://github.com/micropython/micropython/actions?query=branch%3Amaster+event%3Apush) [![Docs CI badge](https://github.com/micropython/micropython/actions/workflows/docs.yml/badge.svg)](https://docs.micropython.org/) [![codecov](https://codecov.io/gh/micropython/micropython/branch/master/graph/badge.svg?token=I92PfD05sD)](https://codecov.io/gh/micropython/micropython)
[MicroPython-LVGL project](README-LVGL.md)
The MicroPython project
=======================

View File

@ -1,5 +1,2 @@
dependencies.lock
managed_components/
*.swp
lextab.py
yacctab.py

View File

@ -187,10 +187,6 @@
#define MICROPY_PY_SOCKET_EVENTS (MICROPY_PY_WEBREPL)
#define MICROPY_PY_BLUETOOTH_RANDOM_ADDR (1)
#define MICROPY_PY_LVGL (1)
#define MICROPY_PY_ESPIDF (1)
#define MICROPY_PY_RTCH (1)
// fatfs configuration
#define MICROPY_FATFS_ENABLE_LFN (1)
#define MICROPY_FATFS_RPATH (2)

View File

@ -34,8 +34,6 @@
#include "pico/multicore.h"
#include "mpconfigboard.h"
#define MICROPY_PY_LVGL (1)
// Board and hardware specific configuration
#if PICO_RP2040
#define MICROPY_HW_MCU_NAME "RP2040"

View File

@ -1 +0,0 @@
../../../lib/lv_bindings/lib/display_driver_utils.py

View File

@ -1 +0,0 @@
../../../lib/lv_bindings/lib/fs_driver.py

View File

@ -1 +0,0 @@
../../../lib/lv_bindings/lib/lv_colors.py

View File

@ -1 +0,0 @@
../../../lib/lv_bindings/driver/stm32/lvstm32.py

View File

@ -88,7 +88,7 @@
#define MICROPY_PY_SYS_PLATFORM "pyboard"
#endif
#ifndef MICROPY_PY_THREAD
#define MICROPY_PY_THREAD (1)
#define MICROPY_PY_THREAD (0)
#endif
// extended modules
@ -152,13 +152,6 @@
#ifndef MICROPY_PY_NETWORK
#define MICROPY_PY_NETWORK (1)
#endif
// LVGL is enable per board
//#ifndef MICROPY_PY_LVGL
//#define MICROPY_PY_LVGL (1)
//#endif
#ifndef MICROPY_PY_RK043FN48H
#define MICROPY_PY_RK043FN48H (1)
#endif
#ifndef MICROPY_PY_ONEWIRE
#define MICROPY_PY_ONEWIRE (1)
#endif

View File

@ -1100,17 +1100,3 @@ void I2C4_ER_IRQHandler(void) {
#endif // defined(MICROPY_HW_I2C4_SCL)
#endif // MICROPY_PY_PYB_LEGACY
#if defined(HAL_DMA2D_MODULE_ENABLED)
extern DMA2D_HandleTypeDef *hdma2d;
void DMA2D_IRQHandler(void) {
HAL_DMA2D_IRQHandler(hdma2d);
}
#endif
#if defined(HAL_LTDC_MODULE_ENABLED)
extern LTDC_HandleTypeDef *hltdc;
void LTDC_IRQHandler(void) {
HAL_LTDC_IRQHandler(hltdc);
}
#endif

View File

@ -42,10 +42,8 @@
#ifndef MICROPY_PY_SYS_PLATFORM
#if defined(__APPLE__) && defined(__MACH__)
#define MICROPY_PY_SYS_PLATFORM "darwin"
#define LINUX_FRAME_BUFFER 0
#else
#define MICROPY_PY_SYS_PLATFORM "linux"
#define LINUX_FRAME_BUFFER 1
#endif
#endif

View File

@ -63,13 +63,6 @@ SRC_C = \
fmode.c \
$(wildcard $(VARIANT_DIR)/*.c)
LIB_SRC_C = $(addprefix lib/,\
lv_bindings/driver/SDL/sdl_common.c \
lv_bindings/driver/SDL/sdl.c \
lv_bindings/driver/SDL/modSDL.c \
timeutils/timeutils.c \
)
SHARED_SRC_C += $(addprefix shared/,\
$(SHARED_SRC_C_EXTRA) \
)
@ -84,7 +77,7 @@ CFLAGS += -DMICROPY_USE_READLINE=1
SRC_C += shared/readline/readline.c
endif
LIB += -lws2_32 -lSDL2
LIB += -lws2_32
# List of sources for qstr extraction
SRC_QSTR += $(SRC_C) $(SRC_CXX) $(SHARED_SRC_C)

View File

@ -1,135 +0,0 @@
#
# This is the main Makefile, which uses MicroPython build system,
# but Zephyr arch-specific toolchain and target-specific flags.
# This Makefile builds MicroPython as a library, and then calls
# recursively Makefile.zephyr to build complete application binary
# using Zephyr build system.
#
# To build a "minimal" configuration, use "make-minimal" wrapper.
BOARD ?= qemu_x86
OUTDIR_PREFIX = $(BOARD)
# Default heap size is 16KB, which is on conservative side, to let
# it build for smaller boards, but it won't be enough for larger
# applications, and will need to be increased.
MICROPY_HEAP_SIZE = 16384
FROZEN_DIR = scripts
MICROPY_VFS_FAT ?= 1
MICROPY_VFS_LFS1 ?= 0
MICROPY_VFS_LFS2 ?= 1
# Default target
all:
include ../../py/mkenv.mk
include $(TOP)/py/py.mk
# Zephyr (generated) config files - must be defined before include below
Z_EXPORTS = outdir/$(OUTDIR_PREFIX)/Makefile.export
ifneq ($(MAKECMDGOALS), clean)
include $(Z_EXPORTS)
endif
INC += -I.
INC += -I$(TOP)
INC += -I$(BUILD)
INC += -I$(ZEPHYR_BASE)/micropython
INC += -I$(ZEPHYR_BASE)/net/ip
INC += -I$(ZEPHYR_BASE)/net/ip/contiki
INC += -I$(ZEPHYR_BASE)/net/ip/contiki/os
INC += -I$(ZEPHYR_BASE)/kernel/include
INC += -I$(ZEPHYR_BASE)/arch/arm/include
SRC_C = main.c \
help.c \
moduos.c \
modusocket.c \
modutime.c \
modzephyr.c \
modzsensor.c \
modmachine.c \
machine_i2c.c \
machine_pin.c \
machine_uart.c \
uart_core.c \
zephyr_storage.c \
lib/timeutils/timeutils.c \
lib/utils/mpirq.c \
lib/utils/stdout_helpers.c \
lib/utils/printf.c \
lib/utils/pyexec.c \
lib/utils/interrupt_char.c \
lib/mp-readline/readline.c \
$(SRC_MOD)
# lv binding
SRC_C += $(ZEPHYR_BASE)/lib/gui/lvgl/lvgl_display_16bit.c \
$(ZEPHYR_BASE)/lib/gui/lvgl/lvgl_display_24bit.c \
$(ZEPHYR_BASE)/lib/gui/lvgl/lvgl_display_32bit.c \
$(ZEPHYR_BASE)/lib/gui/lvgl/lvgl_display.c \
$(ZEPHYR_BASE)/lib/gui/lvgl/lvgl_display_mono.c \
build/lvgl/lv_mpy.c
INC += -I$(ZEPHYR_BASE)
INC += -I$(TOP)/lib/lv_bindings
INC += -I$(TOP)/lib/lv_bindings/driver/zephyr
INC += -I$(ZEPHYR_BASE)/include
INC += -I$(ZEPHYR_BASE)/lib/gui/lvgl/
INC += -I$(TOP)/lib/lv_bindings/lvgl
# List of sources for qstr extraction
SRC_QSTR += $(SRC_C)
OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
CFLAGS = $(Z_CFLAGS) \
-std=gnu99 -fomit-frame-pointer -DNDEBUG -DMICROPY_HEAP_SIZE=$(MICROPY_HEAP_SIZE) $(CFLAGS_MOD) $(CFLAGS_EXTRA) $(INC)
include $(TOP)/py/mkrules.mk
GENERIC_TARGETS = all zephyr run qemu qemugdb flash debug debugserver \
ram_report rom_report
KCONFIG_TARGETS = \
initconfig config nconfig menuconfig xconfig gconfig \
oldconfig silentoldconfig defconfig savedefconfig \
allnoconfig allyesconfig alldefconfig randconfig \
listnewconfig olddefconfig
CLEAN_TARGETS = pristine mrproper
$(GENERIC_TARGETS): $(LIBMICROPYTHON)
$(CLEAN_TARGETS): clean
$(GENERIC_TARGETS) $(KCONFIG_TARGETS) $(CLEAN_TARGETS):
$(MAKE) -C outdir/$(BOARD) $@
$(LIBMICROPYTHON): | $(Z_EXPORTS)
build/genhdr/qstr.i.last: | $(Z_EXPORTS)
# If we recreate libmicropython, also cause zephyr.bin relink
LIBMICROPYTHON_EXTRA_CMD = -$(RM) -f outdir/$(OUTDIR_PREFIX)/zephyr.lnk
# MicroPython's global clean cleans everything, fast
CLEAN_EXTRA = outdir libmicropython.a
# Clean Zephyr things in Zephyr way
z_clean:
$(MAKE) -f Makefile.zephyr BOARD=$(BOARD) clean
test:
cd $(TOP)/tests && ./run-tests --target minimal --device "execpty:make -C ../ports/zephyr run BOARD=$(BOARD) QEMU_PTY=1"
cmake: outdir/$(BOARD)/Makefile
ifneq ($(CONF_FILE),)
CMAKE_MOD += -DCONF_FILE=$(CONF_FILE)
endif
outdir/$(BOARD)/Makefile:
mkdir -p outdir/$(BOARD) && cmake -DBOARD=$(BOARD) $(CMAKE_MOD) -Boutdir/$(BOARD) -H.
$(Z_EXPORTS): outdir/$(BOARD)/Makefile
make --no-print-directory -C outdir/$(BOARD) outputexports CMAKE_COMMAND=: >$@
make -C outdir/$(BOARD) syscall_list_h_target kobj_types_h_target

View File

@ -5,9 +5,3 @@ CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT="Zephyr MicroPython"
CONFIG_USB_MASS_STORAGE=y
CONFIG_MASS_STORAGE_DISK_NAME="SDMMC"
CONFIG_DISPLAY_MCUX_ELCDIF=y
CONFIG_DISPLAY=y
CONFIG_MCUX_ELCDIF_PANEL_RK043FN02H=y
CONFIG_KSCAN=y
CONFIG_KSCAN_FT5336=y

View File

@ -36,9 +36,6 @@
#define MICROPY_HEAP_SIZE (16 * 1024)
#endif
// LVGL
#define MICROPY_PY_LVGL (1)
#define MICROPY_ENABLE_SOURCE_LINE (1)
#define MICROPY_STACK_CHECK (1)
#define MICROPY_ENABLE_GC (1)
@ -57,7 +54,6 @@
#define MICROPY_PY_BUILTINS_MEMORYVIEW (1)
#define MICROPY_PY_BUILTINS_HELP (1)
#define MICROPY_PY_BUILTINS_HELP_TEXT zephyr_help_text
#define MICROPY_PY_BUILTINS_MEMORYVIEW (1)
#define MICROPY_PY_ARRAY (0)
#define MICROPY_PY_COLLECTIONS (0)
#define MICROPY_PY_CMATH (0)

12
scripts/build-m5core2.sh Executable file
View File

@ -0,0 +1,12 @@
# Build MicroPython-LVGL firmware for: M5Stack Core2 ESP32
source env-variables-micropython.sh
source env-variables-esp32.sh
BOARD=M5STACK_CORE2
cd $MICROPYTHON
make -C mpy-cross
cd $MICROPYTHON/ports/esp32
make BOARD=$BOARD

12
scripts/build-unix.sh Executable file
View File

@ -0,0 +1,12 @@
# Build MicroPython-LVGL app for: Unix/Linux systems
source env-variables-micropython.sh
VARIANT=lvgl
cd $MICROPYTHON
make -C mpy-cross
cd $MICROPYTHON/ports/unix
make VARIANT=$VARIANT

25
scripts/clean.sh Executable file
View File

@ -0,0 +1,25 @@
# Clear build directories
ORIGINAL_DIR=$PWD
source env-variables-micropython.sh
# Clean mpy-cross
cd $MICROPYTHON/mpy-cross
rm -rf build-*
# Clean Unix port
cd $MICROPYTHON/ports/unix
rm -rf build-*
# Clean ESP32 port boards
cd $ORIGINAL_DIR
source env-variables-esp32.sh
cd $MICROPYTHON/ports/esp32
rm -rf build-*
# Clean Raspberry boards
cd $MICROPYTHON/ports/rp2
rm -rf build-*
cd $ORIGINAL_DIR

9
scripts/deploy-m5core2.sh Executable file
View File

@ -0,0 +1,9 @@
# Deploy firmware to device: M5Stack Core2 ESP32
source env-variables-micropython.sh
source env-variables-esp32.sh
BOARD=M5STACK_CORE2
cd $MICROPYTHON/ports/esp32
make deploy BOARD=$BOARD

6
scripts/env-variables-esp32.sh Executable file
View File

@ -0,0 +1,6 @@
# Set environment variables for ESP32 development
ESPIDF=~/esp/esp-idf-5-2-3
source $ESPIDF/export.sh

View File

@ -0,0 +1,10 @@
# Set environment variables for MicroPython development
BUILD_VERBOSE=1
MICROPYTHON=$(pwd)
echo "MICROPYTHON=$MICROPYTHON"
if [[ "$MICROPYTHON" == */scripts ]]; then
MICROPYTHON="${MICROPYTHON%/scripts}"
fi
echo "MICROPYTHON=$MICROPYTHON"

7
scripts/erase-flash-esp32.sh Executable file
View File

@ -0,0 +1,7 @@
# Erase the flash memory of the ESP32 board
source env-variables-micropython.sh
source env-variables-esp32.sh
cd $MICROPYTHON/ports/esp32
make erase BOARD=$BOARD

@ -1 +1 @@
Subproject commit a2008e505ceb44eafa3b1b08cb38d957d2721e95
Subproject commit b9c5cb84221d52e07a51100987d68f47c34acd0b