git clone https://github.com/micropython/micropython.git
cd micropython
git submodule update --init --recursive
Purpose:
- Downloads the MicroPython source code
- Initializes required submodules (including TinyUSB)
make -C mpy-cross
Purpose:
- Builds the mpy-cross tool
- Required before building any MicroPython firmware
RP2040 boards are defined in:
ports/rp2/boards/
Example custom board:
ports/rp2/boards/SENSORS/
Minimum required files:
- mpconfigboard.h
- mpconfigboard.mk
File to edit:
ports/rp2/boards/SENSORS/mpconfigboard.h
Example values:
#define MICROPY_HW_BOARD_NAME "SENSORS"
#define MICROPY_HW_USB_MANUFACTURER_STRING "MACH"
#define MICROPY_HW_USB_PRODUCT_STRING "SENSORS RP2040"
#define MICROPY_HW_USB_SERIAL_STRING "SENSORS_001"
Notes:
- Board name appears in os.uname() inside MicroPython
- USB product strings may not be displayed by macOS for CDC devices
cd ports/rp2
make BOARD=SENSORS
Result:
-
Output file:
ports/rp2/build-SENSORS/firmware.uf2
Steps:
- Hold the BOOTSEL button
- Plug in the RP2040 over USB
- A USB mass-storage device appears
- Copy firmware.uf2 to the device
- The board reboots automatically
Open a serial session:
screen /dev/tty.usbmodemXXXX 115200
Inside MicroPython:
import os
os.uname()
Expected output includes:
machine='SENSORS with RP2040'
- MicroPython uses USB CDC-ACM for serial communication
- macOS assigns device names like /dev/tty.usbmodemXXXX automatically
- The USB product name cannot control the /dev name
- Firmware identity is best verified from inside MicroPython
- MicroPython RP2040 builds are board-based
- Board identity is set in mpconfigboard.h
- Firmware is built with make BOARD=
- macOS does not allow custom serial device names for CDC devices
- Successful changes are confirmed using os.uname() inside the REPL