This is a game engine for embedded devices that can run MicroPython.
These instructions assume that you are cloning MicroPython from the TinyCircuits Fork that has been pre-modified
- Install SDL2:
sudo apt install libsdl2-dev
- Install build tools:
sudo apt install build-essential
- Clone TinyCircuits MicroPython:
git clone https://github.com/TinyCircuits/micropython.git mp-thumby
cd
into MicroPython:cd mp-thumby
- Checkout engine branch:
git checkout engine-1.23.0
- Clone latest engine module code with
lib
submodules:git clone --recurse-submodules https://github.com/TinyCircuits/TinyCircuits-Tiny-Game-Engine.git
- Setup UNIX port:
cd ports/unix
make submodules
cd
to engine file system to build and run MicroPython and the enginecd
:cd ../../TinyCircuits-Tiny-Game-Engine/filesystem
- build:
(cd ../../ports/unix && make -j8 USER_C_MODULES=../../TinyCircuits-Tiny-Game-Engine DEBUG=1)
- run:
../micropython_loop ../../ports/unix/build-standard/micropython -X heapsize=532480 main.py
Use (cd ../../ports/unix && make clean)
to make clean if needed
These instructions assume that you are cloning MicroPython from the official MicroPython repository and not the TinyCircuits Fork
- Install SDL2:
sudo apt install libsdl2-dev
- Install build tools:
sudo apt install build-essential
- Clone MicroPython:
git clone https://github.com/micropython/micropython.git
cd
into MicroPython:cd micropython
- Reset to MicroPython version 1.23.0:
git reset --hard a61c446
- Clone latest engine module code with
lib
submodules:git clone --recurse-submodules https://github.com/TinyCircuits/TinyCircuits-Tiny-Game-Engine.git
- Setup UNIX port:
cd ports/unix
make submodules
- Inside
micropython/ports/unix/variants/mpconfigvariant_common.h
do:- Change
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE)
->#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
- Change
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
->#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_LONGLONG)
- Add
#define MICROPY_TRACKED_ALLOC (1)
anywhere
- Change
- UGLY: inside
micropython/tools/mpy-tool.py
- Change line 1784 to
default="longlong"
(don't know where this tool is used and how to pass it a different value, will just set it for now)
- Change line 1784 to
cd
to filesystem root:cd micropython/TinyCircuits-Tiny-Game-Engine/filesystem
- Build MicroPython UNIX port:
(cd ../../ports/unix && make -j8 USER_C_MODULES=../../TinyCircuits-Tiny-Game-Engine DEBUG=1)
- Run MicroPython port:
../micropython_loop ../../ports/unix/build-standard/micropython -X heapsize=532480 main.py
Use (cd ../../ports/unix && make clean)
to make clean if needed
Make sure to check that the copied structures in src/utility/engine_mp.h are still the same in the version of MicroPython you're updating to. Some structures are not exposed so they had to be copied to where the engine can use them.
- Download and compile https://github.com/raspberrypi/picotool (requires pico-sdk be installed in default known location or pass
-DPICO_SDK_PATH=
tocmake
) - Upload a firmware and all files that should be included to Thumby Color
- Connect Thumby Color to computer with picotool installed in BOOTSEL mode (turn off, press and hold down DPAD direction, turn back on)
- Run:
sudo ./picotool save -r 0x10000000 0x11000000 thumby_color_dev_kit_full_image_08_20_2024.bin
(saves fromXIP_BASE
to16MiB
s after to bin file) - Run:
sudo ./picotool uf2 convert thumby_color_dev_kit_full_image_08_20_2024.bin thumby_color_dev_kit_full_image_08_20_2024.uf2