|
2 | 2 |
|
3 | 3 | Build MicroPythonOS for ESP32 microcontrollers, such as [supported hardware](../getting-started/supported-hardware.md). |
4 | 4 |
|
5 | | -## Prerequisites |
| 5 | +## Get the prerequisites |
6 | 6 |
|
7 | | -Clone the required repositories: |
| 7 | +Clone the repositories: |
8 | 8 |
|
9 | 9 | ``` |
10 | | -mkdir ~/MicroPythonOS |
11 | | -cd ~/MicroPythonOS |
12 | | -
|
13 | | -git clone https://github.com/MicroPythonOS/MicroPythonOS.git |
14 | | -git clone https://github.com/MicroPythonOS/freezeFS |
15 | | -git clone https://github.com/MicroPythonOS/secp256k1-embedded-ecdh |
16 | | -git clone https://github.com/MicroPythonOS/lvgl_micropython |
17 | | -
|
18 | | -mkdir -p lvgl_micropython/lib/micropython/ports/esp32/main/ |
19 | | -echo " espressif/esp32-camera: |
20 | | - git: https://github.com/MicroPythonOS/esp32-camera" >> lvgl_micropython/lib/micropython/ports/esp32/main/idf_component.yml |
21 | | -
|
22 | | -mkdir -p lvgl_micropython/lib/micropython/ports/unix/variants |
23 | | -echo 'include("$(MPY_DIR)/extmod/asyncio") # This is needed to have asyncio, which is used by aiohttp, which has used by websockets' >> lvgl_micropython/lib/micropython/ports/unix/variants/manifest.py |
24 | | -
|
25 | | -# Unix builds need these symlinks because they don't handle USER_C_MODULE properly: |
26 | | -ln -s ../../secp256k1-embedded-ecdh lvgl_micropython/ext_mod/secp256k1-embedded-ecdh |
27 | | -ln -s ../../MicroPythonOS/c_mpos lvgl_micropython/ext_mod/c_mpos |
28 | | -
|
29 | | -git clone https://github.com/cnadler86/micropython-camera-API |
30 | | -pushd micropython-camera-API/ |
31 | | -git checkout v0.4.0 |
32 | | -echo 'include("~/MicroPythonOS/lvgl_micropython/build/manifest.py")' >> src/manifest.py |
33 | | -popd |
| 10 | +git clone --recurse-submodules https://github.com/MicroPythonOS/MicroPythonOS.git |
34 | 11 | ``` |
35 | 12 |
|
36 | | -## Build Process |
| 13 | +That will take a while, because it recursively clones MicroPython, LVGL, ESP-IDF and all their dependencies. |
37 | 14 |
|
38 | | -1. **Navigate to the main repository**: |
| 15 | +While that's going on, make sure you have everything installed to compile code: |
39 | 16 |
|
40 | | - ``` |
41 | | - cd ~/MicroPythonOS/MicroPythonOS |
42 | | - ``` |
| 17 | +``` |
| 18 | +sudo apt update |
| 19 | +sudo apt-get install -y build-essential libffi-dev pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev libaudio-dev libjack-dev libsndio-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev libpipewire-0.3-dev libwayland-dev libdecor-0-dev libv4l-dev |
| 20 | +``` |
43 | 21 |
|
44 | | -2. **Build for Production** (includes preinstalled files): |
| 22 | +## Compile the code |
45 | 23 |
|
46 | | - ``` |
47 | | - ./scripts/build_lvgl_micropython.sh esp32 prod waveshare-esp32-s3-touch-lcd-2 |
48 | | - ``` |
49 | | -
|
50 | | - or, depending on the device you're building for: |
| 24 | +1. **Navigate to the main repository**: |
51 | 25 |
|
52 | 26 | ``` |
53 | | - ./scripts/build_lvgl_micropython.sh esp32 prod fri3d-2024 |
| 27 | + cd ~/MicroPythonOS |
54 | 28 | ``` |
55 | 29 |
|
56 | | -3. **Build for Development** (no preinstalled/frozen files): |
| 30 | +2. **Start the Compilation** |
57 | 31 |
|
58 | 32 | ``` |
59 | 33 | ./scripts/build_lvgl_micropython.sh esp32 dev fri3d-2024 |
|
65 | 39 | ./scripts/build_lvgl_micropython.sh esp32 dev waveshare-esp32-s3-touch-lcd-2 |
66 | 40 | ``` |
67 | 41 |
|
68 | | -## Flashing to ESP32 |
| 42 | +## Install it on an ESP32 |
69 | 43 |
|
70 | | -1. Put your ESP32 in bootloader mode (long-press the BOOT button if running MicroPythonOS). |
| 44 | +1. Put your ESP32 in bootloader |
| 45 | +
|
| 46 | +If you're already in MicroPythonOS: go to Settings - Restart to Bootloader - Bootloader - Save. |
| 47 | +
|
| 48 | +Otherwise, physically keep the "BOOT" (sometimes labeled "START") button pressed while briefly pressing the "RESET" button. |
71 | 49 |
|
72 | 50 | 2. Flash the firmware: |
73 | 51 |
|
74 | 52 | ``` |
75 | 53 | ./scripts/flash_over_usb.sh |
76 | 54 | ``` |
77 | 55 |
|
78 | | -3. For a development build, fill the filesystem with files manually: |
| 56 | + After reset, you should find a MicroPython REPL shell on the serial line. |
| 57 | +
|
| 58 | +3. Run this script to copy the files to the device manually: |
79 | 59 |
|
80 | 60 | ``` |
81 | 61 | ./scripts/install.sh |
|
84 | 64 | ## Notes |
85 | 65 |
|
86 | 66 | - A "dev" build without frozen files is quite a bit slower when starting apps because all the libraries need to be compiled at runtime. |
87 | | -- Ensure your ESP32 is compatible (see [Supported Hardware](../getting-started/supported-hardware.md)). |
| 67 | +- Ensure your ESP32 is compatible (see [Supported Hardware](../getting-started/supported-hardware.md)). If it's not, then you might need the [Porting Guide](../os-development/porting-guide.md). |
88 | 68 | - Refer to [Release Checklist](release-checklist.md) for creating a production release. |
0 commit comments