Skip to content

Commit 6f6b9db

Browse files
committed
Remove old build flags, add fixes for shared_matrix
1 parent 25245bc commit 6f6b9db

File tree

5 files changed

+107
-164
lines changed

5 files changed

+107
-164
lines changed

docs/porting.rst

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
We love CircuitPython and would love to see it come to more microcontroller
2-
platforms. With 3.0 we've reworked CircuitPython to make it easier than ever to
2+
platforms. Since 3.0 we've reworked CircuitPython to make it easier than ever to
33
add support. While there are some major differences between ports, this page
44
covers the similarities that make CircuitPython what it is and how that core
55
fits into a variety of microcontrollers.
@@ -19,7 +19,7 @@ prepping file systems and automatically running user code on boot. In
1919
CircuitPython we've dubbed this component the supervisor because it monitors
2020
and facilitates the VMs which run user Python code. Porting involves the
2121
supervisor because many of the tasks it does while interfacing with the
22-
hardware. Once its going though, the REPL works and debugging can migrate to a
22+
hardware. Once complete, the REPL works and debugging can migrate to a
2323
Python based approach rather than C.
2424

2525
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
4242
present). This includes the Makefile and any C library resources. Make sure
4343
these resources are compatible with the MIT License of the rest of the code!
4444

45+
Circuitpython has a number of modules enabled by default in
46+
``py/circuitpy_mpconfig.mk``. Most of these modules will need to be disabled in
47+
``mpconfigboard.mk`` during the early stages of a port in order for it to
48+
compile. As the port progresses in module support, this list can be pruned down
49+
as a natural "TODO" list. An example minimal build list is shown below:
50+
51+
.. code-block:: makefile
52+
53+
# Items requiring ports/<port>/common-hal implementation:
54+
CIRCUITPY_MICROCONTROLLER = 0 # Typically the first module to create
55+
CIRCUITPY_DIGITALIO = 0 # Typically the second module to create
56+
CIRCUITPY_ANALOGIO = 0
57+
CIRCUITPY_BUSIO = 0
58+
CIRCUITPY_NEOPIXEL_WRITE = 0
59+
CIRCUITPY_PULSEIO = 0
60+
CIRCUITPY_OS = 0
61+
CIRCUITPY_NVM = 0
62+
CIRCUITPY_AUDIOBUSIO = 0
63+
CIRCUITPY_AUDIOIO = 0
64+
CIRCUITPY_ROTARYIO = 0
65+
CIRCUITPY_RTC = 0
66+
CIRCUITPY_FREQUENCYIO = 0
67+
CIRCUITPY_I2CSLAVE = 0
68+
CIRCUITPY_DISPLAYIO = 0 # Requires SPI, PulseIO (stub ok)
69+
70+
# Modules with no common-hal implementation, but depend on something else
71+
CIRCUITPY_BITBANGIO = 0 # Requires DigitalIO
72+
CIRCUITPY_GAMEPAD = 0 # Requires DigitalIO
73+
CIRCUITPY_PIXELBUF = 0 # Does nothing without a neopixel or dotstar
74+
CIRCUITPY_RANDOM = 0 # Requires OS
75+
CIRCUITPY_STORAGE = 0 # Requires OS, filesystem
76+
CIRCUITPY_TOUCHIO = 0 # Requires Microcontroller
77+
CIRCUITPY_USB_HID = 0 # Requires USB
78+
CIRCUITPY_USB_MIDI = 0 # Requires USB
79+
CIRCUITPY_REQUIRE_I2C_PULLUPS = 0 # Does nothing without I2C
80+
CIRCUITPY_ULAB = 0 # No requirements, but takes extra flash
81+
4582
Step 2: Init
4683
--------------
4784
Once your build is setup, the next step should be to get your clocks going as

docs/shared_bindings_matrix.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import re
2727

2828

29-
SUPPORTED_PORTS = ["atmel-samd", "nrf", "stm32f4", "mimxrt10xx"]
29+
SUPPORTED_PORTS = ["atmel-samd", "nrf", "stm", "mimxrt10xx"]
3030

3131

3232
def parse_port_config(contents, chip_keyword=None):
@@ -178,12 +178,6 @@ def get_excluded_boards(base):
178178
if small_build and base[module]["full_build"] == "1":
179179
board_is_excluded = True
180180

181-
# check if board uses `MINIMAL_BUILD`. if yes, and current
182-
# module is marked as `DEFAULT_BUILD`, board is excluded
183-
min_build = re.search("CIRCUITPY_MINIMAL_BUILD = 1", contents)
184-
if min_build and base[module]["default_value"] == "CIRCUITPY_DEFAULT_BUILD":
185-
board_is_excluded = True
186-
187181
# check if module is specifically disabled for this board
188182
re_pattern = r"CIRCUITPY_{}\s=\s(\w)".format(module.upper())
189183
find_module = re.search(re_pattern, contents)

