Skip to content

Customised Micropython projects

Andrew Leech edited this page Sep 11, 2018 · 3 revisions

Requirements

https://github.com/micropython/micropython/pull/4097 https://github.com/micropython/micropython/pull/3871

Project Tree

project/
    CUSTOM_BOARD/
        mpconfigboard.h
        mpconfigboard.mk
        pins.csv
        stm32f7xx_hal_conf.h
    micropython (submodule)
    libraries/
        omv (submodule)
    Makefile

Makefile

# Out of tree micropython builds

# Select the board to build for: if not given on the command line,
# then default to CUSTOM_BOARD.
BOARD ?= CUSTOM_BOARD

# unix is also tested
PORT ?= stm32

# If the build directory is not given, make it reflect the board name.
BUILD := $(abspath build-$(BOARD)-$(PORT))

BOARD_DIR := $(abspath $(BOARD)/)

ifneq ($(wildcard $(BOARD_DIR)/mpconfigboard.mk),)
include $(BOARD_DIR)/mpconfigboard.mk
endif

# Path relative to the micropython port folder
export USER_C_MODULES = ../../../libraries

MAKE_MICROPYTHON = $(MAKE) -C micropython/ports/$(PORT) BUILD=$(BUILD) BOARD=$(BOARD) BOARD_DIR=$(BOARD_DIR)

all: $(PORT)

stm32:
	$(MAKE_MICROPYTHON) all

unix:
	$(MAKE_MICROPYTHON) deplibs
	$(MAKE_MICROPYTHON) all
	$(MAKE_MICROPYTHON) PROG=$(BUILD)/micropython coverage

clean:
	$(MAKE_MICROPYTHON) clean

Clone this wiki locally