Merge pull request #6629 from Neradoc/board-extensions-in-boards-dir

Build extensions in mpconfigport and mpconfigboard
This commit is contained in:
Scott Shawcroft 2022-07-26 11:37:37 -07:00 committed by GitHub
commit bc926b041e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 158 additions and 130 deletions

View File

@ -52,8 +52,8 @@ subprocess.check_output(["make", "stubs"])
#modules_support_matrix = shared_bindings_matrix.support_matrix_excluded_boards() #modules_support_matrix = shared_bindings_matrix.support_matrix_excluded_boards()
modules_support_matrix = shared_bindings_matrix.support_matrix_by_board() modules_support_matrix = shared_bindings_matrix.support_matrix_by_board()
modules_support_matrix_reverse = defaultdict(list) modules_support_matrix_reverse = defaultdict(list)
for board, modules in modules_support_matrix.items(): for board, matrix_info in modules_support_matrix.items():
for module in modules[0]: for module in matrix_info["modules"]:
modules_support_matrix_reverse[module].append(board) modules_support_matrix_reverse[module].append(board)
modules_support_matrix_reverse = dict( modules_support_matrix_reverse = dict(

View File

@ -32,7 +32,7 @@ from concurrent.futures import ThreadPoolExecutor
SUPPORTED_PORTS = ['atmel-samd', 'broadcom', 'cxd56', 'espressif', 'litex', 'mimxrt10xx', 'nrf', 'raspberrypi', 'stm'] SUPPORTED_PORTS = ['atmel-samd', 'broadcom', 'cxd56', 'espressif', 'litex', 'mimxrt10xx', 'nrf', 'raspberrypi', 'stm']
aliases_by_board = { ALIASES_BY_BOARD = {
"circuitplayground_express": [ "circuitplayground_express": [
"circuitplayground_express_4h", "circuitplayground_express_4h",
"circuitplayground_express_digikey_pycon2019", "circuitplayground_express_digikey_pycon2019",
@ -43,7 +43,7 @@ aliases_by_board = {
"pewpew10": ["pewpew13"], "pewpew10": ["pewpew13"],
} }
aliases_brand_names = { ALIASES_BRAND_NAMES = {
"circuitplayground_express_4h": "circuitplayground_express_4h":
"Adafruit Circuit Playground Express 4-H", "Adafruit Circuit Playground Express 4-H",
"circuitplayground_express_digikey_pycon2019": "circuitplayground_express_digikey_pycon2019":
@ -58,7 +58,7 @@ aliases_brand_names = {
"PewPew 13", "PewPew 13",
} }
additional_modules = { ADDITIONAL_MODULES = {
"fontio": "CIRCUITPY_DISPLAYIO", "fontio": "CIRCUITPY_DISPLAYIO",
"terminalio": "CIRCUITPY_DISPLAYIO", "terminalio": "CIRCUITPY_DISPLAYIO",
"adafruit_bus_device": "CIRCUITPY_BUSDEVICE", "adafruit_bus_device": "CIRCUITPY_BUSDEVICE",
@ -66,7 +66,7 @@ additional_modules = {
"usb": "CIRCUITPY_USB_HOST", "usb": "CIRCUITPY_USB_HOST",
} }
frozen_excludes = ["examples", "docs", "tests", "utils", "conf.py", "setup.py"] FROZEN_EXCLUDES = ["examples", "docs", "tests", "utils", "conf.py", "setup.py"]
"""Files and dirs at the root of a frozen directory that should be ignored. """Files and dirs at the root of a frozen directory that should be ignored.
This is the same list as in the preprocess_frozen_modules script.""" This is the same list as in the preprocess_frozen_modules script."""
@ -74,7 +74,7 @@ repository_urls = {}
"""Cache of repository URLs for frozen modules.""" """Cache of repository URLs for frozen modules."""
def get_circuitpython_root_dir(): def get_circuitpython_root_dir():
""" The path to the root './circuitpython' directory """ The path to the root './circuitpython' directory.
""" """
file_path = pathlib.Path(__file__).resolve() file_path = pathlib.Path(__file__).resolve()
root_dir = file_path.parent.parent root_dir = file_path.parent.parent
@ -82,12 +82,40 @@ def get_circuitpython_root_dir():
return root_dir return root_dir
def get_shared_bindings(): def get_shared_bindings():
""" Get a list of modules in shared-bindings based on folder names """ Get a list of modules in shared-bindings based on folder names.
""" """
shared_bindings_dir = get_circuitpython_root_dir() / "shared-bindings" shared_bindings_dir = get_circuitpython_root_dir() / "shared-bindings"
return [item.name for item in shared_bindings_dir.iterdir()] + ["binascii", "errno", "json", "re", "ulab"] return [item.name for item in shared_bindings_dir.iterdir()] + ["binascii", "errno", "json", "re", "ulab"]
def get_board_mapping():
"""
Compiles the list of boards from the directories, with aliases and mapping
to the port.
"""
boards = {}
for port in SUPPORTED_PORTS:
board_path = os.path.join("../ports", port, "boards")
for board_path in os.scandir(board_path):
if board_path.is_dir():
board_files = os.listdir(board_path.path)
board_id = board_path.name
aliases = ALIASES_BY_BOARD.get(board_path.name, [])
boards[board_id] = {
"port": port,
"download_count": 0,
"aliases": aliases,
}
for alias in aliases:
boards[alias] = {
"port": port,
"download_count": 0,
"alias": True,
"aliases": [],
}
return boards
def read_mpconfig(): def read_mpconfig():
""" Open 'circuitpy_mpconfig.mk' and return the contents. """ Open 'circuitpy_mpconfig.mk' and return the contents.
""" """
@ -112,8 +140,8 @@ def build_module_map():
full_build = False full_build = False
for module in modules: for module in modules:
full_name = module full_name = module
if module in additional_modules: if module in ADDITIONAL_MODULES:
search_identifier = additional_modules[module] search_identifier = ADDITIONAL_MODULES[module]
else: else:
search_identifier = 'CIRCUITPY_'+module.lstrip("_").upper() search_identifier = 'CIRCUITPY_'+module.lstrip("_").upper()
re_pattern = f"{re.escape(search_identifier)}\s*\??=\s*(.+)" re_pattern = f"{re.escape(search_identifier)}\s*\??=\s*(.+)"
@ -204,27 +232,33 @@ def get_repository_url(directory):
repository_urls[directory] = path repository_urls[directory] = path
return path return path
def frozen_modules_from_dirs(frozen_mpy_dirs): def frozen_modules_from_dirs(frozen_mpy_dirs, withurl):
""" """
Go through the list of frozen directories and extract the python modules. Go through the list of frozen directories and extract the python modules.
Paths are of the type: Paths are of the type:
$(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground
$(TOP)/frozen/circuitpython-stage/meowbit $(TOP)/frozen/circuitpython-stage/meowbit
Python modules are at the root of the path, and are python files or directories Python modules are at the root of the path, and are python files or directories
containing python files. Except the ones in the frozen_excludes list. containing python files. Except the ones in the FROZEN_EXCLUDES list.
""" """
frozen_modules = [] frozen_modules = []
for frozen_path in filter(lambda x: x, frozen_mpy_dirs.split(" ")): for frozen_path in filter(lambda x: x, frozen_mpy_dirs.split(" ")):
source_dir = get_circuitpython_root_dir() / frozen_path[7:] source_dir = get_circuitpython_root_dir() / frozen_path[7:]
url_repository = get_repository_url(source_dir) url_repository = get_repository_url(source_dir)
for sub in source_dir.glob("*"): for sub in source_dir.glob("*"):
if sub.name in frozen_excludes: if sub.name in FROZEN_EXCLUDES:
continue continue
if sub.name.endswith(".py"): if sub.name.endswith(".py"):
frozen_modules.append((sub.name[:-3], url_repository)) if withurl:
frozen_modules.append((sub.name[:-3], url_repository))
else:
frozen_modules.append(sub.name[:-3])
continue continue
if next(sub.glob("**/*.py"), None): # tests if not empty if next(sub.glob("**/*.py"), None): # tests if not empty
frozen_modules.append((sub.name, url_repository)) if withurl:
frozen_modules.append((sub.name, url_repository))
else:
frozen_modules.append(sub.name)
return frozen_modules return frozen_modules
def lookup_setting(settings, key, default=''): def lookup_setting(settings, key, default=''):
@ -244,7 +278,7 @@ def all_ports_all_boards(ports=SUPPORTED_PORTS):
continue continue
yield (port, entry) yield (port, entry)
def support_matrix_by_board(use_branded_name=True): def support_matrix_by_board(use_branded_name=True, withurl=True):
""" Compiles a list of the available core modules available for each """ Compiles a list of the available core modules available for each
board. board.
""" """
@ -272,29 +306,49 @@ def support_matrix_by_board(use_branded_name=True):
board_modules.append(base[module]['name']) board_modules.append(base[module]['name'])
board_modules.sort() board_modules.sort()
if "CIRCUITPY_BUILD_EXTENSIONS" in settings:
board_extensions = [
extension.strip() for extension in
settings["CIRCUITPY_BUILD_EXTENSIONS"].split(",")
]
else:
raise OSError(f"Board extensions undefined: {board_name}.")
frozen_modules = [] frozen_modules = []
if "FROZEN_MPY_DIRS" in settings: if "FROZEN_MPY_DIRS" in settings:
frozen_modules = frozen_modules_from_dirs(settings["FROZEN_MPY_DIRS"]) frozen_modules = frozen_modules_from_dirs(settings["FROZEN_MPY_DIRS"], withurl)
if frozen_modules: if frozen_modules:
frozen_modules.sort() frozen_modules.sort()
# generate alias boards too # generate alias boards too
board_matrix = [(board_name, (board_modules, frozen_modules))] board_matrix = [(
if entry.name in aliases_by_board: board_name, {
for alias in aliases_by_board[entry.name]: "modules": board_modules,
"frozen_libraries": frozen_modules,
"extensions": board_extensions,
}
)]
if entry.name in ALIASES_BY_BOARD:
for alias in ALIASES_BY_BOARD[entry.name]:
if use_branded_name: if use_branded_name:
if alias in aliases_brand_names: if alias in ALIASES_BRAND_NAMES:
alias = aliases_brand_names[alias] alias = ALIASES_BRAND_NAMES[alias]
else: else:
alias = alias.replace("_"," ").title() alias = alias.replace("_"," ").title()
board_matrix.append( (alias, (board_modules, frozen_modules)) ) board_matrix.append((
alias, {
"modules": board_modules,
"frozen_libraries": frozen_modules,
"extensions": board_extensions,
},
))
return board_matrix # this is now a list of (board,modules) return board_matrix # this is now a list of (board,modules)
executor = ThreadPoolExecutor(max_workers=os.cpu_count()) executor = ThreadPoolExecutor(max_workers=os.cpu_count())
mapped_exec = executor.map(support_matrix, all_ports_all_boards()) mapped_exec = executor.map(support_matrix, all_ports_all_boards())
# flatmap with comprehensions # flatmap with comprehensions
boards = dict(sorted([board for matrix in mapped_exec for board in matrix])) boards = dict(sorted([board for matrix in mapped_exec for board in matrix], key=lambda x: x[0]))
return boards return boards

View File

@ -6,6 +6,8 @@ USB_MANUFACTURER = "Arduino"
CHIP_VARIANT = SAMD21G18A CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21 CHIP_FAMILY = samd21
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
INTERNAL_FLASH_FILESYSTEM = 1 INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0 CIRCUITPY_FULL_BUILD = 0

View File

@ -6,6 +6,8 @@ USB_MANUFACTURER = "Arduino"
CHIP_VARIANT = SAMD21G18A CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21 CHIP_FAMILY = samd21
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
INTERNAL_FLASH_FILESYSTEM = 1 INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0 CIRCUITPY_FULL_BUILD = 0

View File

@ -6,6 +6,8 @@ USB_MANUFACTURER = "Arduino"
CHIP_VARIANT = SAMD21G18A CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21 CHIP_FAMILY = samd21
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
INTERNAL_FLASH_FILESYSTEM = 1 INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0 CIRCUITPY_FULL_BUILD = 0

View File

@ -6,6 +6,8 @@ USB_MANUFACTURER = "Arduino"
CHIP_VARIANT = SAMD21G18A CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21 CHIP_FAMILY = samd21
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
INTERNAL_FLASH_FILESYSTEM = 1 INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0 CIRCUITPY_FULL_BUILD = 0

View File

@ -6,6 +6,8 @@ USB_MANUFACTURER = "Adafruit Industries LLC"
CHIP_VARIANT = SAMD21G18A CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21 CHIP_FAMILY = samd21
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
INTERNAL_FLASH_FILESYSTEM = 1 INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0 CIRCUITPY_FULL_BUILD = 0

View File

@ -6,6 +6,8 @@ USB_MANUFACTURER = "Adafruit Industries LLC"
CHIP_VARIANT = SAMD21G18A CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21 CHIP_FAMILY = samd21
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
INTERNAL_FLASH_FILESYSTEM = 1 INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0 CIRCUITPY_FULL_BUILD = 0

View File

@ -6,6 +6,8 @@ USB_MANUFACTURER = "Adafruit Industries LLC"
CHIP_VARIANT = SAMD21G18A CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21 CHIP_FAMILY = samd21
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
INTERNAL_FLASH_FILESYSTEM = 1 INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0 CIRCUITPY_FULL_BUILD = 0

View File

@ -6,6 +6,8 @@ USB_MANUFACTURER = "Adafruit Industries LLC"
CHIP_VARIANT = SAMD21G18A CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21 CHIP_FAMILY = samd21
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
INTERNAL_FLASH_FILESYSTEM = 1 INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0 CIRCUITPY_FULL_BUILD = 0

View File

@ -6,6 +6,8 @@ USB_MANUFACTURER = "Itaca Innovation"
CHIP_VARIANT = SAMD21E18A CHIP_VARIANT = SAMD21E18A
CHIP_FAMILY = samd21 CHIP_FAMILY = samd21
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
INTERNAL_FLASH_FILESYSTEM = 1 INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0 CIRCUITPY_FULL_BUILD = 0

View File

@ -133,3 +133,5 @@ CIRCUITPY_RGBMATRIX ?= $(CIRCUITPY_FRAMEBUFFERIO)
endif # same51 endif # same51
###################################################################### ######################################################################
CIRCUITPY_BUILD_EXTENSIONS ?= uf2

View File

@ -4,3 +4,5 @@ USB_PRODUCT = "Zero"
USB_MANUFACTURER = "Raspberry Pi" USB_MANUFACTURER = "Raspberry Pi"
CHIP_VARIANT = "bcm2835" CHIP_VARIANT = "bcm2835"
CIRCUITPY_BUILD_EXTENSIONS = disk.img.zip,kernel.img

View File

@ -4,3 +4,5 @@ USB_PRODUCT = "Zero W"
USB_MANUFACTURER = "Raspberry Pi" USB_MANUFACTURER = "Raspberry Pi"
CHIP_VARIANT = "bcm2835" CHIP_VARIANT = "bcm2835"
CIRCUITPY_BUILD_EXTENSIONS = disk.img.zip,kernel.img

View File

@ -24,3 +24,5 @@ INTERNAL_FLASH_FILESYSTEM = 1
USB_NUM_ENDPOINT_PAIRS = 8 USB_NUM_ENDPOINT_PAIRS = 8
USB_HIGHSPEED = 1 USB_HIGHSPEED = 1
CIRCUITPY_BUILD_EXTENSIONS ?= disk.img.zip,kernel8.img

View File

@ -25,3 +25,5 @@ CIRCUITPY_TOUCHIO = 0
CIRCUITPY_USB_HID = 0 CIRCUITPY_USB_HID = 0
CIRCUITPY_USB_MIDI = 0 CIRCUITPY_USB_MIDI = 0
INTERNAL_LIBM = 1 INTERNAL_LIBM = 1
CIRCUITPY_BUILD_EXTENSIONS ?= spk

View File

@ -40,6 +40,7 @@ CIRCUITPY_PARALLELDISPLAY = 0
# Protomatter needs to support ESP32. # Protomatter needs to support ESP32.
CIRCUITPY_RGBMATRIX = 0 CIRCUITPY_RGBMATRIX = 0
CIRCUITPY_USB = 0 CIRCUITPY_USB = 0
CIRCUITPY_BUILD_EXTENSIONS ?= bin
else ifeq ($(IDF_TARGET),esp32c3) else ifeq ($(IDF_TARGET),esp32c3)
CIRCUITPY_AESIO = 0 CIRCUITPY_AESIO = 0
@ -57,17 +58,20 @@ CIRCUITPY_ROTARYIO = 0
CIRCUITPY_TOUCHIO ?= 1 CIRCUITPY_TOUCHIO ?= 1
CIRCUITPY_TOUCHIO_USE_NATIVE = 0 CIRCUITPY_TOUCHIO_USE_NATIVE = 0
CIRCUITPY_USB = 0 CIRCUITPY_USB = 0
CIRCUITPY_BUILD_EXTENSIONS ?= bin
else ifeq ($(IDF_TARGET),esp32s3) else ifeq ($(IDF_TARGET),esp32s3)
CIRCUITPY_BLEIO = 1 CIRCUITPY_BLEIO = 1
CIRCUITPY_BLEIO_HCI = 0 CIRCUITPY_BLEIO_HCI = 0
CIRCUITPY_IMAGECAPTURE = 0 CIRCUITPY_IMAGECAPTURE = 0
CIRCUITPY_PARALLELDISPLAY = 0 CIRCUITPY_PARALLELDISPLAY = 0
CIRCUITPY_BUILD_EXTENSIONS ?= bin,uf2
else ifeq ($(IDF_TARGET),esp32s2) else ifeq ($(IDF_TARGET),esp32s2)
# No BLE on S2 # No BLE on S2
CIRCUITPY_BLEIO = 0 CIRCUITPY_BLEIO = 0
CIRCUITPY_BLEIO_HCI = 0 CIRCUITPY_BLEIO_HCI = 0
CIRCUITPY_BUILD_EXTENSIONS ?= bin,uf2
endif endif
# From ESP32-S2/S3 Technical Reference Manual: # From ESP32-S2/S3 Technical Reference Manual:

View File

@ -29,3 +29,5 @@ CIRCUITPY_SDCARDIO = 0
# Enable USB support # Enable USB support
CIRCUITPY_USB_HID = 1 CIRCUITPY_USB_HID = 1
CIRCUITPY_USB_MIDI = 1 CIRCUITPY_USB_MIDI = 1
CIRCUITPY_BUILD_EXTENSIONS ?= dfu

View File

@ -21,3 +21,5 @@ CIRCUITPY_PULSEIO = 0
CIRCUITPY_ROTARYIO = 0 CIRCUITPY_ROTARYIO = 0
CIRCUITPY_USB_MIDI = 1 CIRCUITPY_USB_MIDI = 1
LONGINT_IMPL = MPZ LONGINT_IMPL = MPZ
CIRCUITPY_BUILD_EXTENSIONS ?= hex,uf2

View File

@ -5,6 +5,8 @@ USB_MANUFACTURER = "Electronut Labs"
MCU_CHIP = nrf52840 MCU_CHIP = nrf52840
CIRCUITPY_BUILD_EXTENSIONS = hex
INTERNAL_FLASH_FILESYSTEM = 1 INTERNAL_FLASH_FILESYSTEM = 1
CIRCUITPY_AUDIOIO = 0 CIRCUITPY_AUDIOIO = 0
CIRCUITPY_DISPLAYIO = 1 CIRCUITPY_DISPLAYIO = 1

View File

@ -5,5 +5,7 @@ USB_MANUFACTURER = "makerdiary"
MCU_CHIP = nrf52840 MCU_CHIP = nrf52840
CIRCUITPY_BUILD_EXTENSIONS = hex
QSPI_FLASH_FILESYSTEM = 1 QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "MX25R6435F" EXTERNAL_FLASH_DEVICES = "MX25R6435F"

View File

@ -5,4 +5,6 @@ USB_MANUFACTURER = "makerdiary"
MCU_CHIP = nrf52840 MCU_CHIP = nrf52840
CIRCUITPY_BUILD_EXTENSIONS = hex,uf2
INTERNAL_FLASH_FILESYSTEM = 1 INTERNAL_FLASH_FILESYSTEM = 1

View File

@ -3,6 +3,8 @@ CIRCUITPY_CREATION_ID = 0x80D8
MCU_CHIP = nrf52833 MCU_CHIP = nrf52833
CIRCUITPY_BUILD_EXTENSIONS = combined.hex
INTERNAL_FLASH_FILESYSTEM = 1 INTERNAL_FLASH_FILESYSTEM = 1
# USB pins aren't used. # USB pins aren't used.

View File

@ -5,5 +5,7 @@ USB_MANUFACTURER = "Nordic Semiconductor"
MCU_CHIP = nrf52840 MCU_CHIP = nrf52840
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
QSPI_FLASH_FILESYSTEM = 1 QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "MX25R6435F" EXTERNAL_FLASH_DEVICES = "MX25R6435F"

View File

@ -5,4 +5,6 @@ USB_MANUFACTURER = "Nordic Semiconductor"
MCU_CHIP = nrf52840 MCU_CHIP = nrf52840
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2
INTERNAL_FLASH_FILESYSTEM = 1 INTERNAL_FLASH_FILESYSTEM = 1

View File

@ -4,6 +4,8 @@ LD_TEMPLATE_FILE = boards/common.template.ld
INTERNAL_LIBM = 1 INTERNAL_LIBM = 1
CIRCUITPY_BUILD_EXTENSIONS ?= uf2
# Number of USB endpoint pairs. # Number of USB endpoint pairs.
USB_NUM_ENDPOINT_PAIRS = 8 USB_NUM_ENDPOINT_PAIRS = 8

View File

@ -36,6 +36,8 @@ CIRCUITPY_AUDIOMIXER = 1
INTERNAL_LIBM = 1 INTERNAL_LIBM = 1
CIRCUITPY_BUILD_EXTENSIONS ?= uf2
# Number of USB endpoint pairs. # Number of USB endpoint pairs.
USB_NUM_ENDPOINT_PAIRS = 8 USB_NUM_ENDPOINT_PAIRS = 8

View File

@ -13,6 +13,8 @@ MCU_SERIES = F4
MCU_VARIANT = STM32F401xE MCU_VARIANT = STM32F401xE
MCU_PACKAGE = LQFP64 MCU_PACKAGE = LQFP64
CIRCUITPY_BUILD_EXTENSIONS = uf2
OPTIMIZATION_FLAGS = -Os OPTIMIZATION_FLAGS = -Os
LD_COMMON = boards/common_default.ld LD_COMMON = boards/common_default.ld

View File

@ -19,3 +19,5 @@ LD_BOOT = boards/STM32F405_boot.ld
UF2_OFFSET = 0x8010000 UF2_OFFSET = 0x8010000
CIRCUITPY_RGBMATRIX ?= 1 CIRCUITPY_RGBMATRIX ?= 1
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2

View File

@ -71,3 +71,5 @@ CIRCUITPY_BUSDEVICE = 0
CIRCUITPY_KEYPAD = 1 CIRCUITPY_KEYPAD = 1
CIRCUITPY_RGBMATRIX = 0 CIRCUITPY_RGBMATRIX = 0
CIRCUITPY_RTC = 1 CIRCUITPY_RTC = 1
CIRCUITPY_BUILD_EXTENSIONS = bin,uf2

View File

@ -88,3 +88,4 @@ ifeq ($(MCU_SERIES),L4)
endif endif
CIRCUITPY_PARALLELDISPLAY := 0 CIRCUITPY_PARALLELDISPLAY := 0
CIRCUITPY_BUILD_EXTENSIONS ?= bin

View File

@ -21,9 +21,9 @@ capable board, as well as each :term:`frozen module` included on it.
{% for key, value in support_matrix|dictsort %} {% for key, value in support_matrix|dictsort %}
{{ '.. _' ~ key|replace(" ", "-") ~ ':' }} {{ '.. _' ~ key|replace(" ", "-") ~ ':' }}
* - {{ key }} * - {{ key }}
- {{ ':py:mod:`' ~ value[0]|join("`, :py:mod:`") ~ '`' }} - {{ ':py:mod:`' ~ value.modules|join("`, :py:mod:`") ~ '`' }}
{% for module in value[1] %}\ {% for module in value.frozen_libraries %}\
{% if loop.index == 1 %}**Frozen Modules:** {% endif %}\ {% if loop.index == 1 %}**Frozen Modules:** {% endif %}\
{% if loop.index > 1 %}, {% endif %}\ {% if loop.index > 1 %}, {% endif %}\
{% if module[1] %}{{ '`' ~ module[0] ~ ' <' ~ module[1] ~ '>`__' }}\ {% if module[1] %}{{ '`' ~ module[0] ~ ' <' ~ module[1] ~ '>`__' }}\

View File

@ -19,76 +19,11 @@ import adabot.github_requests as github
sys.path.append("../docs") sys.path.append("../docs")
from shared_bindings_matrix import ( from shared_bindings_matrix import (
SUPPORTED_PORTS, SUPPORTED_PORTS,
aliases_by_board,
support_matrix_by_board, support_matrix_by_board,
get_board_mapping,
) )
BIN = ("bin",) LANGUAGE_ALLOW_LIST = set(
UF2 = ("uf2",)
BIN_UF2 = ("bin", "uf2")
HEX = ("hex",)
HEX_UF2 = ("hex", "uf2")
SPK = ("spk",)
DFU = ("dfu",)
BIN_DFU = ("bin", "dfu")
COMBINED_HEX = ("combined.hex",)
KERNEL8_IMG = ("disk.img.zip", "kernel8.img")
KERNEL_IMG = ("disk.img.zip", "kernel.img")
# Default extensions
extension_by_port = {
"atmel-samd": UF2,
"broadcom": KERNEL8_IMG,
"cxd56": SPK,
"espressif": BIN_UF2,
"litex": DFU,
"mimxrt10xx": HEX_UF2,
"nrf": UF2,
"raspberrypi": UF2,
"stm": BIN,
}
# Per board overrides
extension_by_board = {
# samd
"arduino_mkr1300": BIN_UF2,
"arduino_mkrzero": BIN_UF2,
"arduino_nano_33_iot": BIN_UF2,
"arduino_zero": BIN_UF2,
"feather_m0_adalogger": BIN_UF2,
"feather_m0_basic": BIN_UF2,
"feather_m0_rfm69": BIN_UF2,
"feather_m0_rfm9x": BIN_UF2,
"uchip": BIN_UF2,
# nRF52840 dev kits that may not have UF2 bootloaders,
"makerdiary_nrf52840_mdk": HEX,
"makerdiary_nrf52840_mdk_usb_dongle": HEX_UF2,
"pca10056": BIN_UF2,
"pca10059": BIN_UF2,
"electronut_labs_blip": HEX,
"microbit_v2": COMBINED_HEX,
# stm32
"meowbit_v121": UF2,
"sparkfun_stm32_thing_plus": BIN_UF2,
"swan_r5": BIN_UF2,
# esp32
"adafruit_feather_esp32_v2": BIN,
# esp32c3
"adafruit_qtpy_esp32c3": BIN,
"ai_thinker_esp32-c3s": BIN,
"ai_thinker_esp32-c3s-2m": BIN,
"beetle-esp32-c3": BIN,
"espressif_esp32c3_devkitm_1_n4": BIN,
"lilygo_ttgo_t-01c3": BIN,
"lolin_c3_mini": BIN,
"microdev_micro_c3": BIN,
"lilygo_ttgo_t-oi-plus": BIN,
# broadcom
"raspberrypi_zero": KERNEL_IMG,
"raspberrypi_zero_w": KERNEL_IMG,
}
language_allow_list = set(
[ [
"ID", "ID",
"de_DE", "de_DE",
@ -117,38 +52,10 @@ def get_languages(list_all=False):
if f.name.endswith(".po"): if f.name.endswith(".po"):
languages.add(f.name[:-3]) languages.add(f.name[:-3])
if not list_all: if not list_all:
languages = languages & language_allow_list languages = languages & LANGUAGE_ALLOW_LIST
return sorted(list(languages), key=str.casefold) return sorted(list(languages), key=str.casefold)
def get_board_mapping():
boards = {}
for port in SUPPORTED_PORTS:
board_path = os.path.join("../ports", port, "boards")
for board_path in os.scandir(board_path):
if board_path.is_dir():
board_files = os.listdir(board_path.path)
board_id = board_path.name
extensions = extension_by_port[port]
extensions = extension_by_board.get(board_path.name, extensions)
aliases = aliases_by_board.get(board_path.name, [])
boards[board_id] = {
"port": port,
"extensions": extensions,
"download_count": 0,
"aliases": aliases,
}
for alias in aliases:
boards[alias] = {
"port": port,
"extensions": extensions,
"download_count": 0,
"alias": True,
"aliases": [],
}
return boards
def get_version_info(): def get_version_info():
version = None version = None
sha = git("rev-parse", "--short", "HEAD").stdout.decode("utf-8") sha = git("rev-parse", "--short", "HEAD").stdout.decode("utf-8")
@ -283,7 +190,7 @@ def generate_download_info():
languages = get_languages() languages = get_languages()
support_matrix = support_matrix_by_board(use_branded_name=False) support_matrix = support_matrix_by_board(use_branded_name=False, withurl=False)
new_stable = "-" not in new_tag new_stable = "-" not in new_tag
@ -310,20 +217,19 @@ def generate_download_info():
board_files = os.listdir(board_path.path) board_files = os.listdir(board_path.path)
board_id = board_path.name board_id = board_path.name
board_info = board_mapping[board_id] board_info = board_mapping[board_id]
for alias in [board_id] + board_info["aliases"]: for alias in [board_id] + board_info["aliases"]:
alias_info = board_mapping[alias] alias_info = board_mapping[alias]
if alias not in current_info: if alias not in current_info:
changes["new_boards"].append(alias) changes["new_boards"].append(alias)
current_info[alias] = {"downloads": 0, "versions": []} current_info[alias] = {"downloads": 0, "versions": []}
new_version = { new_version = {
"stable": new_stable, "stable": new_stable,
"version": new_tag, "version": new_tag,
"modules": support_matrix[alias][0],
"languages": languages, "languages": languages,
"extensions": board_info["extensions"], # add modules, extensions, frozen_libraries explicitly
"frozen_libraries": [frozen[0] for frozen in support_matrix[alias][1]], "modules": support_matrix[alias]["modules"],
"extensions": support_matrix[alias]["extensions"],
"frozen_libraries": support_matrix[alias]["frozen_libraries"],
} }
current_info[alias]["downloads"] = alias_info["download_count"] current_info[alias]["downloads"] = alias_info["download_count"]
current_info[alias]["versions"].append(new_version) current_info[alias]["versions"].append(new_version)
@ -333,9 +239,10 @@ def generate_download_info():
if changes["new_release"] and user: if changes["new_release"] and user:
create_pr(changes, current_info, git_info, user) create_pr(changes, current_info, git_info, user)
else: else:
print("No new release to update")
if "DEBUG" in os.environ: if "DEBUG" in os.environ:
print(create_json(current_info).decode("utf8")) print(create_json(current_info).decode("utf8"))
else:
print("No new release to update")
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -12,6 +12,9 @@ import shutil
import build_board_info as build_info import build_board_info as build_info
import time import time
sys.path.append("../docs")
from shared_bindings_matrix import get_settings_from_makefile
for port in build_info.SUPPORTED_PORTS: for port in build_info.SUPPORTED_PORTS:
result = subprocess.run("rm -rf ../ports/{port}/build*".format(port=port), shell=True) result = subprocess.run("rm -rf ../ports/{port}/build*".format(port=port), shell=True)
@ -39,6 +42,7 @@ for board in build_boards:
bin_directory = "../bin/{}/".format(board) bin_directory = "../bin/{}/".format(board)
os.makedirs(bin_directory, exist_ok=True) os.makedirs(bin_directory, exist_ok=True)
board_info = all_boards[board] board_info = all_boards[board]
board_settings = get_settings_from_makefile("../ports/" + board_info["port"], board)
for language in languages: for language in languages:
bin_directory = "../bin/{board}/{language}".format(board=board, language=language) bin_directory = "../bin/{board}/{language}".format(board=board, language=language)
@ -82,8 +86,12 @@ for board in build_boards:
success = "\033[31mfailed\033[0m" success = "\033[31mfailed\033[0m"
other_output = "" other_output = ""
extensions = [
extension.strip()
for extension in board_settings["CIRCUITPY_BUILD_EXTENSIONS"].split(",")
]
for extension in board_info["extensions"]: for extension in extensions:
temp_filename = "../ports/{port}/{build}/firmware.{extension}".format( temp_filename = "../ports/{port}/{build}/firmware.{extension}".format(
port=board_info["port"], build=build_dir, extension=extension port=board_info["port"], build=build_dir, extension=extension
) )