Skip to content

Commit 4ad51c0

Browse files
dpgeorgeiabdalkader
authored andcommitted
ports/alif/: Add Alif port.
Signed-off-by: Damien George <damien@micropython.org> Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
1 parent 0da0fd6 commit 4ad51c0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+10665
-5
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
*.dxf binary
1515
*.mpy binary
1616
*.der binary
17+
*.bin binary
18+
*.bin.sign binary
1719

1820
# These should also not be modified by git.
1921
tests/basics/string_cr_conversion.py -text

.github/workflows/ports_alif.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: alif port
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '.github/workflows/*.yml'
7+
- 'tools/**'
8+
- 'py/**'
9+
- 'extmod/**'
10+
- 'shared/**'
11+
- 'lib/**'
12+
- 'drivers/**'
13+
- 'ports/alif/**'
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
build_stm32:
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
ci_func: # names are functions in ci.sh
25+
- alif_ae3_build
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
- name: Install packages
30+
run: source tools/ci.sh && ci_alif_setup
31+
- name: Build ci_${{matrix.ci_func }}
32+
run: source tools/ci.sh && ci_${{ matrix.ci_func }}
33+

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,9 @@
6868
[submodule "lib/arduino-lib"]
6969
path = lib/arduino-lib
7070
url = https://github.com/arduino/arduino-lib-mpy.git
71+
[submodule "lib/alif_ensemble-cmsis-dfp"]
72+
path = lib/alif_ensemble-cmsis-dfp
73+
url = https://github.com/alifsemi/alif_ensemble-cmsis-dfp.git
74+
[submodule "lib/alif-security-toolkit"]
75+
path = lib/alif-security-toolkit
76+
url = https://github.com/micropython/alif-security-toolkit.git

extmod/extmod.mk

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,15 +454,14 @@ CYW43_DIR = lib/cyw43-driver
454454
GIT_SUBMODULES += $(CYW43_DIR)
455455
CFLAGS_EXTMOD += -DMICROPY_PY_NETWORK_CYW43=1
456456
SRC_THIRDPARTY_C += $(addprefix $(CYW43_DIR)/src/,\
457+
cyw43_bthci_uart.c \
457458
cyw43_ctrl.c \
458459
cyw43_lwip.c \
459460
cyw43_ll.c \
460461
cyw43_sdio.c \
462+
cyw43_spi.c \
461463
cyw43_stats.c \
462464
)
463-
ifeq ($(MICROPY_PY_BLUETOOTH),1)
464-
DRIVERS_SRC_C += drivers/cyw43/cywbt.c
465-
endif
466465

467466
$(BUILD)/$(CYW43_DIR)/src/cyw43_%.o: CFLAGS += -std=c11
468467
endif # MICROPY_PY_NETWORK_CYW43

lib/alif-security-toolkit

Submodule alif-security-toolkit added at 63698ef

lib/alif_ensemble-cmsis-dfp

Submodule alif_ensemble-cmsis-dfp added at 04b3176

ports/alif/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.crt
2+
*.cfg

