Files
micropython/ports/alif/modules/_boot.py
Damien George ccc5935234 alif: Add initial port to Alif Ensemble MCUs.
This commit adds the beginning of a new alif port with support for Alif
Ensemble MCUs.  See https://alifsemi.com/

Supported features of this port added by this commit:
- UART REPL.
- TinyUSB support, for REPL and MSC.
- Octal SPI flash support, for filesystem.
- machine.Pin support.

General notes about the port:
- It uses make, similar to other bare-metal ports here.
- The toolchain is the standard arm-none-eabi- toolchain.
- Flashing a board can be done using either the built-in serial bootloader,
  or JLink (both supported here).
- There are two required submodules (one for drivers/SDK, one for security
  tools), both of which are open source and on GitHub.
- No special hardware or software is needed for development, just a board
  connected over USB.

OpenMV have generously sponsored the development of this port.

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-04-09 00:22:32 +10:00

24 lines
558 B
Python

import sys, os, alif
bdev = alif.Flash()
if hasattr(alif, "usb_msc"):
try:
# This may fail on VfsFat construction, or mount.
os.mount(os.VfsFat(bdev), "/flash")
except:
os.VfsFat.mkfs(bdev)
os.mount(os.VfsFat(bdev), "/flash")
else:
try:
os.mount(os.VfsLfs2(bdev, progsize=256), "/flash")
except:
os.VfsLfs2.mkfs(bdev, progsize=256)
os.mount(os.VfsLfs2(bdev, progsize=256), "/flash")
sys.path.append("/flash")
sys.path.append("/flash/lib")
os.chdir("/flash")
del sys, os, alif, bdev