You may want to include a particular module that is not included by default for the board for your board. You can customize which modules to include in your CircuitPython build by adding or changing settings in the mpconfigboard.mk file for your board.

For example, here is the standard circuitpython/ports/atmel-samd/boards/trinket_m0/mpconfigboard.mk file:

USB_VID = 0x239A
USB_PID = 0x801F
USB_PRODUCT = "Trinket M0"
USB_MANUFACTURER = "Adafruit Industries LLC"

CHIP_VARIANT = SAMD21E18A
CHIP_FAMILY = samd21

INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0

Suppose you wanted to turn on pulseio, but you did not need MIDI support. There is not enough room for pulseio in this build, but if you turn other modules, you can make room. Sometimes this will work only for certain languages due to the size of the translation. In this case, for the en_US translation, turning off usb_midi frees up enough space to include pulseio. Add these lines to the file above:

CIRCUITPY_PULSEIO = 1
CIRCUITPY_USB_MIDI = 0

You can figure out which modules are on or off by looking at the module support matrix in the CIrcuitPython documentation. It also helps to study the files circuitpython/py/circuitpy_mpconfig.mk and circuitpympconfig.h, and circuitpython/ports/<your-board's-port>/mpconfigport.mk and mpconfigport.h.

Warning: Don't put Makefile comments on the same line as Makefile assignments. I causes the variable value to include the trailing spaces before comment character

This guide was first published on Apr 26, 2018. It was last updated on Mar 25, 2024.

This page (Customizing Included Modules) was last updated on Mar 23, 2024.

Text editor powered by tinymce.