Custom firmware #11612
Replies: 10 comments 13 replies
-
First answer: read the documents about making custom firmware. For instance: https://github.com/micropython/micropython-example-boards You can configure the various pieces that are included in the build using Second answer: if you have |
Beta Was this translation helpful? Give feedback.
-
Greetings, I had some similar questions a few months back. Currently, what I do is convert all .py to .mpy. This means I have the build environment setup there, and I call into with a batch script, which runs a shell script. I also build a custom firmware for my board, and in my build structure since I'm targeting ESP32's I have this folder: There is a file there called
Here is the batch snippet:
Here is the bash snippet:
This does mean I have a reasonably long bash file that adds my different directories, which I'm sure I could do better with some clever bash if only I knew some... This post where I'm asking how to freeze assets into the firmware may also be useful to you: |
Beta Was this translation helpful? Give feedback.
-
You may find this useful. I keep meaning to write my "1st" blog post with it, (well I mean that is mostly written, but my sites SSL cert expired and I have not had time to fix) but that hasn't happened, lol. Setting up a MicroPython firmware build environment on (WSL & Debian)These instructions should work for both Windows Subsystem for Linux and Debian Linux distributions. Minor changes would need to be made for other *nix distributions and macOS. While it is theoretically possible to setup the toolchains in native windows, it is much more difficult and error prone to do so.
Referenceshttps://github.com/micropython/micropython/blob/master/ports/esp32/README.md |
Beta Was this translation helpful? Give feedback.
-
Converting .py files to .mpy files with mpy-crossMicroPython defines the concept of an .mpy file which is a binary container file format that holds precompiled code, and which can be imported like a normal .py module. The file foo.mpy can be imported via import foo
Referenceshttps://docs.micropython.org/en/latest/reference/mpyfiles.html |
Beta Was this translation helpful? Give feedback.
-
For instructions on how to build CircuitPython with variations, we keep an Adafruit Learn Guide, with a lot of details, that requires frequent updating: https://learn.adafruit.com/building-circuitpython. Given that MicroPython does not have a Learn Guide infrastructure, perhaps turning on the GitHub Wiki might create a place for this kind of thing? |
Beta Was this translation helpful? Give feedback.
-
@Alain-Godo the high level-answer is that any sort of customisation of the firmware build involves writing what we call a "board definition". As @ned-pcs linked to, the reference for this is https://github.com/micropython/micropython-example-boards but yes it definitely needs a lot more work. (And we need to link to this from the main documentation). I do hope to be able to spend some time on this as part of the Google Season of Docs sponsored work in the next few months. In your case you board definition needs to define frozen modules/packages by specifying them in the board's manifest. As already pointed out, even compiling to .mpy (and freezing) does not prevent someone getting access to your code, it just changes the level of difficulty. If all you want to do is make it more difficult then just disabling USB filesystem access might be enough. @dhalbert We do have the GitHub wiki enabled -- https://github.com/micropython/micropython/wiki . Anyone with a GitHub account should be able to create/modify pages there. |
Beta Was this translation helpful? Give feedback.
-
Hello, I have a problem to build firmware in ubuntu for esp32, especially with missing idf.py. I download esp-idf I got this message: `/mnt/c/Users/mkned/micropython/ports/esp32$ idf.py build Executing action: all (aliases: build) CMake Warning at esp-idf/tools/cmake/git_submodules.cmake:52 (message): -- The C compiler identification is GNU 12.2.0 -- Configuring incomplete, errors occurred! Do you have any advice? |
Beta Was this translation helpful? Give feedback.
-
There used to be a docker container for building custom firmware. I build my own on my other computer. Is there need for something like this? |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Hi everyone !!! I come back with a new question related to the topic, this time a little more ambitious and really really interesting!!! Is possible to allow coexist MicroPython and a firmware (.bin) written in C/C++ on the same board? I'm talking about something like using the boot.py and then running a separate segment of memory with the Arduino compiled program. Is there someone with any insight about this? Because this opens a lot of doors!! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
First of all, sorry if my English is not the best. I have two main questions, both in relation. How can I modify the MicroPython firmware before uploading it to the device? For example, I have an ESP-32 and my code is created in .py and .mpy files, but I don't need to use the typical structure of boot.py/main.py, and more important: I want to integrate the code with the firmware to just upload all the code as a single piece one time.
The other question is, how can I protect the code to avoid it reading at least in a simple way like we now can do in an IDE with the .py files?
Beta Was this translation helpful? Give feedback.
All reactions