Remove old build flags, add fixes for shared_matrix

This commit is contained in:
Lucian Copeland 2020-04-20 09:44:16 -04:00
parent 25245bc442
commit d0a2106547
5 changed files with 113 additions and 167 deletions

View File

@ -1,5 +1,5 @@
We love CircuitPython and would love to see it come to more microcontroller
platforms. With 3.0 we've reworked CircuitPython to make it easier than ever to
platforms. Since 3.0 we've reworked CircuitPython to make it easier than ever to
add support. While there are some major differences between ports, this page
covers the similarities that make CircuitPython what it is and how that core
fits into a variety of microcontrollers.
@ -19,7 +19,7 @@ prepping file systems and automatically running user code on boot. In
CircuitPython we've dubbed this component the supervisor because it monitors
and facilitates the VMs which run user Python code. Porting involves the
supervisor because many of the tasks it does while interfacing with the
hardware. Once its going though, the REPL works and debugging can migrate to a
hardware. Once complete, the REPL works and debugging can migrate to a
Python based approach rather than C.
The third core piece is the plethora of low level APIs that CircuitPython
@ -42,6 +42,43 @@ to the port's directory (in the top level until the ``ports`` directory is
present). This includes the Makefile and any C library resources. Make sure
these resources are compatible with the MIT License of the rest of the code!
Circuitpython has a number of modules enabled by default in
``py/circuitpy_mpconfig.mk``. Most of these modules will need to be disabled in
``mpconfigboard.mk`` during the early stages of a port in order for it to
compile. As the port progresses in module support, this list can be pruned down
as a natural "TODO" list. An example minimal build list is shown below:
.. code-block:: makefile
# Items requiring ports/<port>/common-hal implementation:
CIRCUITPY_MICROCONTROLLER = 0 # Typically the first module to create
CIRCUITPY_DIGITALIO = 0 # Typically the second module to create
CIRCUITPY_ANALOGIO = 0
CIRCUITPY_BUSIO = 0
CIRCUITPY_NEOPIXEL_WRITE = 0
CIRCUITPY_PULSEIO = 0
CIRCUITPY_OS = 0
CIRCUITPY_NVM = 0
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_AUDIOIO = 0
CIRCUITPY_ROTARYIO = 0
CIRCUITPY_RTC = 0
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_I2CSLAVE = 0
CIRCUITPY_DISPLAYIO = 0 # Requires SPI, PulseIO (stub ok)
# Modules with no common-hal implementation, but depend on something else
CIRCUITPY_BITBANGIO = 0 # Requires DigitalIO
CIRCUITPY_GAMEPAD = 0 # Requires DigitalIO
CIRCUITPY_PIXELBUF = 0 # Does nothing without a neopixel or dotstar
CIRCUITPY_RANDOM = 0 # Requires OS
CIRCUITPY_STORAGE = 0 # Requires OS, filesystem
CIRCUITPY_TOUCHIO = 0 # Requires Microcontroller
CIRCUITPY_USB_HID = 0 # Requires USB
CIRCUITPY_USB_MIDI = 0 # Requires USB
CIRCUITPY_REQUIRE_I2C_PULLUPS = 0 # Does nothing without I2C
CIRCUITPY_ULAB = 0 # No requirements, but takes extra flash
Step 2: Init
--------------
Once your build is setup, the next step should be to get your clocks going as

View File

@ -26,7 +26,7 @@ import os
import re
SUPPORTED_PORTS = ["atmel-samd", "nrf", "stm32f4", "mimxrt10xx"]
SUPPORTED_PORTS = ["atmel-samd", "nrf", "stm", "mimxrt10xx"]
def parse_port_config(contents, chip_keyword=None):
@ -140,6 +140,9 @@ def get_excluded_boards(base):
chip_keyword = "CHIP_FAMILY"
elif port in ["nrf"]:
re_board_chip = re.compile("MCU_VARIANT\s=\s(\w+)")
elif port in ["stm"]:
re_board_chip = re.compile("MCU_SERIES\s*=\s*(\w+)")
chip_keyword = "MCU_SERIES"
port_dir = "ports/{}".format(port)
@ -158,10 +161,10 @@ def get_excluded_boards(base):
contents = board.read()
board_chip = re_board_chip.search(contents)
#print(entry.name, board_chip.group(1))
if not board_chip:
board_chip = "Unknown Chip"
else:
#print(entry.name, board_chip.group(1))
board_chip = board_chip.group(1)
# add port_config results to contents
@ -178,12 +181,6 @@ def get_excluded_boards(base):
if small_build and base[module]["full_build"] == "1":
board_is_excluded = True
# check if board uses `MINIMAL_BUILD`. if yes, and current
# module is marked as `DEFAULT_BUILD`, board is excluded
min_build = re.search("CIRCUITPY_MINIMAL_BUILD = 1", contents)
if min_build and base[module]["default_value"] == "CIRCUITPY_DEFAULT_BUILD":
board_is_excluded = True
# check if module is specifically disabled for this board
re_pattern = r"CIRCUITPY_{}\s=\s(\w)".format(module.upper())
find_module = re.search(re_pattern, contents)

