WIP: atmel-samd trinket build works

crypto-aes
Dan Halbert 4 years ago
parent 379258112a
commit 5154e0581e

@ -58,7 +58,7 @@
#include "supervisor/shared/stack.h"
#include "supervisor/serial.h"
#ifdef MICROPY_PY_NETWORK
#if CIRCUITPY_NETWORK
#include "shared-module/network/__init__.h"
#endif
@ -118,13 +118,13 @@ void start_mp(supervisor_allocation* heap) {
mp_obj_list_init(mp_sys_argv, 0);
#if MICROPY_PY_NETWORK
#if CIRCUITPY_NETWORK
network_module_init();
#endif
}
void stop_mp(void) {
#if MICROPY_PY_NETWORK
#if CIRCUITPY_NETWORK
network_module_deinit();
#endif
}
@ -201,7 +201,9 @@ bool run_code_py(safe_mode_t safe_mode) {
}
}
// Turn off the display before the heap disappears.
#if CIRCUITPY_DISPLAYIO
reset_displays();
#endif
stop_mp();
free_memory(heap);
supervisor_move_memory();

@ -1,3 +1,27 @@
# This file is part of the MicroPython project, http://micropython.org/
#
# The MIT License (MIT)
#
# Copyright (c) 2019 Dan Halbert for Adafruit Industries
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# Select the board to build for.
ifeq ($(BOARD),)
$(error You must provide a BOARD parameter)
@ -7,13 +31,16 @@ else
endif
endif
# If the build directory is not given, make it reflect the board name.
BUILD ?= build-$(BOARD)
include ../../py/mkenv.mk
# Board-specific
include boards/$(BOARD)/mpconfigboard.mk
-include mpconfigport.mk
# Port-specific
include mpconfigport.mk
# CircuitPython-specific
include ../circuitpy-common/mpconfig_circuitpy.mk
# qstr definitions (must come before including py.mk)
QSTR_DEFS = qstrdefsport.h
@ -25,8 +52,6 @@ include $(TOP)/supervisor/supervisor.mk
CROSS_COMPILE = arm-none-eabi-
BOSSAC := tools/bossac_osx
HAL_DIR=hal/$(MCU_SERIES)
INC += -I. \
@ -191,10 +216,6 @@ LDFLAGS += -mthumb -mcpu=cortex-m4
BOOTLOADER_SIZE := 0x4000
endif
ifdef EXCLUDE_PIXELBUF
CFLAGS += -DEXCLUDE_PIXELBUF
endif
SRC_ASF := \
gcc/gcc/startup_$(CHIP_FAMILY).c \
gcc/system_$(CHIP_FAMILY).c \
@ -243,29 +264,14 @@ SRC_ASF := $(addprefix asf4/$(CHIP_FAMILY)/, $(SRC_ASF))
SRC_C = \
audio_dma.c \
background.c \
fatfs_port.c \
mphalport.c \
reset.c \
peripherals/samd/clocks.c \
peripherals/samd/dma.c \
peripherals/samd/events.c \
peripherals/samd/external_interrupts.c \
peripherals/samd/sercom.c \
peripherals/samd/timers.c \
peripherals/samd/$(CHIP_FAMILY)/adc.c \
peripherals/samd/$(CHIP_FAMILY)/cache.c \
peripherals/samd/$(CHIP_FAMILY)/clocks.c \
peripherals/samd/$(CHIP_FAMILY)/dma.c \
peripherals/samd/$(CHIP_FAMILY)/events.c \
peripherals/samd/$(CHIP_FAMILY)/external_interrupts.c \
peripherals/samd/$(CHIP_FAMILY)/pins.c \
peripherals/samd/$(CHIP_FAMILY)/sercom.c \
peripherals/samd/$(CHIP_FAMILY)/timers.c \
tick.c \
bindings/samd/__init__.c \
bindings/samd/Clock.c \
bindings/samd/__init__.c \
boards/$(BOARD)/board.c \
boards/$(BOARD)/pins.c \
fatfs_port.c \
freetouch/adafruit_ptc.c \
lib/libc/string0.c \
lib/mp-readline/readline.c \
lib/oofatfs/ff.c \
lib/oofatfs/option/ccsbcs.c \
lib/timeutils/timeutils.c \
@ -276,13 +282,28 @@ SRC_C = \
lib/utils/pyexec.c \
lib/utils/stdout_helpers.c \
lib/utils/sys_stdio_mphal.c \
lib/libc/string0.c \
lib/mp-readline/readline.c \
freetouch/adafruit_ptc.c \
supervisor/shared/memory.c
mphalport.c \
peripherals/samd/$(CHIP_FAMILY)/adc.c \
peripherals/samd/$(CHIP_FAMILY)/cache.c \
peripherals/samd/$(CHIP_FAMILY)/clocks.c \
peripherals/samd/$(CHIP_FAMILY)/dma.c \
peripherals/samd/$(CHIP_FAMILY)/events.c \
peripherals/samd/$(CHIP_FAMILY)/external_interrupts.c \
peripherals/samd/$(CHIP_FAMILY)/pins.c \
peripherals/samd/$(CHIP_FAMILY)/sercom.c \
peripherals/samd/$(CHIP_FAMILY)/timers.c \
peripherals/samd/clocks.c \
peripherals/samd/dma.c \
peripherals/samd/events.c \
peripherals/samd/external_interrupts.c \
peripherals/samd/sercom.c \
peripherals/samd/timers.c \
reset.c \
supervisor/shared/memory.c \
tick.c \
ifeq ($(MICROPY_PY_NETWORK),1)
CFLAGS += -DMICROPY_PY_NETWORK=1
ifeq ($(CIRCUITPY_NETWORK),1)
CFLAGS += -DCIRCUITPY_NETWORK=1 -DMICROPY_PY_NETWORK=1
SRC_MOD += lib/netutils/netutils.c
@ -299,88 +320,180 @@ SRC_MOD += $(addprefix $(WIZNET5K_DIR)/,\
)
endif # MICROPY_PY_WIZNET5K
endif # MICROPY_PY_NETWORK
endif # CIRCUITPY_NETWORK
ifeq ($(CIRCUITPY_ANALOGIO),1)
SRC_DIRS += analogio/
endif
ifeq ($(CIRCUITPY_AUDIOBUSIO),1)
SRC_DIRS += audiobusio/
endif
ifeq ($(CIRCUITPY_BITBANGIO),1)
SRC_DIRS += bitbangio/
endif
ifeq ($(CIRCUITPY_BOARD),1)
SRC_DIRS += board/
endif
ifeq ($(CIRCUITPY_BUSIO),1)
SRC_DIRS += busio/ bitbangio/OneWire
endif
ifeq ($(CIRCUITPY_DIGITALIO),1)
SRC_DIRS += digitalio/
endif
ifeq ($(CIRCUITPY_DISPLAYIO),1)
SRC_DIRS += displayio/
endif
ifeq ($(CIRCUITPY_GAMEPAD),1)
SRC_DIRS += gamepad/
endif
ifeq ($(CIRCUITPY_I2CSLAVE),1)
SRC_DIRS += i2cslave/
endif
ifeq ($(CIRCUITPY_MATH),1)
SRC_DIRS += math/
endif
ifeq ($(CIRCUITPY_MICROCONTROLLER),1)
SRC_DIRS += microcontroller/
endif
ifeq ($(CIRCUITPY_NEOPIXEL_WRITE),1)
SRC_DIRS += neopixel_write/
endif
ifeq ($(CIRCUITPY_NETWORK),1)
SRC_DIRS += network/
endif
ifeq ($(CIRCUITPY_NVM),1)
SRC_DIRS += nvm/
endif
ifeq ($(CIRCUITPY_OS),1)
SRC_DIRS += os/
endif
ifeq ($(CIRCUITPY_PIXELBUF),1)
SRC_DIRS += _pixelbuf/
endif
ifeq ($(CIRCUITPY_PULSEIO),1)
SRC_DIRS += pulseio/
endif
ifeq ($(CIRCUITPY_RANDOM),1)
SRC_DIRS += random/
endif
ifeq ($(CIRCUITPY_ROTARYIO),1)
SRC_DIRS += rotaryio/
endif
ifeq ($(CIRCUITPY_RTC),1)
SRC_DIRS += rtc/
endif
ifeq ($(CIRCUITPY_SAMD),1)
SRC_DIRS += samd/
endif
ifeq ($(CIRCUITPY_STAGE),1)
SRC_DIRS += _stage/
endif
ifeq ($(CIRCUITPY_STORAGE),1)
SRC_DIRS += storage/
endif
ifeq ($(CIRCUITPY_STRUCT),1)
SRC_DIRS += struct/
endif
ifeq ($(CIRCUITPY_SUPERVISOR),1)
SRC_DIRS += supervisor/
endif
ifeq ($(CIRCUITPY_TIME),1)
SRC_DIRS += time/
endif
ifeq ($(CIRCUITPY_TOUCHIO),1)
SRC_DIRS += touchio/
endif
ifeq ($(CIRCUITPY_UHEAP),1)
SRC_DIRS += uheap/
endif
ifeq ($(CIRCUITPY_USB_HID),1)
SRC_DIRS += usb_hid/
endif
ifeq ($(CIRCUITPY_USB_MIDI),1)
SRC_DIRS += usb_midi/
endif
ifeq ($(CIRCUITPY_USTACK),1)
SRC_DIRS += ustack/
endif
# All possible sources are listed here, and are filtered by SRC_DIRS.
SRC_COMMON_HAL = \
$(filter $(patsubst %,%%,$(SRC_DIRS)), \
analogio/AnalogIn.c \
analogio/AnalogOut.c \
analogio/__init__.c \
audioio/__init__.c \
audioio/AudioOut.c \
board/__init__.c \
busio/__init__.c \
busio/I2C.c \
busio/SPI.c \
busio/UART.c \
digitalio/__init__.c \
busio/__init__.c \
digitalio/DigitalInOut.c \
digitalio/__init__.c \
displayio/ParallelBus.c \
i2cslave/__init__.c \
i2cslave/I2CSlave.c \
microcontroller/__init__.c \
i2cslave/__init__.c \
microcontroller/Pin.c \
microcontroller/Processor.c \
microcontroller/__init__.c \
neopixel_write/__init__.c \
nvm/ByteArray.c \
nvm/__init__.c \
os/__init__.c \
rotaryio/__init__.c \
pulseio/PWMOut.c \
pulseio/PulseIn.c \
pulseio/PulseOut.c \
pulseio/__init__.c \
rotaryio/IncrementalEncoder.c \
rtc/__init__.c \
rotaryio/__init__.c \
rtc/RTC.c \
supervisor/__init__.c \
rtc/__init__.c \
supervisor/Runtime.c \
supervisor/__init__.c \
time/__init__.c \
analogio/__init__.c \
analogio/AnalogIn.c \
analogio/AnalogOut.c \
nvm/__init__.c \
nvm/ByteArray.c \
pulseio/__init__.c \
pulseio/PulseIn.c \
pulseio/PulseOut.c \
pulseio/PWMOut.c \
touchio/TouchIn.c \
touchio/__init__.c \
touchio/TouchIn.c
ifeq ($(INTERNAL_LIBM),1)
SRC_LIBM = $(addprefix lib/,\
libm/math.c \
libm/roundf.c \
libm/fmodf.c \
libm/nearbyintf.c \
libm/ef_sqrt.c \
libm/kf_rem_pio2.c \
libm/kf_sin.c \
libm/kf_cos.c \
libm/kf_tan.c \
libm/ef_rem_pio2.c \
libm/sf_sin.c \
libm/sf_cos.c \
libm/sf_tan.c \
libm/sf_frexp.c \
libm/sf_modf.c \
libm/sf_ldexp.c \
libm/asinfacosf.c \
libm/atanf.c \
libm/atan2f.c \
)
endif
)
# These don't have corresponding files in each port but are still located in
# shared-bindings to make it clear what the contents of the modules are.
# All possible sources are listed here, and are filtered by SRC_DIRS.
SRC_BINDINGS_ENUMS = \
$(filter $(patsubst %,%%,$(SRC_DIRS)), \
digitalio/Direction.c \
digitalio/DriveMode.c \
digitalio/Pull.c \
displayio/Glyph.c \
microcontroller/RunMode.c \
help.c \
math/__init__.c \
supervisor/__init__.c \
util.c
)
SRC_BINDINGS_ENUMS += \
help.c \
util.c
# All possible sources are listed here, and are filtered by SRC_DIRS.
SRC_SHARED_MODULE = \
bitbangio/__init__.c \
$(filter $(patsubst %,%%,$(SRC_DIRS)), \
_pixelbuf/PixelBuf.c \
_pixelbuf/__init__.c \
_stage/Layer.c \
_stage/Text.c \
_stage/__init__.c \
audiobusio/__init__.c \
audiobusio/I2SOut.c \
audiobusio/PDMIn.c \
audioio/__init__.c \
audioio/Mixer.c \
audioio/RawSample.c \
audioio/WaveFile.c \
bitbangio/I2C.c \
bitbangio/OneWire.c \
bitbangio/SPI.c \
bitbangio/__init__.c \
busio/OneWire.c \
displayio/__init__.c \
displayio/Bitmap.c \
displayio/BuiltinFont.c \
displayio/ColorConverter.c \
@ -391,60 +504,55 @@ SRC_SHARED_MODULE = \
displayio/Palette.c \
displayio/Shape.c \
displayio/TileGrid.c \
gamepad/__init__.c \
displayio/__init__.c \
gamepad/GamePad.c \
_stage/__init__.c \
_stage/Layer.c \
_stage/Text.c \
storage/__init__.c \
gamepad/__init__.c \
os/__init__.c \
random/__init__.c \
socket/__init__.c \
network/__init__.c \
storage/__init__.c \
struct/__init__.c \
terminalio/__init__.c \
terminalio/Terminal.c \
terminalio/__init__.c \
uheap/__init__.c \
ustack/__init__.c \
usb_hid/__init__.c \
usb_hid/Device.c
)
# usb_midi/__init__.c
# usb_midi/Port.c
ifeq ($(INTERNAL_LIBM),1)
SRC_LIBM = \
$(addprefix lib/,\
libm/math.c \
libm/roundf.c \
libm/fmodf.c \
libm/nearbyintf.c \
libm/ef_sqrt.c \
libm/kf_rem_pio2.c \
libm/kf_sin.c \
libm/kf_cos.c \
libm/kf_tan.c \
libm/ef_rem_pio2.c \
libm/sf_sin.c \
libm/sf_cos.c \
libm/sf_tan.c \
libm/sf_frexp.c \
libm/sf_modf.c \
libm/sf_ldexp.c \
libm/asinfacosf.c \
libm/atanf.c \
libm/atan2f.c \
)
endif
ifeq ($(MICROPY_PY_NETWORK),1)
SRC_SHARED_MODULE += socket/__init__.c network/__init__.c
ifeq ($(CIRCUITPY_NETWORK),1)
ifneq ($(MICROPY_PY_WIZNET5K),0)
SRC_SHARED_MODULE += wiznet/__init__.c wiznet/wiznet5k.c
endif
endif
# SAMRs don't have a DAC
ifneq ($(CHIP_VARIANT),SAMR21G18A)
SRC_COMMON_HAL += \
audioio/__init__.c \
audioio/AudioOut.c
SRC_SHARED_MODULE += \
audioio/__init__.c \
audioio/Mixer.c \
audioio/RawSample.c \
audioio/WaveFile.c
endif
ifndef EXCLUDE_PIXELBUF
SRC_SHARED_MODULE += _pixelbuf/__init__.c \
_pixelbuf/PixelBuf.c
endif
# The smallest SAMD51 packages don't have I2S. Everything else does.
ifneq ($(CHIP_VARIANT),SAMD51G18A)
ifneq ($(CHIP_VARIANT),SAMD51G19A)
ifneq ($(CHIP_VARIANT),SAMR21G18A)
SRC_COMMON_HAL += \
audiobusio/__init__.c \
audiobusio/I2SOut.c \
audiobusio/PDMIn.c
SRC_C += peripherals/samd/i2s.c peripherals/samd/$(CHIP_FAMILY)/i2s.c
endif
endif
ifeq ($(CIRCUITPY_AUDIOBUSIO),1)
SRC_C += peripherals/samd/i2s.c peripherals/samd/$(CHIP_FAMILY)/i2s.c
endif
SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \
@ -485,20 +593,4 @@ $(BUILD)/firmware.uf2: $(BUILD)/firmware.bin
$(STEPECHO) "Create $@"
$(Q)$(PYTHON3) $(TOP)/tools/uf2/utils/uf2conv.py -b $(BOOTLOADER_SIZE) -c -o $@ $^
deploy: $(BUILD)/firmware.bin
$(ECHO) "Writing $< to the board"
$(BOSSAC) -u $<
# Run emulation build on a POSIX system with suitable terminal settings
run:
stty raw opost -echo
build/firmware.elf
@echo Resetting terminal...
# This sleep is useful to spot segfaults
sleep 1
reset
test: $(BUILD)/firmware.elf
$(Q)/bin/echo -e "print('hello world!', list(x+1 for x in range(10)), end='eol\\\\n')\\r\\n\\x04" | $(BUILD)/firmware.elf | tail -n2 | grep "^hello world! \\[1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\]eol"
include $(TOP)/py/mkrules.mk

