From 7584c691f7bb8426149d73f97398bb6cdbc51069 Mon Sep 17 00:00:00 2001 From: Artem Dychenko Date: Sat, 11 Apr 2026 14:49:11 +0200 Subject: [PATCH] Add manifest files, add required __init__.py for modules for freezing purposes, update readme --- README.md | 49 ++++++++++++++++++- app/__init__.py | 0 app/selection_management/selection_manager.py | 4 +- manifest_debug.py | 8 +++ manifest_release.py | 9 ++++ pyproject.toml | 2 + utils/__init__.py | 0 7 files changed, 68 insertions(+), 4 deletions(-) create mode 100644 app/__init__.py create mode 100644 manifest_debug.py create mode 100644 manifest_release.py create mode 100644 utils/__init__.py diff --git a/README.md b/README.md index 2ee6f45..d361dc2 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,52 @@ pre-commit install - **Right-click** on the file you want to upload in the side panel (or folder/project view). - In the context menu that appears, select **Upload File to Pico** -#### 11. Run the Script +> You don't need all files on board. You only need: app, config, lib, utils directories and main.py -- **Right-click** on the file you want to run In Mpy Remote Workspace. +#### 11. Run the Program + +- **Right-click** on the main.py in Mpy Remote Workspace. - In the context menu that appears, select **run current file on Pico** + +> Alternatively, right-click main.py in the MicroPython Remote Workspace, then click the Run button at the bottom. + +### How to freeze code and make firmware for raspberry pi pico W board + +#### 1. Git clone micropython repo + +``` +git clone https://github.com/micropython/micropython.git +``` + +#### 2. Go inside cloned directory and build the MicroPython cross-compiler + +``` +cd micropython +make -C mpy-cross +``` + +#### 3. Build the firmware + +``` +make BOARD=RPI_PICO_W submodules +make BOARD=RPI_PICO_W clean +make -j $(nproc) BOARD=RPI_PICO_W FROZEN_MANIFEST=/path/to/manifest.py/file/inside/ISMU/directory +``` + +> The ISMU directory contains two manifest files. One includes main.py (manifest_release.py) to auto-start the program on power-up, while the other excludes it so you can run the code manually from an IDE. + +#### 4. Deploying firmware to the device + +Firmware can be deployed to the device by putting it into bootloader mode +(hold down BOOTSEL while powering on or resetting) and then either copying +`firmware.uf2` to the USB mass storage device that appears. + +> You can find firmware.uf2 inside build-RPI_PICO_W directory. (schematic path : micropython/ports/rp2/build-RPI_PICO_W) + +#### 5. Cleaning unnecessary files from Mpy Remote Workplace + +After loading compiled code to firmware, you don't need anymore app, lib, utils directories and main.py(if you used manifest_release.py), so you can remove it from there. In config directory you need to have: char_map.json, lang.py(font), lang.json(language file). + +### How to make lang.py - font file for project + +todo diff --git a/app/__init__.py b/app/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/app/selection_management/selection_manager.py b/app/selection_management/selection_manager.py index 1d5ca9a..6b6c8a9 100644 --- a/app/selection_management/selection_manager.py +++ b/app/selection_management/selection_manager.py @@ -8,8 +8,8 @@ from utils.error_handler import set_error_and_raise from utils.singleton_decorator import singleton -SELECTION_PATH = "app/selection_management/selection.json" -TEMP_SELECTION_PATH = "app/selection_management/selection.tmp" +SELECTION_PATH = "/config/selection.json" +TEMP_SELECTION_PATH = "/config/selection.tmp" class TripInfo: diff --git a/manifest_debug.py b/manifest_debug.py new file mode 100644 index 0000000..9f74ea3 --- /dev/null +++ b/manifest_debug.py @@ -0,0 +1,8 @@ +include("$(PORT_DIR)/boards/manifest.py") + +package("app", opt=2) +package("utils", opt=2) + +module("microdot.py", base_path="lib", opt=2) +module("sh1106.py", base_path="lib", opt=2) +module("writer.py", base_path="lib", opt=2) diff --git a/manifest_release.py b/manifest_release.py new file mode 100644 index 0000000..84835d8 --- /dev/null +++ b/manifest_release.py @@ -0,0 +1,9 @@ +include("$(PORT_DIR)/boards/manifest.py") + +package("app", opt=2) +package("utils", opt=2) + +module("microdot.py", base_path="lib", opt=2) +module("sh1106.py", base_path="lib", opt=2) +module("writer.py", base_path="lib", opt=2) +module("main.py", opt=2) diff --git a/pyproject.toml b/pyproject.toml index 4c0e21f..2569522 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,6 +5,8 @@ exclude = [ "lib/", "config/", "typings/", + "manifest_debug.py", + "manifest_release.py", ] preview = true diff --git a/utils/__init__.py b/utils/__init__.py new file mode 100644 index 0000000..e69de29