micropython/ports/alif
Damien George a43a8ac89e py/mpconfig: Automatically configure thumb2 and float emitter features.
Prior to this commit a port would need to manually configure the
`MICROPY_EMIT_THUMB_ARMV7M` and `MICROPY_EMIT_INLINE_THUMB_FLOAT` options,
based on whether the CPU is Thumb2 and whether it has hardware floating
point support (eg Cortex-M0+ vs Cortex-M3 vs Cortex-M4).

This is error prone, for example on stm32:
- `NUCLEO_G0B1RE` (a Cortex-M0+ MCU) had both enabled even though neither
  options work on that target.
- `NUCLEO_L152RE` (a Cortex-M3 MCU) had both enabled but this target does
  not support hardware floating point.

The change here automatically enables the two options based on built-in
compiler macros.

This change is tested on the following boards:
- alif ALIF_ENSEMBLE: both enabled
- rp2 RPI_PICO: both disabled
- rp2 RPI_PICO2: both enabled
- samd SAMD21_XPLAINED_PRO: both disabled
- samd SAMD_GENERIC_D51X20: both enabled
- stm32 NUCLEO_G0B1RE: both disabled
- stm32 NUCLEO_L152RE: only MICROPY_EMIT_THUMB_ARMV7M enabled
- stm32 PYBD_SF6: both enabled
- stm32 PYBV10: both enabled

Signed-off-by: Damien George <damien@micropython.org>
2026-04-15 15:49:44 +10:00
..
boards alif/boards/OPENMV_AE3: Configure sensor interrupts as GPIO input. 2026-03-04 01:03:45 +11:00
lwip_inc alif/lwip_inc: Refactor lwipopts.h to use extmod's common options. 2025-07-17 13:28:24 +10:00
mbedtls extmod/mbedtls: Factor out mbedtls_hardware_poll() to common code. 2026-03-03 23:43:42 +11:00
mcu alif/ospi_flash: Remove workaround for P10_7 OSPI pinmux issue. 2026-01-04 16:50:11 +11:00
modules alif/modules: Make HE core set /rom as current dir. 2025-04-09 00:22:32 +10:00
tinyusb_port alif/tinyusb_port: Fix _xfer_trb cache alignment. 2026-04-08 16:24:55 +10:00
alif_flash.c alif/alif_flash: Make flash respond to the buffer protocol. 2025-04-09 00:22:32 +10:00
alif.mk alif: Fix ALIF_TOOLS to use $(TOP) and remove unused ALIF_CONFIG. 2026-03-04 00:58:09 +11:00
cyw43_configport.h extmod,alif,mimxrt,rp2,stm32: Create common cyw43 driver config header. 2025-05-08 15:32:05 +10:00
cyw43_port_spi.c alif: Support more fine-grained pin alternate function selection. 2025-04-09 00:22:33 +10:00
fatfs_port.c alif/fatfs_port: Implement get_fattime. 2025-08-15 12:35:21 +10:00
irq.h alif/irq: Add missing IRQ priorities. 2026-03-21 23:58:16 +11:00
machine_adc.c alif/machine_adc: Add basic ADC support. 2025-04-09 00:22:32 +10:00
machine_i2c_target.c alif/machine_i2c_target: Implement I2CTarget class. 2025-08-01 23:03:17 +10:00
machine_i2c.c alif/machine_i2c: Allow changing I2C SCL/SDA pins. 2025-08-01 23:03:17 +10:00
machine_pin.c alif/machine_pin: Add support for machine.Pin IRQ. 2025-07-03 21:26:27 +10:00
machine_pwm.c alif/machine_pwm: Implement machine.PWM. 2026-03-04 01:27:52 +11:00
machine_rtc.c alif/machine_rtc: Factor out RTC helper functions. 2026-03-04 01:03:14 +11:00
machine_spi.c alif/machine_spi: Fix init() to only change requested settings. 2025-10-01 09:31:10 +10:00
machine_uart.c alif/machine_uart: Add machine.UART peripheral support. 2025-04-09 00:22:32 +10:00
main.c alif/machine_pwm: Implement machine.PWM. 2026-03-04 01:27:52 +11:00
Makefile alif: Fix ALIF_TOOLS to use $(TOP) and remove unused ALIF_CONFIG. 2026-03-04 00:58:09 +11:00
modalif.c alif: Support running the port on the HE core. 2025-04-09 00:22:32 +10:00
modalif.h alif: Add initial port to Alif Ensemble MCUs. 2025-04-09 00:22:32 +10:00
modmachine.c alif/modmachine: Implement timeout_ms argument to deepsleep. 2026-03-04 01:03:14 +11:00
modmachine.h alif/machine_rtc: Factor out RTC helper functions. 2026-03-04 01:03:14 +11:00
modtime.c alif/modtime: Implement the rest of the time module. 2025-08-15 12:35:24 +10:00
mpbthciport.c alif/mpuart: Enhance UART to support bits/parity/stop and more IRQs. 2025-04-09 00:22:32 +10:00
mpbthciport.h alif: Integrate cyw43 Bluetooth with NimBLE. 2025-04-09 00:22:32 +10:00
mpconfigport.h py/mpconfig: Automatically configure thumb2 and float emitter features. 2026-04-15 15:49:44 +10:00
mpconfigport.mk alif: Support running the port on the HE core. 2025-04-09 00:22:32 +10:00
mphalport.c ports: Refactor os.urandom(). 2026-02-24 23:36:02 +11:00
mphalport.h ports: Refactor os.urandom(). 2026-02-24 23:36:02 +11:00
mpmetalport.c alif/mpmetalport: Only notify after metal subsystem is init'd. 2025-04-09 00:22:32 +10:00
mpmetalport.h alif/mpmetalport: Use MHU to notify remote cores. 2025-04-09 00:22:32 +10:00
mpnetworkport.c alif: Integrate cyw43 WLAN driver. 2025-04-09 00:22:32 +10:00
mpnimbleport.c alif: Integrate cyw43 Bluetooth with NimBLE. 2025-04-09 00:22:32 +10:00
mpnimbleport.h alif: Integrate cyw43 Bluetooth with NimBLE. 2025-04-09 00:22:32 +10:00
mpremoteprocport.c alif: Implement Open-AMP port backend. 2025-04-09 00:22:32 +10:00
mpu.c alif/mpu: Add MPU region for OSPI1 XIP memory range. 2025-04-09 00:22:33 +10:00
mpu.h alif/mpu: Add MPU region for OSPI1 XIP memory range. 2025-04-09 00:22:33 +10:00
mpuart.c alif: Support more fine-grained pin alternate function selection. 2025-04-09 00:22:33 +10:00
mpuart.h alif/mpuart: Enhance UART to support bits/parity/stop and more IRQs. 2025-04-09 00:22:32 +10:00
msc_disk.c alif/alif_flash: Distinguish between total flash size and FS size. 2025-04-09 00:22:32 +10:00
nosys_stubs.c alif: Link with libnosys. 2025-04-09 00:22:32 +10:00
ospi_ext.c alif/ospi_flash: Restore XIP settings after erase and write. 2025-04-09 00:22:33 +10:00
ospi_ext.h alif/ospi_flash: Restore XIP settings after erase and write. 2025-04-09 00:22:33 +10:00
ospi_flash_settings.h alif/ospi_flash: Add ospi_flash_sleep helper function. 2026-03-04 00:58:09 +11:00
ospi_flash.c alif/ospi_flash: Add ospi_flash_sleep helper function. 2026-03-04 00:58:09 +11:00
ospi_flash.h alif/ospi_flash: Add ospi_flash_sleep helper function. 2026-03-04 00:58:09 +11:00
pendsv.c alif: Add initial port to Alif Ensemble MCUs. 2025-04-09 00:22:32 +10:00
pendsv.h alif: Integrate cyw43 WLAN driver. 2025-04-09 00:22:32 +10:00
qstrdefsport.h alif: Add initial port to Alif Ensemble MCUs. 2025-04-09 00:22:32 +10:00
README.md alif/README: Update README with build instructions. 2025-06-26 13:28:18 +10:00
se_services.c alif/se_services: Add a secondary MHU channel. 2025-04-09 00:22:32 +10:00
se_services.h alif/se_services: Add a secondary MHU channel. 2025-04-09 00:22:32 +10:00
system_tick.c alif/system_tick: Implement optional ARM SysTick support for systick. 2025-04-09 00:22:32 +10:00
system_tick.h alif/system_tick: Implement optional ARM SysTick support for systick. 2025-04-09 00:22:32 +10:00
usbd.c alif/se_services: Use EUI extension for unique id. 2025-04-09 00:22:32 +10:00
vfs_rom_ioctl.c alif/vfs_rom_ioctl: Add vfs_rom_ioctl with support for OSPI and MRAM. 2025-04-09 00:22:32 +10:00