View File

@ -1,106 +1,56 @@
# Define an equivalent for MICROPY_LONGINT_IMPL, to pass to $(MPY-TOOL) in py/mkrules.mk
# $(MPY-TOOL) needs to know what kind of longint to use (if any) to freeze long integers.
# This should correspond to the MICROPY_LONGINT_IMPL definition in mpconfigport.h.
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=mpz
# Internal math library is substantially smaller than toolchain one
LONGINT_IMPL = MPZ
INTERNAL_LIBM = 1
# Chip supplied serial number, in bytes
USB_SERIAL_NUMBER_LENGTH = 24
# Longints can be implemented as mpz, as longlong, or not
LONGINT_IMPL = MPZ
# Reduced feature set for early port
CIRCUITPY_MINIMAL_BUILD = 1
# The ifndef's allow overriding in mpconfigboard.mk.
ifndef CIRCUITPY_BOARD
CIRCUITPY_BOARD = 1
ifeq ($(MCU_SERIES),F4)
# Items requiring common-hal implementation:
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_AUDIOIO = 0
CIRCUITPY_ROTARYIO = 0
CIRCUITPY_RTC = 0
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_I2CSLAVE = 0
# Can be overridden on board level
ifndef CIRCUITPY_NVM
CIRCUITPY_NVM = 0
endif
endif
ifndef CIRCUITPY_DIGITALIO
CIRCUITPY_DIGITALIO = 1
endif
ifndef CIRCUITPY_ANALOGIO
CIRCUITPY_ANALOGIO = 1
endif
ifndef CIRCUITPY_MICROCONTROLLER
CIRCUITPY_MICROCONTROLLER = 1
endif
ifndef CIRCUITPY_BUSIO
CIRCUITPY_BUSIO = 1
endif
ifndef CIRCUITPY_PULSEIO
CIRCUITPY_PULSEIO = 1
endif
ifndef CIRCUITPY_OS
CIRCUITPY_OS = 1
endif
ifndef CIRCUITPY_STORAGE
CIRCUITPY_STORAGE = 1
endif
ifndef CIRCUITPY_RANDOM
CIRCUITPY_RANDOM = 1
endif
ifndef CRICUITPY_USB_HID
CIRCUITPY_USB_HID = 1
endif
ifndef CIRCUITPY_USB_MIDI
CIRCUITPY_USB_MIDI = 1
endif
ifndef CIRCUITPY_NEOPIXEL_WRITE
CIRCUITPY_NEOPIXEL_WRITE = 1
endif
ifndef CIRCUITPY_DISPLAYIO
CIRCUITPY_DISPLAYIO = 1
endif
CFLAGS += -DMICROPY_CPYTHON_COMPAT=1
CIRCUITPY_ULAB = 1
ifeq ($(MCU_SERIES), H7)
CIRCUITPY_BOARD = 1
CIRCUITPY_DIGITALIO = 1
ifeq ($(MCU_SERIES),H7)
# Items requiring common-hal implementation:
CIRCUITPY_ANALOGIO = 0
CIRCUITPY_MICROCONTROLLER = 1
CIRCUITPY_BUSIO = 1
CIRCUITPY_NEOPIXEL_WRITE = 0
CIRCUITPY_PULSEIO = 0
CIRCUITPY_OS = 0
CIRCUITPY_STORAGE = 0
CIRCUITPY_RANDOM = 0
CIRCUITPY_USB_HID = 0
CIRCUITPY_USB_MIDI = 0
CIRCUITPY_NEOPIXEL_WRITE = 0
CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_NVM = 0
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_AUDIOIO = 0
CIRCUITPY_ROTARYIO = 0
CIRCUITPY_RTC = 0
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_I2CSLAVE = 0
# Modules with no common-hal implementation that depend on something else
CIRCUITPY_DISPLAYIO = 0 # Requires SPI, PulseIO, and common-hal module (stub ok)
CIRCUITPY_RANDOM = 0 # Requires OS
CIRCUITPY_STORAGE = 0 # Requires OS, filesystem
endif
ifeq ($(MCU_SERIES), F7)
CIRCUITPY_BOARD = 1
CIRCUITPY_DIGITALIO = 1
ifeq ($(MCU_SERIES),F7)
# Items requiring common-hal implementation:
CIRCUITPY_ANALOGIO = 0
CIRCUITPY_MICROCONTROLLER = 1
CIRCUITPY_BUSIO = 1
CIRCUITPY_NEOPIXEL_WRITE = 0
CIRCUITPY_PULSEIO = 0
CIRCUITPY_OS = 0
CIRCUITPY_STORAGE = 0
CIRCUITPY_RANDOM = 0
CIRCUITPY_USB_HID = 0
CIRCUITPY_USB_MIDI = 0
CIRCUITPY_NEOPIXEL_WRITE = 0
CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_NVM = 0
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_AUDIOIO = 0
CIRCUITPY_ROTARYIO = 0
CIRCUITPY_RTC = 0
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_I2CSLAVE = 0
# Modules with no common-hal implementation that depend on something else
CIRCUITPY_DISPLAYIO = 0 # Requires SPI, PulseIO, and common-hal module (stub ok)
CIRCUITPY_RANDOM = 0 # Requires OS
CIRCUITPY_STORAGE = 0 # Requires OS, filesystem
endif

