Search code examples
pythoncmakemicropythonbbc-microbit

Is it possible to compile microbit python code locally?


I am running Ubuntu 22.04 with xorg. I need to find a way to compile microbit python code locally to a firmware hex file. Firstly, I followed the guide here https://microbit-micropython.readthedocs.io/en/latest/devguide/flashfirmware.html.

After a lot of debugging, I got to this point: https://pastebin.com/MGShD31N

However, the file platform.h does exist.

sawntoe@uwubuntu:~/Documents/Assignments/2022/TVP/micropython$ ls /home/sawntoe/Documents/Assignments/2022/TVP/micropython/yotta_modules/mbed-classic/api/platform.h
/home/sawntoe/Documents/Assignments/2022/TVP/micropython/yotta_modules/mbed-classic/api/platform.h
sawntoe@uwubuntu:~/Documents/Assignments/2022/TVP/micropython$ 

At this point, I gave up on this and tried using Mu editor with the AppImage. However, Mu requires wayland, and I am on xorg.

Does anyone have any idea if this is possible? Thanks.


Solution

  • Okay, so elaborating on Peter Till's answer.

    Firstly, you can use uflash:

    uflash path/to/your/code .
    

    Or, you can use microfs:

    ufs put path/to/main.py