ports/stm/mpconfigport.mk

Lines changed: 39 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,56 @@
1-
# Define an equivalent for MICROPY_LONGINT_IMPL, to pass to $(MPY-TOOL) in py/mkrules.mk
2-
# $(MPY-TOOL) needs to know what kind of longint to use (if any) to freeze long integers.
3-
# This should correspond to the MICROPY_LONGINT_IMPL definition in mpconfigport.h.
41
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=mpz
5-
6-
# Internal math library is substantially smaller than toolchain one
2+
LONGINT_IMPL = MPZ
73
INTERNAL_LIBM = 1
8-
9-
# Chip supplied serial number, in bytes
104
USB_SERIAL_NUMBER_LENGTH = 24
115

12-
# Longints can be implemented as mpz, as longlong, or not
13-
LONGINT_IMPL = MPZ
14-
15-
# Reduced feature set for early port
16-
CIRCUITPY_MINIMAL_BUILD = 1
17-
18-
# The ifndef's allow overriding in mpconfigboard.mk.
19-
20-
ifndef CIRCUITPY_BOARD
21-
CIRCUITPY_BOARD = 1
22-
endif
23-
24-
ifndef CIRCUITPY_DIGITALIO
25-
CIRCUITPY_DIGITALIO = 1
26-
endif
27-
28-
ifndef CIRCUITPY_ANALOGIO
29-
CIRCUITPY_ANALOGIO = 1
30-
endif
31-
32-
ifndef CIRCUITPY_MICROCONTROLLER
33-
CIRCUITPY_MICROCONTROLLER = 1
34-
endif
35-
36-
ifndef CIRCUITPY_BUSIO
37-
CIRCUITPY_BUSIO = 1
38-
endif
39-
40-
ifndef CIRCUITPY_PULSEIO
41-
CIRCUITPY_PULSEIO = 1
42-
endif
43-
44-
ifndef CIRCUITPY_OS
45-
CIRCUITPY_OS = 1
6+
ifeq ($(MCU_SERIES), F4)
7+
# Items requiring common-hal implementation:
8+
CIRCUITPY_AUDIOBUSIO = 0
9+
CIRCUITPY_AUDIOIO = 0
10+
CIRCUITPY_ROTARYIO = 0
11+
CIRCUITPY_RTC = 0
12+
CIRCUITPY_FREQUENCYIO = 0
13+
CIRCUITPY_I2CSLAVE = 0
14+
# Can be overridden on board level
15+
ifndef CIRCUITPY_NVM
16+
CIRCUITPY_NVM = 0
17+
endif
4618
endif
4719

48-
ifndef CIRCUITPY_STORAGE
49-
CIRCUITPY_STORAGE = 1
50-
endif
51-
52-
ifndef CIRCUITPY_RANDOM
53-
CIRCUITPY_RANDOM = 1
54-
endif
55-
56-
ifndef CRICUITPY_USB_HID
57-
CIRCUITPY_USB_HID = 1
58-
endif
59-
60-
ifndef CIRCUITPY_USB_MIDI
61-
CIRCUITPY_USB_MIDI = 1
62-
endif
63-
64-
ifndef CIRCUITPY_NEOPIXEL_WRITE
65-
CIRCUITPY_NEOPIXEL_WRITE = 1
66-
endif
67-
68-
ifndef CIRCUITPY_DISPLAYIO
69-
CIRCUITPY_DISPLAYIO = 1
70-
endif
71-
72-
CFLAGS += -DMICROPY_CPYTHON_COMPAT=1
73-
74-
CIRCUITPY_ULAB = 1
75-
7620
ifeq ($(MCU_SERIES), H7)
77-
CIRCUITPY_BOARD = 1
78-
CIRCUITPY_DIGITALIO = 1
21+
# Items requiring common-hal implementation:
7922
CIRCUITPY_ANALOGIO = 0
80-
CIRCUITPY_MICROCONTROLLER = 1
81-
CIRCUITPY_BUSIO = 1
23+
CIRCUITPY_NEOPIXEL_WRITE = 0
8224
CIRCUITPY_PULSEIO = 0
8325
CIRCUITPY_OS = 0
84-
CIRCUITPY_STORAGE = 0
85-
CIRCUITPY_RANDOM = 0
86-
CIRCUITPY_USB_HID = 0
87-
CIRCUITPY_USB_MIDI = 0
88-
CIRCUITPY_NEOPIXEL_WRITE = 0
89-
CIRCUITPY_DISPLAYIO = 0
26+
CIRCUITPY_NVM = 0
27+
CIRCUITPY_AUDIOBUSIO = 0
28+
CIRCUITPY_AUDIOIO = 0
29+
CIRCUITPY_ROTARYIO = 0
30+
CIRCUITPY_RTC = 0
31+
CIRCUITPY_FREQUENCYIO = 0
32+
CIRCUITPY_I2CSLAVE = 0
33+
# Modules with no common-hal implementation that depend on something else
34+
CIRCUITPY_DISPLAYIO = 0 # Requires SPI, PulseIO, and common-hal module (stub ok)
35+
CIRCUITPY_RANDOM = 0 # Requires OS
36+
CIRCUITPY_STORAGE = 0 # Requires OS, filesystem
9037
endif
9138