View File

@ -179,17 +179,11 @@ typedef long mp_off_t;
// board-specific definitions, which control and may override definitions below.
#include "mpconfigboard.h"
// CIRCUITPY_FULL_BUILD is defined in a *.mk file.
// CIRCUITPY_FULL_BUILD is defined in py/circuitpy_mpconfig.mk
// Remove some lesser-used functionality to make small builds fit.
#define MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG (CIRCUITPY_FULL_BUILD)
//TODO: replace this with a rework of the FULL_BUILD system
#if !defined(MICROPY_CPYTHON_COMPAT)
#define MICROPY_CPYTHON_COMPAT (CIRCUITPY_FULL_BUILD)
#endif
#if !defined(MICROPY_COMP_FSTRING_LITERAL)
#define MICROPY_CPYTHON_COMPAT (CIRCUITPY_FULL_BUILD)
#define MICROPY_COMP_FSTRING_LITERAL (MICROPY_CPYTHON_COMPAT)
#endif
#define MICROPY_MODULE_WEAK_LINKS (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_ALL_SPECIAL_METHODS (CIRCUITPY_FULL_BUILD)
#define MICROPY_PY_BUILTINS_COMPLEX (CIRCUITPY_FULL_BUILD)
@ -223,7 +217,7 @@ typedef long mp_off_t;
#define MP_SSIZE_MAX (0x7fffffff)
#endif
#if INTERNAL_FLASH_FILESYSTEM == 0 && QSPI_FLASH_FILESYSTEM == 0 && SPI_FLASH_FILESYSTEM == 0 && !CIRCUITPY_MINIMAL_BUILD
#if INTERNAL_FLASH_FILESYSTEM == 0 && QSPI_FLASH_FILESYSTEM == 0 && SPI_FLASH_FILESYSTEM == 0 && !DISABLE_FILESYSTEM
#error No *_FLASH_FILESYSTEM set!
#endif

View File

