You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/os-development/compiling.md
+4-14Lines changed: 4 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,29 +12,19 @@
12
12
13
13
<pre>
14
14
```
15
-
./scripts/build_mpos.sh <target system> <build type (prod or dev)> [optional target device]
15
+
./scripts/build_mpos.sh <target system>
16
16
```
17
17
</pre>
18
18
19
19
**Target systems**: `esp32`, `unix` (= Linux) and `macOS`
20
20
21
-
**Build types**:
22
-
23
-
- A `prod` build includes the complete filesystem that's "frozen" into the build, so it's fast and all ready to go but the files in /lib and /builtin will be read-only.
24
-
- A `dev` build comes without a filesystem, so it's perfect for power users that want to work on MicroPythonOS internals. There's a simple script that will copy all the necessary files over later, and these will be writeable.
25
-
26
-
_Note_: for unix and macOS systems, only `dev` has been tested. The `prod` builds might have issues but should be made to work soon.
27
-
28
-
**Target devices**: `waveshare-esp32-s3-touch-lcd-2` or `fri3d-2024`
29
-
30
21
**Examples**:
31
22
32
23
<pre>
33
24
```
34
-
./scripts/build_mpos.sh esp32 prod fri3d-2024
35
-
./scripts/build_mpos.sh esp32 dev waveshare-esp32-s3-touch-lcd-2
5. **Populate the filesystem** (only for "dev" builds)
37
+
5. **Populate the filesystem** (only for development)
37
38
38
-
The "dev" builds come without a filesystem so you probably want to copy:
39
+
In development, you probably want to override the "frozen" libraries and apps that are compiled in, and replace them with source files, which you can edit.
39
40
40
-
- the whole internal_filesystem/ folder, including main.py
41
-
- the appropriate device-specific internal_filesystem/boot*.py file to /boot.py on the device
42
-
43
41
There's a convenient script that will do this for you.
44
42
45
43
Usage:
46
44
47
45
<pre>
48
46
```
49
-
./scripts/install.sh <target device>
47
+
./scripts/install.sh
50
48
```
51
49
</pre>
52
50
53
-
**Target devices**: waveshare-esp32-s3-touch-lcd-2 or fri3d-2024
- A "dev" build without frozen files is quite a bit slower when starting apps because all the libraries need to be compiled at runtime.
68
63
- 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).
Copy file name to clipboardExpand all lines: docs/os-development/porting-guide.md
+12-10Lines changed: 12 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,23 +10,26 @@ If you prefer to have the porting work done for you and you're open to making a
10
10
11
11
## What to write
12
12
13
-
By design, the only device-specific code for MicroPythonOS is found in the ```internal_filesystem/boot*.py``` files.
13
+
By design, the only device-specific code for MicroPythonOS is found in the ```internal_filesystem/lib/mpos/board/<boardname>.py``` files.
14
+
14
15
15
16
## Steps to port to a new device
16
17
17
18
1. Compile [lvgl_micropython](https://github.com/lvgl-micropython/lvgl_micropython) for the new device.
18
19
19
20
The goal is to have it boot and show a MicroPython REPL shell on the serial line.
20
21
21
-
Take a look at our [build_mpos.sh](https://github.com/MicroPythonOS/MicroPythonOS/blob/main/scripts/build_mpos.sh) script. A "dev" build (without any "frozen" filesystem) is preferred as this will still change a lot.
22
+
Take a look at our [build_mpos.sh](https://github.com/MicroPythonOS/MicroPythonOS/blob/main/scripts/build_mpos.sh) script.
22
23
23
24
Also go over the [official lvgl_micropython documentation](https://github.com/lvgl-micropython/lvgl_micropython/blob/main/README.md) for porting instructions. If you're in luck, your device is already listed in the esp32 BOARD list. Otherwise use a generic one like `BOARD=ESP32_GENERIC` with `BOARD_VARIANT=SPIRAM` or `BOARD=ESP32_GENERIC_S3` with `BOARD_VARIANT=SPIRAM_OCT` if it has an SPIRAM.
24
25
25
26
2. Figure out how to initialize the display for the new device
26
27
27
-
Use the MicroPython REPL shell on the serial port to type or paste (CTRL-E) MicroPython code.
28
+
Use the MicroPython REPL shell on the serial port to type or paste (CTRL-E) MicroPython code manually at first to see what works.
28
29
29
-
Check out how it's done for the [Waveshare 2 inch Touch Screen](https://github.com/MicroPythonOS/MicroPythonOS/blob/main/internal_filesystem/boot.py) and for the [Fri3d Camp 2024 Badge](https://github.com/MicroPythonOS/MicroPythonOS/blob/main/internal_filesystem/boot_fri3d-2024.py). You essentially need to set the correct pins to which the display is connected (like `LCD_SCLK`, `LCD_MOSI`, `LCD_MOSI` etc.) and also set the resolution of the display (`TFT_HOR_RES`, `TFT_VER_RE`S).
30
+
Take a look at [```waveshare_esp32_s3_touch_lcd_2.py```](https://github.com/MicroPythonOS/MicroPythonOS/blob/main/internal_filesystem/lib/mpos/board/waveshare_esp32_s3_touch_lcd_2.py) or [```fri3d_2024.py```](https://github.com/MicroPythonOS/MicroPythonOS/blob/main/internal_filesystem/lib/mpos/board/fri3d-2024.py).
31
+
32
+
You essentially need to set the correct pins to which the display is connected (like `LCD_SCLK`, `LCD_MOSI`, `LCD_MOSI` etc.) and also set the resolution of the display (`TFT_HOR_RES`, `TFT_VER_RE`S).
30
33
31
34
After a failed attempt, reset the device to make sure the hardware is in a known initial state again.
32
35
@@ -47,17 +50,16 @@ By design, the only device-specific code for MicroPythonOS is found in the ```in
47
50
```
48
51
</pre>
49
52
50
-
3. Put the initialization code in a custom boot_...py file for your device
53
+
3. Put the initialization code in a custom ```<boardname>.py``` file for your device
51
54
52
-
4. Copy the custom boot_...py file and the generic MicroPythonOS files to your device (see [install.sh](https://github.com/MicroPythonOS/MicroPythonOS/blob/main/scripts/install.sh)
55
+
4. Copy the custom ```<boardname>.py``` file and the generic MicroPythonOS files to your device (see [install.sh](https://github.com/MicroPythonOS/MicroPythonOS/blob/main/scripts/install.sh)
53
56
54
-
After reset, your custom boot_...py file should initialize the display and then MicroPythonOS should start, run the launcher, which shows the icons etc.
57
+
After reset, your custom ```<boardname>.py``` file should initialize the display and then MicroPythonOS should start, run the launcher, which shows the icons etc.
55
58
56
59
5. Add more hardware support
57
60
58
-
If your device has a touch screen, check out how it's initialized for the [Waveshare 2 inch Touch Screen](https://github.com/MicroPythonOS/MicroPythonOS/blob/main/internal_filesystem/boot.py).
59
-
If it has buttons for input, check out the KeyPad code for the [Fri3d Camp 2024 Badge](https://github.com/MicroPythonOS/MicroPythonOS/blob/main/internal_filesystem/boot_fri3d-2024.py).
61
+
If your device has a touch screen, check out how it's initialized for the [Waveshare 2 inch Touch Screen](https://github.com/MicroPythonOS/MicroPythonOS/blob/main/internal_filesystem/lib/mpos/board/waveshare_esp32_s3_touch_lcd_2.py). If it has buttons for input, check out the KeyPad code for the [Fri3d Camp 2024 Badge](https://github.com/MicroPythonOS/MicroPythonOS/blob/main/internal_filesystem/lib/mpos/board/fri3d-2024.py).
60
62
61
63
Now you should be able to control the device, connect to WiFi and install more apps from the AppStore.
62
64
63
-
This would be a good time to create a pull-request to merge your boot_...py file into the main codebase so the support becomes official!
65
+
This would be a good time to create a pull-request to merge your ```<boardname>.py``` file into the main codebase so the support becomes official!
0 commit comments