Aatif Shaikh
Aatif Shaikh

Reputation: 345

how to rebuild micropython with selected module?

I'm a bit new to MicroPython, Scripting languages, etc. So currently, I'm working on a project in which I'm using NUCLEO-G431RB(128kb flash and 32kb ram). STM32G43RB is a low-memory microcontroller. Hence, officially, no MicroPython file firmware file is available for this board.

As Micropython is an open-source platform, the code files are available on the website. Therefore, I wanted to know how I could compile Micropython source code with only selected modules (basic hardware peripheral modules) and eliminate all unnecessary modules (Bluetooth, network, etc.).

My overall goal is to have a bare minimum stack (which I can upload on the low-memory controller as well) of Micropython so that I can run a basic code dealing with hardware peripherals and like that. Any lead, hint or link would be helpful and much appreciated.

Upvotes: 0

Views: 329

Answers (1)

stijn
stijn

Reputation: 35901

The key to the answer is py/mpconfig.h. That file lists all PP symbols which can conditionally enable the core code. In your own port's config file, normally named mpconfigport.h, you then #define MICROPY_SOME_FEATURE 0 to disable the feature.

Upvotes: 1

Related Questions