@ -23,13 +23,12 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# mpconfigboard.mk files can specify:
# CIRCUITPY_FULL_BUILD = 1 (which is the default)
# or
# CIRCUITPY_SMALL_BUILD = 1
# which is the same as:
# CIRCUITPY_FULL_BUILD = 0
# Boards default to all modules enabled (with exceptions)
# Manually disable by overriding in #mpconfigboard.mk
# Smaller builds can be forced for resource constrained chips, typically SAMD21s
# without external flash. Avoid using this for incomplete ports, as it changes
# settings in other files.
ifndef CIRCUITPY_FULL_BUILD
ifeq ($(CIRCUITPY_SMALL_BUILD),1)
CIRCUITPY_FULL_BUILD = 0
@ -39,38 +38,8 @@ ifndef CIRCUITPY_FULL_BUILD
endif
CFLAGS += -DCIRCUITPY_FULL_BUILD=$(CIRCUITPY_FULL_BUILD)
# Setting CIRCUITPY_MINIMAL_BUILD = 1 will disable all features
# Use for for early stage or highly restricted ports
ifndef CIRCUITPY_MINIMAL_BUILD
CIRCUITPY_MINIMAL_BUILD = 0
endif
CFLAGS += -DCIRCUITPY_MINIMAL_BUILD=$(CIRCUITPY_MINIMAL_BUILD)
ifndef CIRCUITPY_DEFAULT_BUILD
ifeq ($(CIRCUITPY_MINIMAL_BUILD),1)
CIRCUITPY_FULL_BUILD = 0
CIRCUITPY_DEFAULT_BUILD = 0
else
CIRCUITPY_DEFAULT_BUILD = 1
endif
endif
CFLAGS += -DCIRCUITPY_DEFAULT_BUILD=$(CIRCUITPY_DEFAULT_BUILD)
# Some features have no unique HAL component, and thus there's never
# a reason to not include them.
ifndef CIRCUITPY_ALWAYS_BUILD
CIRCUITPY_ALWAYS_BUILD = 1
endif
CFLAGS += -DCIRCUITPY_ALWAYS_BUILD=$(CIRCUITPY_ALWAYS_BUILD)
# All builtin modules are listed below, with default values (0 for off, 1 for on)
# Some are always on, some are always off, and some depend on CIRCUITPY_FULL_BUILD.
#
# *** You can override any of the defaults by defining them in your mpconfigboard.mk.
ifndef CIRCUITPY_ANALOGIO
CIRCUITPY_ANALOGIO = $(CIRCUITPY_DEFAULT_BUILD)
CIRCUITPY_ANALOGIO = 1
endif
CFLAGS += -DCIRCUITPY_ANALOGIO=$(CIRCUITPY_ANALOGIO)
@ -89,7 +58,6 @@ CIRCUITPY_AUDIOIO_COMPAT = $(CIRCUITPY_AUDIOIO)
endif
CFLAGS += -DCIRCUITPY_AUDIOIO_COMPAT=$(CIRCUITPY_AUDIOIO_COMPAT)
ifndef CIRCUITPY_AUDIOPWMIO
CIRCUITPY_AUDIOPWMIO = 0
endif
@ -130,17 +98,17 @@ endif
CFLAGS += -DCIRCUITPY_BLEIO=$(CIRCUITPY_BLEIO)
ifndef CIRCUITPY_BOARD
CIRCUITPY_BOARD = $(CIRCUITPY_DEFAULT_BUILD)
CIRCUITPY_BOARD = 1
endif
CFLAGS += -DCIRCUITPY_BOARD=$(CIRCUITPY_BOARD)
ifndef CIRCUITPY_BUSIO
CIRCUITPY_BUSIO = $(CIRCUITPY_DEFAULT_BUILD)
CIRCUITPY_BUSIO = 1
endif
CFLAGS += -DCIRCUITPY_BUSIO=$(CIRCUITPY_BUSIO)
ifndef CIRCUITPY_DIGITALIO
CIRCUITPY_DIGITALIO = $(CIRCUITPY_DEFAULT_BUILD)
CIRCUITPY_DIGITALIO = 1
endif
CFLAGS += -DCIRCUITPY_DIGITALIO=$(CIRCUITPY_DIGITALIO)
@ -175,7 +143,7 @@ endif
CFLAGS += -DCIRCUITPY_I2CSLAVE=$(CIRCUITPY_I2CSLAVE)
ifndef CIRCUITPY_MATH
CIRCUITPY_MATH = $(CIRCUITPY_ALWAYS_BUILD)
CIRCUITPY_MATH = 1
endif
CFLAGS += -DCIRCUITPY_MATH=$(CIRCUITPY_MATH)
@ -185,12 +153,12 @@ endif
CFLAGS += -DCIRCUITPY__EVE=$(CIRCUITPY__EVE)
ifndef CIRCUITPY_MICROCONTROLLER
CIRCUITPY_MICROCONTROLLER = $(CIRCUITPY_DEFAULT_BUILD)
CIRCUITPY_MICROCONTROLLER = 1
endif
CFLAGS += -DCIRCUITPY_MICROCONTROLLER=$(CIRCUITPY_MICROCONTROLLER)
ifndef CIRCUITPY_NEOPIXEL_WRITE
CIRCUITPY_NEOPIXEL_WRITE = $(CIRCUITPY_DEFAULT_BUILD)
CIRCUITPY_NEOPIXEL_WRITE = 1
endif
CFLAGS += -DCIRCUITPY_NEOPIXEL_WRITE=$(CIRCUITPY_NEOPIXEL_WRITE)
@ -201,12 +169,12 @@ endif
CFLAGS += -DCIRCUITPY_NETWORK=$(CIRCUITPY_NETWORK)
ifndef CIRCUITPY_NVM
CIRCUITPY_NVM = $(CIRCUITPY_DEFAULT_BUILD)
CIRCUITPY_NVM = 1
endif
CFLAGS += -DCIRCUITPY_NVM=$(CIRCUITPY_NVM)
ifndef CIRCUITPY_OS
CIRCUITPY_OS = $(CIRCUITPY_DEFAULT_BUILD)
CIRCUITPY_OS = 1
endif
CFLAGS += -DCIRCUITPY_OS=$(CIRCUITPY_OS)
@ -222,7 +190,7 @@ endif
CFLAGS += -DCIRCUITPY_PROTOMATTER=$(CIRCUITPY_PROTOMATTER)
ifndef CIRCUITPY_PULSEIO
CIRCUITPY_PULSEIO = $(CIRCUITPY_DEFAULT_BUILD)
CIRCUITPY_PULSEIO = 1
endif
CFLAGS += -DCIRCUITPY_PULSEIO=$(CIRCUITPY_PULSEIO)
@ -233,17 +201,17 @@ endif
CFLAGS += -DCIRCUITPY_PS2IO=$(CIRCUITPY_PS2IO)
ifndef CIRCUITPY_RANDOM
CIRCUITPY_RANDOM = $(CIRCUITPY_DEFAULT_BUILD)
CIRCUITPY_RANDOM = 1
endif
CFLAGS += -DCIRCUITPY_RANDOM=$(CIRCUITPY_RANDOM)
ifndef CIRCUITPY_ROTARYIO
CIRCUITPY_ROTARYIO = $(CIRCUITPY_DEFAULT_BUILD)
CIRCUITPY_ROTARYIO = 1
endif
CFLAGS += -DCIRCUITPY_ROTARYIO=$(CIRCUITPY_ROTARYIO)
ifndef CIRCUITPY_RTC
CIRCUITPY_RTC = $(CIRCUITPY_DEFAULT_BUILD)
CIRCUITPY_RTC = 1
endif
CFLAGS += -DCIRCUITPY_RTC=$(CIRCUITPY_RTC)
@ -262,22 +230,22 @@ endif
CFLAGS += -DCIRCUITPY_STAGE=$(CIRCUITPY_STAGE)
ifndef CIRCUITPY_STORAGE
CIRCUITPY_STORAGE = $(CIRCUITPY_DEFAULT_BUILD)
CIRCUITPY_STORAGE = 1
endif
CFLAGS += -DCIRCUITPY_STORAGE=$(CIRCUITPY_STORAGE)
ifndef CIRCUITPY_STRUCT
CIRCUITPY_STRUCT = $(CIRCUITPY_ALWAYS_BUILD)
CIRCUITPY_STRUCT = 1
endif
CFLAGS += -DCIRCUITPY_STRUCT=$(CIRCUITPY_STRUCT)
ifndef CIRCUITPY_SUPERVISOR
CIRCUITPY_SUPERVISOR = $(CIRCUITPY_ALWAYS_BUILD)
CIRCUITPY_SUPERVISOR = 1
endif
CFLAGS += -DCIRCUITPY_SUPERVISOR=$(CIRCUITPY_SUPERVISOR)
ifndef CIRCUITPY_TIME
CIRCUITPY_TIME = $(CIRCUITPY_ALWAYS_BUILD)
CIRCUITPY_TIME = 1
endif
CFLAGS += -DCIRCUITPY_TIME=$(CIRCUITPY_TIME)
@ -288,7 +256,7 @@ endif
CFLAGS += -DCIRCUITPY_TOUCHIO_USE_NATIVE=$(CIRCUITPY_TOUCHIO_USE_NATIVE)
ifndef CIRCUITPY_TOUCHIO
CIRCUITPY_TOUCHIO = $(CIRCUITPY_DEFAULT_BUILD)
CIRCUITPY_TOUCHIO = 1
endif
CFLAGS += -DCIRCUITPY_TOUCHIO=$(CIRCUITPY_TOUCHIO)
@ -299,12 +267,12 @@ endif
CFLAGS += -DCIRCUITPY_UHEAP=$(CIRCUITPY_UHEAP)
ifndef CIRCUITPY_USB_HID
CIRCUITPY_USB_HID = $(CIRCUITPY_DEFAULT_BUILD)
CIRCUITPY_USB_HID = 1
endif
CFLAGS += -DCIRCUITPY_USB_HID=$(CIRCUITPY_USB_HID)
ifndef CIRCUITPY_USB_MIDI
CIRCUITPY_USB_MIDI = $(CIRCUITPY_DEFAULT_BUILD)
CIRCUITPY_USB_MIDI = 1
endif
CFLAGS += -DCIRCUITPY_USB_MIDI=$(CIRCUITPY_USB_MIDI)