MicroPython port to Alif Ensemble MCUs

This is a port of MicroPython to the Alif Ensemble series of microcontrollers.

Initial development of this Alif port was sponsored by OpenMV LLC.

Features currently supported:

  • UART REPL.
  • TinyUSB with CDC and MSC device support.
  • Octal SPI flash with XIP mode.
  • machine.Pin support with named pins.
  • machine.UART, machine.SPI, machine.I2C, machine.RTC peripherals.
  • WiFi and Bluetooth using cyw43.
  • Dual core support of the HE and HP cores using Open-AMP.
  • Low power modes.

The following more advanced features will follow later:

  • Ethernet support.
  • SDRAM support.
  • Other machine modules.

Build instructions

Before building the firmware for a given board the MicroPython cross-compiler must be built; it will be used to pre-compile some of the built-in scripts to bytecode. The cross-compiler is built and run on the host machine, using:

$ make -C mpy-cross

This command should be executed from the root directory of this repository. All other commands below should be executed from the ports/alif/ directory.

An ARM compiler is required for the build, along with the associated binary utilities. The recommended toolchain version to use with this port is Arm GNU toolchain version 13.3.Rel1. The compiler can be changed using the CROSS_COMPILE variable when invoking make.

Next, the board to build must be selected. The default board is ALIF_ENSEMBLE but any of the names of the subdirectories in the boards/ directory is valid. The board name must be passed as the argument to BOARD= when invoking make.

All boards require certain submodules to be obtained before they can be built. The correct set of submodules can be initialised using (with ALIF_ENSEMBLE as an example of the selected board):

make BOARD=ALIF_ENSEMBLE submodules

Then to build the board's firmware run:

make BOARD=ALIF_ENSEMBLE

The above command should produce binary images in the build-ALIF_ENSEMBLE/ subdirectory (or the equivalent directory for the board specified).

Update the SE Firmware

The SE firmware must be updated before flashing the main firmware to match the version used by MicroPython. This step only needs to be performed once. Connect the board to your PC via the SE UART USB port (on the Ensemble kit, this is labeled PRG USB), then run:

make update-system-package

Note: The board must be power-cycled after this step.

Deploy MicroPython

To flash the firmware, run:

make BOARD=ALIF_ENSEMBLE deploy