9239
ifeq ($(MCU_SERIES), F7)
93-
CIRCUITPY_BOARD = 1
94-
CIRCUITPY_DIGITALIO = 1
40+
# Items requiring common-hal implementation:
9541
CIRCUITPY_ANALOGIO = 0
96-
CIRCUITPY_MICROCONTROLLER = 1
97-
CIRCUITPY_BUSIO = 1
42+
CIRCUITPY_NEOPIXEL_WRITE = 0
9843
CIRCUITPY_PULSEIO = 0
9944
CIRCUITPY_OS = 0
100-
CIRCUITPY_STORAGE = 0
101-
CIRCUITPY_RANDOM = 0
102-
CIRCUITPY_USB_HID = 0
103-
CIRCUITPY_USB_MIDI = 0
104-
CIRCUITPY_NEOPIXEL_WRITE = 0
105-
CIRCUITPY_DISPLAYIO = 0
45+
CIRCUITPY_NVM = 0
46+
CIRCUITPY_AUDIOBUSIO = 0
47+
CIRCUITPY_AUDIOIO = 0
48+
CIRCUITPY_ROTARYIO = 0
49+
CIRCUITPY_RTC = 0
50+
CIRCUITPY_FREQUENCYIO = 0
51+
CIRCUITPY_I2CSLAVE = 0
52+
# Modules with no common-hal implementation that depend on something else
53+
CIRCUITPY_DISPLAYIO = 0 # Requires SPI, PulseIO, and common-hal module (stub ok)
54+
CIRCUITPY_RANDOM = 0 # Requires OS
55+
CIRCUITPY_STORAGE = 0 # Requires OS, filesystem
10656
endif

py/circuitpy_mpconfig.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -179,17 +179,11 @@ typedef long mp_off_t;
179179
// board-specific definitions, which control and may override definitions below.
180180
#include "mpconfigboard.h"
181181

182-
// CIRCUITPY_FULL_BUILD is defined in a *.mk file.
183-
182+
// CIRCUITPY_FULL_BUILD is defined in py/circuitpy_mpconfig.mk
184183
// Remove some lesser-used functionality to make small builds fit.
185184
#define MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG (CIRCUITPY_FULL_BUILD)
186-
//TODO: replace this with a rework of the FULL_BUILD system
187-
#if !defined(MICROPY_CPYTHON_COMPAT)
188-
#define MICROPY_CPYTHON_COMPAT (CIRCUITPY_FULL_BUILD)
189-
#endif
190-
#if !defined(MICROPY_COMP_FSTRING_LITERAL)
185+
#define MICROPY_CPYTHON_COMPAT (CIRCUITPY_FULL_BUILD)
191186
#define MICROPY_COMP_FSTRING_LITERAL (MICROPY_CPYTHON_COMPAT)
192-
#endif
193187
#define MICROPY_MODULE_WEAK_LINKS (CIRCUITPY_FULL_BUILD)
194188
#define MICROPY_PY_ALL_SPECIAL_METHODS (CIRCUITPY_FULL_BUILD)
195189
#define MICROPY_PY_BUILTINS_COMPLEX (CIRCUITPY_FULL_BUILD)
@@ -223,7 +217,7 @@ typedef long mp_off_t;
223217
#define MP_SSIZE_MAX (0x7fffffff)
224218
#endif
225219

226-
#if INTERNAL_FLASH_FILESYSTEM == 0 && QSPI_FLASH_FILESYSTEM == 0 && SPI_FLASH_FILESYSTEM == 0 && !CIRCUITPY_MINIMAL_BUILD
220+
#if INTERNAL_FLASH_FILESYSTEM == 0 && QSPI_FLASH_FILESYSTEM == 0 && SPI_FLASH_FILESYSTEM == 0 && !DISABLE_FILESYSTEM
227221
#error No *_FLASH_FILESYSTEM set!
228222
#endif
229223

0 commit comments

Comments
 (0)