@ -46,11 +46,11 @@ void run_background_tasks(void) {
#if (defined(SAMD21) && defined(PIN_PA02)) || defined(SAMD51)
audio_dma_background();
#endif
#ifdef CIRCUITPY_DISPLAYIO
#if CIRCUITPY_DISPLAYIO
displayio_refresh_displays();
#endif
#if MICROPY_PY_NETWORK
#if CIRCUITPY_NETWORK
network_module_background();
#endif
usb_background();

@ -6,6 +6,7 @@ USB_MANUFACTURER = "Arduino"
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_SMALL_BUILD = 1
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21

@ -6,6 +6,7 @@ USB_MANUFACTURER = "Arduino"
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_SMALL_BUILD = 1
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21

@ -6,8 +6,7 @@ USB_MANUFACTURER = "Arduino"
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_SMALL_BUILD = 1
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
EXCLUDE_PIXELBUF = 1

@ -6,6 +6,7 @@ USB_MANUFACTURER = "Electronic Cats"
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_SMALL_BUILD = 1
CHIP_VARIANT = SAMD21E18A
CHIP_FAMILY = samd21

@ -3,8 +3,8 @@
#define MICROPY_HW_LED_STATUS (&pin_PA17)
// No framebuf on CRICKit version to save space.
#define MICROPY_PY_FRAMEBUF (0)
// No _pixelbuf to save space.
#define CIRCUITPY_PIXELBUF (0)
// Don't allow touch on A0 (PA02), because it's connected to the speaker.
#define PA02_NO_TOUCH (true)

@ -9,8 +9,6 @@ EXTERNAL_FLASH_DEVICE_COUNT = 2
EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C"
# Turn off longints for Crickit build to make room for additional frozen libs.
LONGINT_IMPL = NONE
# Disable pixelbuf to save room
EXCLUDE_PIXELBUF = 1
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21

@ -8,5 +8,10 @@ QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = "W25Q128JV_PM"
# No I2S on SAMD51G
CIRCUITPY_AUDIOBUSIO = 0
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0
CHIP_VARIANT = SAMD51G19A
CHIP_FAMILY = samd51

@ -44,5 +44,5 @@
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1
#define CIRCUITPY_I2CSLAVE
#define CIRCUITPY_I2CSLAVE (1)
#define CIRCUITPY_DISPLAYIO (1)

@ -13,5 +13,8 @@ LONGINT_IMPL = MPZ
CHIP_VARIANT = SAMD51J19A
CHIP_FAMILY = samd51
MICROPY_PY_NETWORK = 1
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0
CIRCUITPY_NETWORK = 1
MICROPY_PY_WIZNET5K = 5500

@ -6,8 +6,7 @@ USB_MANUFACTURER = "Adafruit Industries LLC"
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_SMALL_BUILD = 1
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
EXCLUDE_PIXELBUF = 1

@ -6,6 +6,7 @@ USB_MANUFACTURER = "Adafruit Industries LLC"
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_SMALL_BUILD = 1
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21

@ -37,5 +37,3 @@
// USB is always used internally so skip the pin objects for it.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1
#define CIRCUITPY_I2CSLAVE

@ -12,5 +12,5 @@ LONGINT_IMPL = MPZ
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
MICROPY_PY_NETWORK = 1
CIRCUITPY_NETWORK = 1
MICROPY_PY_WIZNET5K = 5500

@ -6,6 +6,7 @@ USB_MANUFACTURER = "Adafruit Industries LLC"
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_SMALL_BUILD = 1
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21

@ -6,6 +6,7 @@ USB_MANUFACTURER = "Adafruit Industries LLC"
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_SMALL_BUILD = 1
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21

@ -41,6 +41,3 @@
// USB is always used internally so skip the pin objects for it.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1
#define CIRCUITPY_I2CSLAVE
#define CIRCUITPY_DISPLAYIO (1)

@ -10,8 +10,11 @@ EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = GD25Q16C
LONGINT_IMPL = MPZ
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0
CHIP_VARIANT = SAMD51J19A
CHIP_FAMILY = samd51
MICROPY_PY_NETWORK = 1
CIRCUITPY_NETWORK = 1
MICROPY_PY_WIZNET5K = 5500

@ -9,5 +9,10 @@ EXTERNAL_FLASH_DEVICE_COUNT = 2
EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C"
LONGINT_IMPL = MPZ
# No I2S on SAMR21G
CIRCUITPY_AUDIOBUSIO = 0
# No DAC on SAMR21G
CIRCUITPY_AUDIOIO = 0
CHIP_VARIANT = SAMR21G18A
CHIP_FAMILY = samd21

@ -6,6 +6,7 @@ USB_MANUFACTURER = "Adafruit Industries LLC"
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_SMALL_BUILD = 1
CHIP_VARIANT = SAMD21E18A
CHIP_FAMILY = samd21

@ -44,7 +44,3 @@
// USB is always used internally so skip the pin objects for it.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1
#define CIRCUITPY_I2CSLAVE
#define CIRCUITPY_DISPLAYIO (1)
#define CIRCUITPY_DISPLAY_LIMIT (3)

@ -10,5 +10,8 @@ EXTERNAL_FLASH_DEVICE_COUNT = 2
EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ, GD25Q64C"
LONGINT_IMPL = MPZ
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0
CHIP_VARIANT = SAMD51P20A
CHIP_FAMILY = samd51

@ -9,9 +9,6 @@ EXTERNAL_FLASH_DEVICE_COUNT = 2
EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ, GD25Q64C"
LONGINT_IMPL = MPZ
# Disable pixelbuf to save room
EXCLUDE_PIXELBUF = 1
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21

@ -9,5 +9,10 @@ EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = GD25Q16C
LONGINT_IMPL = MPZ
# No I2S on SAMD51G
CIRCUITPY_AUDIOBUSIO = 0
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0
CHIP_VARIANT = SAMD51G19A
CHIP_FAMILY = samd51

@ -6,6 +6,7 @@ USB_MANUFACTURER = "Electronic Cats"
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_SMALL_BUILD = 1
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
CHIP_FAMILY = samd21

@ -42,5 +42,3 @@
// USB is always used internally so skip the pin objects for it.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1
#define CIRCUITPY_I2CSLAVE

@ -5,14 +5,13 @@ USB_PRODUCT = "Metro M0 Express"
USB_MANUFACTURER = "Adafruit Industries LLC"
SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 2
EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C"
LONGINT_IMPL = MPZ
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
MICROPY_PY_NETWORK = 1
CIRCUITPY_NETWORK = 1
MICROPY_PY_WIZNET5K = 5500
SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 2
EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C"

@ -43,5 +43,3 @@
// USB is always used internally so skip the pin objects for it.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1
#define CIRCUITPY_I2CSLAVE

@ -10,8 +10,11 @@ EXTERNAL_FLASH_DEVICES = "S25FL116K, S25FL216K, GD25Q16C"
LONGINT_IMPL = MPZ
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0
CHIP_VARIANT = SAMD51J19A
CHIP_FAMILY = samd51
MICROPY_PY_NETWORK = 1
CIRCUITPY_NETWORK = 1
MICROPY_PY_WIZNET5K = 5500

@ -7,7 +7,13 @@ USB_MANUFACTURER = "Benjamin Shockley"
QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = "W25Q16JV_IM"
LONGINT_IMPL = MPZ
# No I2S on SAMD51G
CIRCUITPY_AUDIOBUSIO = 0
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0
CHIP_VARIANT = SAMD51G19A
CHIP_FAMILY = samd51

@ -12,9 +12,6 @@
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
// A number of modules are removed for pIRKey to make room for frozen libraries.
#define PIRKEY_M0 (1)
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
#define IGNORE_PIN_PA02 1

@ -7,6 +7,17 @@ USB_MANUFACTURER = "Adafruit Industries LLC"
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
# A number of modules are removed for pIRKey to make room for frozen libraries.
# Many I/O functions are not available.
# math is very large and is also removed.
CIRCUITPY_ANALOGIO = 0
CIRCUITPY_MATH = 0
CIRCUITPY_NEOPIXEL_WRITE = 0
CIRCUITPY_RTC = 0
CIRCUITPY_SAMD = 0
CIRCUITPY_USB_MIDI = 0
CIRCUITPY_SMALL_BUILD = 1
CHIP_VARIANT = SAMD21E18A
CHIP_FAMILY = samd21
@ -16,5 +27,3 @@ CFLAGS_INLINE_LIMIT = 45
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DotStar
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_IRRemote
EXCLUDE_PIXELBUF = 1

@ -10,5 +10,8 @@ EXTERNAL_FLASH_DEVICE_COUNT = 2
EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ, GD25Q64C"
LONGINT_IMPL = MPZ
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0
CHIP_VARIANT = SAMD51J20A
CHIP_FAMILY = samd51

@ -8,5 +8,8 @@ QSPI_FLASH_FILESYSTEM = 0
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = MPZ
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0
CHIP_VARIANT = SAMD51J20A
CHIP_FAMILY = samd51
CHIP_FAMILY = samd51

@ -6,6 +6,7 @@ USB_MANUFACTURER = "SparkFun"
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_SMALL_BUILD = 1
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21

@ -6,6 +6,7 @@ USB_MANUFACTURER = "SparkFun"
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_SMALL_BUILD = 1
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21

@ -9,5 +9,10 @@ EXTERNAL_FLASH_DEVICE_COUNT = 2
EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ, GD25Q64C"
LONGINT_IMPL = MPZ
# No I2S on SAMD51G
CIRCUITPY_AUDIOBUSIO = 0
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0
CHIP_VARIANT = SAMD51G19A
CHIP_FAMILY = samd51

@ -6,8 +6,7 @@ USB_MANUFACTURER = "Adafruit Industries LLC"
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_SMALL_BUILD = 1
CHIP_VARIANT = SAMD21E18A
CHIP_FAMILY = samd21
EXCLUDE_PIXELBUF = 1

@ -1,153 +1,33 @@
#include <stdint.h>
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef __INCLUDED_MPCONFIGPORT_H
#define __INCLUDED_MPCONFIGPORT_H
#define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_C)
// options to control how MicroPython is built
#define MICROPY_QSTR_BYTES_IN_HASH (1)
#define MICROPY_ALLOC_PATH_MAX (256)
#define MICROPY_ALLOC_PARSE_CHUNK_INIT (16)
// TODO(tannewt): Reduce this number if we want the REPL to function under 512
// free bytes.
// #define MICROPY_ALLOC_PARSE_RULE_INIT (64)
#define MICROPY_CAN_OVERRIDE_BUILTINS (1)
#define MICROPY_EMIT_X64 (0)
#define MICROPY_EMIT_THUMB (0)
#define MICROPY_EMIT_INLINE_THUMB (0)
#define MICROPY_COMP_MODULE_CONST (1)
#define MICROPY_COMP_CONST (1)
#define MICROPY_COMP_DOUBLE_TUPLE_ASSIGN (1)
#define MICROPY_COMP_TRIPLE_TUPLE_ASSIGN (1)
#define MICROPY_MEM_STATS (0)
#define MICROPY_DEBUG_PRINTERS (0)
#define MICROPY_ENABLE_GC (1)
#define MICROPY_GC_ALLOC_THRESHOLD (0)
#define MICROPY_REPL_EVENT_DRIVEN (0)
#define MICROPY_HELPER_REPL (1)
#define MICROPY_HELPER_LEXER_UNIX (0)
#define MICROPY_ENABLE_SOURCE_LINE (1)
#define MICROPY_ENABLE_DOC_STRING (0)
//#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE)
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL)
#define MICROPY_PY_ASYNC_AWAIT (0)
#define MICROPY_PY_BUILTINS_BYTEARRAY (1)
#define MICROPY_PY_BUILTINS_MEMORYVIEW (1)
#define MICROPY_PY_BUILTINS_ENUMERATE (1)
#define MICROPY_PY_BUILTINS_HELP (1)
#define MICROPY_PY_BUILTINS_HELP_MODULES (1)
#define MICROPY_PY_BUILTINS_INPUT (1)
#define MICROPY_PY_BUILTINS_FILTER (1)
#define MICROPY_PY_BUILTINS_SET (1)
#define MICROPY_PY_BUILTINS_SLICE (1)
#define MICROPY_PY_BUILTINS_SLICE_ATTRS (1)
#define MICROPY_PY_ARRAY_SLICE_ASSIGN (1)
#define MICROPY_NONSTANDARD_TYPECODES (0)
#define MICROPY_PY_BUILTINS_PROPERTY (1)
#define MICROPY_PY_BUILTINS_MIN_MAX (1)
#define MICROPY_PY___FILE__ (1)
#define MICROPY_PY_GC (1)
#define MICROPY_PY_ARRAY (1)
#define MICROPY_PY_ATTRTUPLE (1)
#define MICROPY_PY_COLLECTIONS (1)
#define MICROPY_PY_DESCRIPTORS (1)
#define MICROPY_PY_MATH (0)
#define MICROPY_PY_CMATH (0)
#define MICROPY_PY_MICROPYTHON_MEM_INFO (0)
#define MICROPY_PY_URANDOM (0)
#define MICROPY_PY_URANDOM_EXTRA_FUNCS (0)
#define MICROPY_PY_STRUCT (0)
#define MICROPY_PY_SYS (1)
#define MICROPY_PY_SYS_MAXSIZE (1)
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
#define MICROPY_FLOAT_HIGH_QUALITY_HASH (1)
#define MICROPY_STREAMS_NON_BLOCK (1)
#ifndef MICROPY_PY_NETWORK
#define MICROPY_PY_NETWORK (0)
#endif
#ifndef MICROPY_PY_WIZNET5K
#define MICROPY_PY_WIZNET5K (0)
#endif
#ifndef MICROPY_PY_CC3K
#define MICROPY_PY_CC3K (0)
#endif
// fatfs configuration used in ffconf.h
#define MICROPY_FATFS_ENABLE_LFN (1)
#define MICROPY_FATFS_LFN_CODE_PAGE (437) /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */
#define MICROPY_FATFS_USE_LABEL (1)
#define MICROPY_FATFS_RPATH (2)
#define MICROPY_FATFS_VOLUMES (4)
#define MICROPY_FATFS_MULTI_PARTITION (1)
#define MICROPY_FATFS_NUM_PERSISTENT (1)
// Only enable this if you really need it. It allocates a byte cache of this
// size.
// #define MICROPY_FATFS_MAX_SS (4096)
#define FILESYSTEM_BLOCK_SIZE (512)
#define MICROPY_VFS (1)
#define MICROPY_VFS_FAT (1)
#define MICROPY_PY_MACHINE (1)
#define MICROPY_REPL_AUTO_INDENT (1)
#define MICROPY_HW_ENABLE_DAC (1)
#define MICROPY_ENABLE_FINALISER (1)
#define MICROPY_USE_INTERNAL_PRINTF (1)
#define MICROPY_PY_SYS_STDFILES (1)
#define MICROPY_PY_IO_FILEIO (1)
#define MICROPY_READER_VFS (1)
#define MICROPY_PERSISTENT_CODE_LOAD (1)
#define MICROPY_PY_BUILTINS_STR_UNICODE (1)
#define MICROPY_KBD_EXCEPTION (1)
// type definitions for the specific machine
#define BYTES_PER_WORD (4)
#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void*)((mp_uint_t)(p) | 1))
#define MICROPY_STACK_CHECK (1)
// Track stack usage on a debug build. Expose results via ustack module.
#ifdef MICROPY_DEBUG_MODULES
#define MICROPY_MAX_STACK_USAGE (1)
#endif
// This port is intended to be 32-bit, but unfortunately, int32_t for
// different targets may be defined in different ways - either as int
// or as long. This requires different printf formatting specifiers
// to print such value. So, we avoid int32_t and use int directly.
#define UINT_FMT "%u"
#define INT_FMT "%d"
typedef int mp_int_t; // must be pointer size
typedef unsigned mp_uint_t; // must be pointer size
typedef long mp_off_t;
// XXX check we don't need this
#define MICROPY_THREAD_YIELD()
#define MP_PLAT_PRINT_STRN(str, len) mp_hal_stdout_tx_strn_cooked(str, len)
#define mp_type_fileio mp_type_vfs_fat_fileio
#define mp_type_textio mp_type_vfs_fat_textio
#define mp_import_stat mp_vfs_import_stat
#define mp_builtin_open_obj mp_vfs_open_obj
// extra built in names to add to the global namespace
#define MICROPY_PORT_BUILTINS \
{ MP_OBJ_NEW_QSTR(MP_QSTR_help), (mp_obj_t)&mp_builtin_help_obj }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_input), (mp_obj_t)&mp_builtin_input_obj }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
// board specific definitions
#include "mpconfigboard.h"
// Definitions for which SAMD chip we're using.
#include "include/sam.h"
#ifdef SAMD21
@ -156,14 +36,15 @@ typedef long mp_off_t;
#define PORT_HEAP_SIZE (16384 + 4096)
#define SPI_FLASH_MAX_BAUDRATE 8000000
#define CIRCUITPY_DEFAULT_STACK_SIZE 4096
#define CIRCUITPY_I2C_SLAVE (0)
#define MICROPY_CPYTHON_COMPAT (0)
#define MICROPY_MODULE_WEAK_LINKS (0)
#define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (0)
#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (0)
#define MICROPY_PY_FUNCTION_ATTRS (0)
#define MICROPY_PY_IO (0)
#define MICROPY_PY_REVERSE_SPECIAL_METHODS (0)
#define MICROPY_PY_SYS_EXC_INFO (0)
#define MICROPY_PY_UERRNO_LIST \
X(EPERM) \
X(ENOENT) \
@ -181,300 +62,28 @@ typedef long mp_off_t;
#ifdef SAMD51
#define CIRCUITPY_MCU_FAMILY samd51
#define MICROPY_PY_SYS_PLATFORM "MicroChip SAMD51"
#define PORT_HEAP_SIZE (0x20000) // 128KiB
// 128KiB
#define PORT_HEAP_SIZE (0x20000)
#define SPI_FLASH_MAX_BAUDRATE 24000000
#define CIRCUITPY_DEFAULT_STACK_SIZE 0x6000
#define MICROPY_CPYTHON_COMPAT (1)
#define MICROPY_MODULE_WEAK_LINKS (1)
#define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (1)
#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (1)
#define MICROPY_PY_FUNCTION_ATTRS (1)
#define MICROPY_PY_IO (1)
#define MICROPY_PY_REVERSE_SPECIAL_METHODS (1)
#define MICROPY_PY_SYS_EXC_INFO (1)
// MICROPY_PY_UERRNO_LIST - Use the default
#endif
#ifdef LONGINT_IMPL_NONE
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_NONE)
#endif
#ifdef LONGINT_IMPL_MPZ
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
#define MP_SSIZE_MAX (0x7fffffff)
#endif
#ifdef LONGINT_IMPL_LONGLONG
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_LONGLONG)
#endif
// extra built in modules to add to the list of known ones
extern const struct _mp_obj_module_t microcontroller_module;
extern const struct _mp_obj_module_t bitbangio_module;
extern const struct _mp_obj_module_t audioio_module;
extern const struct _mp_obj_module_t audiobusio_module;
extern const struct _mp_obj_module_t analogio_module;
extern const struct _mp_obj_module_t digitalio_module;
extern const struct _mp_obj_module_t displayio_module;
extern const struct _mp_obj_module_t pulseio_module;
extern const struct _mp_obj_module_t busio_module;
extern const struct _mp_obj_module_t board_module;
extern const struct _mp_obj_module_t i2cslave_module;
extern const struct _mp_obj_module_t math_module;
extern const struct _mp_obj_module_t os_module;
extern const struct _mp_obj_module_t random_module;
extern const struct _mp_obj_module_t rotaryio_module;
extern const struct _mp_obj_module_t rtc_module;
extern const struct _mp_obj_module_t samd_module;
extern const struct _mp_obj_module_t storage_module;
extern const struct _mp_obj_module_t struct_module;
extern const struct _mp_obj_module_t time_module;
extern const struct _mp_obj_module_t cpy_nvm_module;
extern const struct _mp_obj_module_t neopixel_write_module;
extern const struct _mp_obj_module_t uheap_module;
extern const struct _mp_obj_module_t ustack_module;
extern const struct _mp_obj_module_t supervisor_module;
extern const struct _mp_obj_module_t gamepad_module;
extern const struct _mp_obj_module_t stage_module;
extern const struct _mp_obj_module_t terminalio_module;
extern const struct _mp_obj_module_t touchio_module;
extern const struct _mp_obj_module_t usb_hid_module;
extern const struct _mp_obj_module_t usb_midi_module;
extern const struct _mp_obj_module_t network_module;
extern const struct _mp_obj_module_t socket_module;
extern const struct _mp_obj_module_t wiznet_module;
#ifndef EXCLUDE_PIXELBUF
extern const struct _mp_obj_module_t pixelbuf_module;
#endif
// Internal flash size dependent settings.
#if BOARD_FLASH_SIZE > 192000
#define MICROPY_PY_BUILTINS_STR_CENTER (1)
#define MICROPY_PY_BUILTINS_STR_PARTITION (1)
#define MICROPY_PY_BUILTINS_FROZENSET (1)
#define MICROPY_PY_BUILTINS_STR_SPLITLINES (1)
#define MICROPY_PY_BUILTINS_REVERSED (1)
#define MICROPY_PY_UERRNO (1)
#define MICROPY_PY_UERRNO_ERRORCODE (0)
#define MICROPY_PY_URE (1)
#ifndef MICROPY_PY_FRAMEBUF
#define MICROPY_PY_FRAMEBUF (0)
#endif
#define MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG (1)
#define MICROPY_PY_ALL_SPECIAL_METHODS (1)
// Scan gamepad every 32ms
#define CIRCUITPY_GAMEPAD_TICKS 0x1f
#if defined(__SAMD51G19A__) || defined(__SAMD51G18A__) || defined(__SAMR21G18A__)
#define AUDIOBUSIO_MODULE
#else
#define AUDIOBUSIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_audiobusio), (mp_obj_t)&audiobusio_module },
#endif
#if defined(__SAMR21G18A__)
#define AUDIOIO_MODULE
#else
#define AUDIOIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_audioio), (mp_obj_t)&audioio_module },
#endif
#ifdef CIRCUITPY_I2CSLAVE
#define I2CSLAVE_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_i2cslave), (mp_obj_t)&i2cslave_module },
#else
#define I2CSLAVE_MODULE
#endif
#if !defined(CIRCUITPY_DISPLAYIO) || CIRCUITPY_DISPLAYIO
#define CIRCUITPY_DISPLAYIO (1)
#define CIRCUITPY_DISPLAY_LIMIT (3)
#define DISPLAYIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_displayio), (mp_obj_t)&displayio_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_terminalio), (mp_obj_t)&terminalio_module },
#else
#define CIRCUITPY_DISPLAYIO (0)
#define CIRCUITPY_DISPLAY_LIMIT (0)
#define DISPLAYIO_MODULE
#endif
#if MICROPY_PY_NETWORK
#define NETWORK_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_network), (mp_obj_t)&network_module },
#define SOCKET_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_socket), (mp_obj_t)&socket_module },
#if MICROPY_PY_WIZNET5K
#define WIZNET_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_wiznet), (mp_obj_t)&wiznet_module },
#else
#define WIZNET_MODULE
#endif
#else
#define NETWORK_MODULE
#define SOCKET_MODULE
#define WIZNET_MODULE
#endif
// (u)json depends, perhaps erroneously, on MICROPY_PY_IO
#if MICROPY_PY_IO
#define JSON_MODULE { MP_ROM_QSTR(MP_QSTR_json), MP_ROM_PTR(&mp_module_ujson) },
#define MICROPY_PY_UJSON (1)
#else
#define JSON_MODULE
#endif
#ifndef EXCLUDE_PIXELBUF
#define PIXELBUF_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR__pixelbuf),(mp_obj_t)&pixelbuf_module }
#else
#define PIXELBUF_MODULE
#endif
#ifndef EXTRA_BUILTIN_MODULES
#define EXTRA_BUILTIN_MODULES \
AUDIOIO_MODULE \
AUDIOBUSIO_MODULE \
{ MP_OBJ_NEW_QSTR(MP_QSTR_bitbangio), (mp_obj_t)&bitbangio_module }, \
DISPLAYIO_MODULE \
I2CSLAVE_MODULE \
NETWORK_MODULE \
SOCKET_MODULE \
WIZNET_MODULE \
JSON_MODULE \
{ MP_OBJ_NEW_QSTR(MP_QSTR_rotaryio), (mp_obj_t)&rotaryio_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_gamepad),(mp_obj_t)&gamepad_module }, \
PIXELBUF_MODULE
#endif
#define EXPRESS_BOARD
#else
#define MICROPY_PY_BUILTINS_REVERSED (0)
#define MICROPY_PY_FRAMEBUF (0)
#ifndef EXTRA_BUILTIN_MODULES
#define EXTRA_BUILTIN_MODULES
#endif
#define MICROPY_PY_BUILTINS_COMPLEX (0)
#define MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG (0)
#define CIRCUITPY_DISPLAYIO (0)
#define CIRCUITPY_DISPLAY_LIMIT (0)
#endif
// Disabled for now.
// { MP_OBJ_NEW_QSTR(MP_QSTR__stage), (mp_obj_t)&stage_module },
#ifdef SAMD21
#define TOUCHIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_touchio), (mp_obj_t)&touchio_module },
#endif
#ifdef SAMD51
#define TOUCHIO_MODULE
#endif
// A pIRKey has minimal I/O needs. Remove unneeded modules to make room
// for frozen modules. math is very large and is also removed.
#ifdef PIRKEY_M0
#define MICROPY_PORT_BUILTIN_MODULES \
{ MP_OBJ_NEW_QSTR(MP_QSTR_board), (mp_obj_t)&board_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_busio), (mp_obj_t)&busio_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_digitalio), (mp_obj_t)&digitalio_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_microcontroller), (mp_obj_t)&microcontroller_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_os), (mp_obj_t)&os_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_pulseio), (mp_obj_t)&pulseio_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_random), (mp_obj_t)&random_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_storage), (mp_obj_t)&storage_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_struct), (mp_obj_t)&struct_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_supervisor), (mp_obj_t)&supervisor_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_time), (mp_obj_t)&time_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_usb_hid),(mp_obj_t)&usb_hid_module },
#elif MICROPY_MODULE_WEAK_LINKS
#define MICROPY_PORT_BUILTIN_MODULES \
{ MP_OBJ_NEW_QSTR(MP_QSTR_analogio), (mp_obj_t)&analogio_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_board), (mp_obj_t)&board_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_busio), (mp_obj_t)&busio_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_digitalio), (mp_obj_t)&digitalio_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_microcontroller), (mp_obj_t)&microcontroller_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_neopixel_write),(mp_obj_t)&neopixel_write_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR__os), (mp_obj_t)&os_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_pulseio), (mp_obj_t)&pulseio_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_random), (mp_obj_t)&random_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_rtc), (mp_obj_t)&rtc_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_samd),(mp_obj_t)&samd_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_storage), (mp_obj_t)&storage_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_struct), (mp_obj_t)&struct_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_supervisor), (mp_obj_t)&supervisor_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_math), (mp_obj_t)&math_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR__time), (mp_obj_t)&time_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_usb_hid),(mp_obj_t)&usb_hid_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_usb_midi),(mp_obj_t)&usb_midi_module }, \
TOUCHIO_MODULE \
EXTRA_BUILTIN_MODULES
#define MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS \
{ MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_module_uerrno) }, \
{ MP_ROM_QSTR(MP_QSTR_io), MP_ROM_PTR(&mp_module_io) }, \
{ MP_ROM_QSTR(MP_QSTR_os), MP_ROM_PTR(&os_module) }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_time), (mp_obj_t)&time_module }, \
#else
#define MICROPY_PORT_BUILTIN_MODULES \
{ MP_OBJ_NEW_QSTR(MP_QSTR_analogio), (mp_obj_t)&analogio_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_board), (mp_obj_t)&board_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_busio), (mp_obj_t)&busio_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_digitalio), (mp_obj_t)&digitalio_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_microcontroller), (mp_obj_t)&microcontroller_module }, \