ports/alif/Makefile

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
BOARD ?= ALIF_ENSEMBLE
2+
BOARD_DIR ?= boards/$(BOARD)
3+
BUILD ?= build-$(BOARD)
4+
MCU_CORE ?= M55_HP
5+
GIT_SUBMODULES += lib/tinyusb lib/alif_ensemble-cmsis-dfp lib/alif-security-toolkit
6+
PORT ?= /dev/ttyACM0
7+
8+
ALIF_TOOLS ?= ../../lib/alif-security-toolkit/toolkit
9+
10+
JLINK_CMD_PREFIX = \
11+
ExitOnError 1\n\
12+
Device $(JLINK_DEV)\n\
13+
SelectInterface SWD\n\
14+
Speed auto\n\
15+
Connect\n\
16+
Reset\n\
17+
ShowHWStatus\n
18+
19+
JLINK_CMD_SUFFIX = \
20+
Reset\n\
21+
Exit
22+
23+
ALIF_TOC_CONFIG = alif_cfg.json
24+
ALIF_TOC_APPS = $(BUILD)/$(ALIF_TOC_CONFIG)
25+
ALIF_TOC_CFLAGS += -DTOC_CFG_FILE=$(ALIF_TOOLKIT_CFG_FILE)
26+
27+
ifeq ($(MCU_CORE),M55_HP)
28+
29+
ALIF_TOC_CFLAGS += -DTOC_CORE_M55_HP_APP=1
30+
ALIF_TOC_APPS += $(BUILD)/M55_HP/firmware.bin
31+
JLINK_CMD = '\
32+
$(JLINK_CMD_PREFIX)\
33+
LoadFile "$(BUILD)/M55_HP/firmware.bin",0x80020000\n\
34+
$(JLINK_CMD_SUFFIX)'
35+
36+
else ifeq ($(MCU_CORE),M55_HE)
37+
38+
ALIF_TOC_CFLAGS += -DTOC_CORE_M55_HE_APP=1
39+
ALIF_TOC_APPS += $(BUILD)/M55_HE/firmware.bin
40+
JLINK_CMD = '\
41+
$(JLINK_CMD_PREFIX)\
42+
LoadFile "$(BUILD)/M55_HE/firmware.bin",0x80320000\n\
43+
$(JLINK_CMD_SUFFIX)'
44+
45+
else ifeq ($(MCU_CORE),M55_DUAL)
46+
47+
ALIF_TOC_CFLAGS += -DTOC_CORE_M55_HP_APP=1
48+
ALIF_TOC_CFLAGS += -DTOC_CORE_M55_HE_APP=1
49+
ALIF_TOC_APPS += $(BUILD)/M55_HP/firmware.bin $(BUILD)/M55_HE/firmware.bin
50+
JLINK_CMD = '\
51+
$(JLINK_CMD_PREFIX)\
52+
LoadFile "$(BUILD)/M55_HP/firmware.bin",0x80020000\n\
53+
LoadFile "$(BUILD)/M55_HE/firmware.bin",0x80320000\n\
54+
$(JLINK_CMD_SUFFIX)'
55+
56+
else
57+
$(error Invalid MCU core specified))
58+
endif
59+
60+
include ../../py/mkenv.mk
61+
include mpconfigport.mk
62+
include $(BOARD_DIR)/mpconfigboard.mk
63+
64+
# include py core make definitions
65+
include $(TOP)/py/py.mk
66+
include $(TOP)/extmod/extmod.mk
67+
68+
################################################################################
69+
# Main targets
70+
71+
.PHONY: all
72+
all: $(BUILD)/firmware.toc.bin
73+
74+
# Force make commands to run the targets every time
75+
# regardless of whether firmware.toc.bin already exists
76+
# to detect changes in the source files and rebuild.
77+
.PHONY: $(BUILD)/M55_HE/firmware.bin
78+
.PHONY: $(BUILD)/M55_HP/firmware.bin
79+
80+
$(BUILD):
81+
$(MKDIR) -p $@
82+
83+
$(BUILD)/M55_HP/firmware.bin:
84+
make -f alif.mk MCU_CORE=M55_HP MICROPY_PY_OPENAMP_MODE=0
85+
86+
$(BUILD)/M55_HE/firmware.bin:
87+
make -f alif.mk MCU_CORE=M55_HE MICROPY_PY_OPENAMP_MODE=1
88+
89+
$(BUILD)/$(ALIF_TOC_CONFIG): mcu/$(ALIF_TOC_CONFIG).in | $(BUILD)
90+
$(ECHO) "Preprocess toc config $@"
91+
$(Q)$(CPP) -P -E $(ALIF_TOC_CFLAGS) - < mcu/$(ALIF_TOC_CONFIG).in > $@
92+
93+
$(BUILD)/firmware.toc.bin: $(ALIF_TOC_APPS)
94+
$(Q)python $(ALIF_TOOLS)/app-gen-toc.py \
95+
--filename $(abspath $(BUILD)/$(ALIF_TOC_CONFIG)) \
96+
--output-dir $(BUILD) \
97+
--firmware-dir $(BUILD) \
98+
--output $@
99+
100+
.PHONY: deploy
101+
deploy: $(BUILD)/firmware.toc.bin
102+
$(ECHO) "Writing $< to the board"
103+
$(Q)python $(ALIF_TOOLS)/app-write-mram.py \
104+
--cfg-part $(ALIF_TOOLKIT_CFG_PART) \
105+
--port $(PORT) \
106+
--pad \
107+
--images file:$(BUILD)/application_package.ds
108+
109+
.PHONY: deploy-jlink
110+
deploy-jlink: $(ALIF_TOC_APPS)
111+
$(Q)echo -e $(JLINK_CMD) | $(JLINK_EXE)
112+
113+
.PHONY: maintenance
114+
maintenance:
115+
$(Q)python $(ALIF_TOOLS)/maintenance.py \
116+
--cfg-part $(ALIF_TOOLKIT_CFG_PART) \
117+
--port $(PORT)
118+
119+
.PHONY: update-system-package
120+
update-system-package:
121+
$(Q)python $(ALIF_TOOLS)/updateSystemPackage.py \
122+
--cfg-part $(ALIF_TOOLKIT_CFG_PART) \
123+
--port $(PORT)
124+
125+
include $(TOP)/py/mkrules.mk

ports/alif/README.MD

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MicroPython port to Alif Ensemble MCUs
2+
======================================
3+
4+
This is a port of MicroPython to the Alif Ensemble series of microcontrollers.
5+
6+
Initial development of this Alif port was sponsored by OpenMV LLC.
7+
8+
## Basic Features:
9+
* pin support, named pins, AFs, find_pin etc..
10+
* pendsv/systick drivers, dispatch etc..
11+
* machine_(uart/spi/i2c/led).
12+
* Octal SPI Flash.- VFS/FatFS/storage support.
13+
* TinyUSB support CDC + MSC device support (MSC will use the OSPI flash).
14+
* Bluetooth + wifi using CYW43 in SPI mode.
15+
* More machine modules ?
16+
17+
## The following "advanced features" will follow later:
18+
* Ethernet support.
19+
* Dual core support HE/HP.
20+
* SDRAM support.
21+
* Deepsleep/low power mode.
22+
* Other machine modules.

0 commit comments

Comments
 (0)