Skip to content

Commit 767ca5c

Browse files
committed
Merge remote-tracking branch 'adafruit/main' into native_wifi
2 parents 46dc133 + 24fb08d commit 767ca5c

File tree

28 files changed

+428
-75
lines changed

28 files changed

+428
-75
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ jobs:
410410
board:
411411
- "espressif_saola_1_wroom"
412412
- "espressif_saola_1_wrover"
413+
- "microdev_micro_s2"
413414
- "unexpectedmaker_feathers2"
414415

415416
steps:

conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
# Grab the JSON values to use while building the module support matrix
4343
# in 'shared-bindings/index.rst'
4444

45+
# The stubs must be built before we calculate the shared bindings matrix
46+
subprocess.check_output(["make", "stubs"])
47+
4548
#modules_support_matrix = shared_bindings_matrix.support_matrix_excluded_boards()
4649
modules_support_matrix = shared_bindings_matrix.support_matrix_by_board()
4750

@@ -77,7 +80,6 @@
7780
'.md': 'markdown',
7881
}
7982

80-
subprocess.check_output(["make", "stubs"])
8183
extensions.append('autoapi.extension')
8284

8385
autoapi_type = 'python'

docs/porting.rst

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,15 @@ as a natural "TODO" list. An example minimal build list is shown below:
5151
.. code-block:: makefile
5252
5353
# These modules are implemented in ports/<port>/common-hal:
54-
CIRCUITPY_MICROCONTROLLER = 0 # Typically the first module to create
55-
CIRCUITPY_DIGITALIO = 0 # Typically the second module to create
54+
55+
# Typically the first module to create
56+
CIRCUITPY_MICROCONTROLLER = 0
57+
# Typically the second module to create
58+
CIRCUITPY_DIGITALIO = 0
59+
# Other modules:
5660
CIRCUITPY_ANALOGIO = 0
5761
CIRCUITPY_BUSIO = 0
62+
CIRCUITPY_COUNTIO = 0
5863
CIRCUITPY_NEOPIXEL_WRITE = 0
5964
CIRCUITPY_PULSEIO = 0
6065
CIRCUITPY_OS = 0
@@ -63,22 +68,34 @@ as a natural "TODO" list. An example minimal build list is shown below:
6368
CIRCUITPY_AUDIOIO = 0
6469
CIRCUITPY_ROTARYIO = 0
6570
CIRCUITPY_RTC = 0
71+
CIRCUITPY_SDCARDIO = 0
72+
CIRCUITPY_FRAMEBUFFERIO = 0
6673
CIRCUITPY_FREQUENCYIO = 0
6774
CIRCUITPY_I2CPERIPHERAL = 0
68-
CIRCUITPY_DISPLAYIO = 0 # Requires SPI, PulseIO (stub ok)
75+
# Requires SPI, PulseIO (stub ok):
76+
CIRCUITPY_DISPLAYIO = 0
6977
7078
# These modules are implemented in shared-module/ - they can be included in
7179
# any port once their prerequisites in common-hal are complete.
72-
CIRCUITPY_BITBANGIO = 0 # Requires DigitalIO
73-
CIRCUITPY_GAMEPAD = 0 # Requires DigitalIO
74-
CIRCUITPY_PIXELBUF = 0 # Requires neopixel_write or SPI (dotstar)
75-
CIRCUITPY_RANDOM = 0 # Requires OS
76-
CIRCUITPY_STORAGE = 0 # Requires OS, filesystem
77-
CIRCUITPY_TOUCHIO = 0 # Requires Microcontroller
78-
CIRCUITPY_USB_HID = 0 # Requires USB
79-
CIRCUITPY_USB_MIDI = 0 # Requires USB
80-
CIRCUITPY_REQUIRE_I2C_PULLUPS = 0 # Does nothing without I2C
81-
CIRCUITPY_ULAB = 0 # No requirements, but takes extra flash
80+
# Requires DigitalIO:
81+
CIRCUITPY_BITBANGIO = 0
82+
# Requires DigitalIO
83+
CIRCUITPY_GAMEPAD = 0
84+
# Requires neopixel_write or SPI (dotstar)
85+
CIRCUITPY_PIXELBUF = 0
86+
# Requires OS
87+
CIRCUITPY_RANDOM = 0
88+
# Requires OS, filesystem
89+
CIRCUITPY_STORAGE = 0
90+
# Requires Microcontroller
91+
CIRCUITPY_TOUCHIO = 0
92+
# Requires USB
93+
CIRCUITPY_USB_HID = 0
94+
CIRCUITPY_USB_MIDI = 0
95+
# Does nothing without I2C
96+
CIRCUITPY_REQUIRE_I2C_PULLUPS = 0
97+
# No requirements, but takes extra flash
98+
CIRCUITPY_ULAB = 0
8299
83100
Step 2: Init
84101
--------------

docs/shared_bindings_matrix.py

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import subprocess
2929
import sys
3030

31+
from concurrent.futures import ThreadPoolExecutor
3132

3233
SUPPORTED_PORTS = ['atmel-samd', 'esp32s2', 'litex', 'mimxrt10xx', 'nrf', 'stm']
3334

@@ -42,7 +43,7 @@ def get_circuitpython_root_dir():
4243
def get_shared_bindings():
4344
""" Get a list of modules in shared-bindings based on folder names
4445
"""
45-
shared_bindings_dir = get_circuitpython_root_dir() / "shared-bindings"
46+
shared_bindings_dir = get_circuitpython_root_dir() / "circuitpython-stubs"
4647
return [item.name for item in shared_bindings_dir.iterdir()]
4748

4849

@@ -131,38 +132,44 @@ def lookup_setting(settings, key, default=''):
131132
key = value[2:-1]
132133
return value
133134

135+
def all_ports_all_boards(ports=SUPPORTED_PORTS):
136+
for port in ports:
137+
138+
port_dir = get_circuitpython_root_dir() / "ports" / port
139+
for entry in (port_dir / "boards").iterdir():
140+
if not entry.is_dir():
141+
continue
142+
yield (port, entry)
143+
134144
def support_matrix_by_board(use_branded_name=True):
135145
""" Compiles a list of the available core modules available for each
136146
board.
137147
"""
138148
base = build_module_map()
139149

140-
boards = dict()
141-
for port in SUPPORTED_PORTS:
142-
150+
def support_matrix(arg):
151+
port, entry = arg
143152
port_dir = get_circuitpython_root_dir() / "ports" / port
144-
for entry in (port_dir / "boards").iterdir():
145-
if not entry.is_dir():
146-
continue
147-
board_modules = []
148-
board_name = entry.name
149-
150-
settings = get_settings_from_makefile(str(port_dir), entry.name)
151-
152-
if use_branded_name:
153-
with open(entry / "mpconfigboard.h") as get_name:
154-
board_contents = get_name.read()
155-
board_name_re = re.search(r"(?<=MICROPY_HW_BOARD_NAME)\s+(.+)",
156-
board_contents)
157-
if board_name_re:
158-
board_name = board_name_re.group(1).strip('"')
159-
160-
board_modules = []
161-
for module in base:
162-
key = f'CIRCUITPY_{module.upper()}'
163-
if int(lookup_setting(settings, key, '0')):
164-
board_modules.append(base[module]['name'])
165-
boards[board_name] = sorted(board_modules)
153+
settings = get_settings_from_makefile(str(port_dir), entry.name)
154+
155+
if use_branded_name:
156+
with open(entry / "mpconfigboard.h") as get_name:
157+
board_contents = get_name.read()
158+
board_name_re = re.search(r"(?<=MICROPY_HW_BOARD_NAME)\s+(.+)",
159+
board_contents)
160+
if board_name_re:
161+
board_name = board_name_re.group(1).strip('"')
162+
163+
board_modules = []
164+
for module in base:
165+
key = f'CIRCUITPY_{module.upper()}'
166+
if int(lookup_setting(settings, key, '0')):
167+
board_modules.append(base[module]['name'])
168+
169+
return (board_name, sorted(board_modules))
170+
171+
executor = ThreadPoolExecutor(max_workers=os.cpu_count())
172+
boards = dict(sorted(executor.map(support_matrix, all_ports_all_boards())))
166173

167174
#print(json.dumps(boards, indent=2))
168175
return boards

lib/utils/pyexec.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
113113
start = mp_hal_ticks_ms();
114114
mp_call_function_0(module_fun);
115115
mp_hal_set_interrupt_char(-1); // disable interrupt
116+
// Handle any ctrl-c interrupt that arrived just in time
117+
mp_handle_pending();
116118
nlr_pop();
117119
ret = 0;
118120
if (exec_flags & EXEC_FLAG_PRINT_EOF) {

locale/circuitpython.pot

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2020-08-25 16:39-0700\n"
11+
"POT-Creation-Date: 2020-08-27 11:21-0400\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <[email protected]>\n"
@@ -1349,8 +1349,8 @@ msgstr ""
13491349
#: ports/nrf/common-hal/pulseio/PulseOut.c
13501350
#: ports/stm/common-hal/pulseio/PulseOut.c
13511351
msgid ""
1352-
"Port does not accept pins or frequency. "
1353-
"Construct and pass a PWMOut Carrier instead"
1352+
"Port does not accept pins or frequency. Construct and pass a PWMOut Carrier "
1353+
"instead"
13541354
msgstr ""
13551355

13561356
#: shared-bindings/_bleio/Adapter.c
@@ -1365,6 +1365,10 @@ msgstr ""
13651365
msgid "Pull not used when direction is output."
13661366
msgstr ""
13671367

1368+
#: ports/stm/ref/pulseout-pre-timeralloc.c
1369+
msgid "PulseOut not supported on this chip"
1370+
msgstr ""
1371+
13681372
#: ports/stm/common-hal/os/__init__.c
13691373
msgid "RNG DeInit Error"
13701374
msgstr ""

ports/atmel-samd/common-hal/pulseio/PulseOut.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self,
101101
uint32_t frequency,
102102
uint16_t duty_cycle) {
103103
if (!carrier || pin || frequency) {
104-
mp_raise_NotImplementedError(translate("Port does not accept pins or frequency. \
105-
Construct and pass a PWMOut Carrier instead"));
104+
mp_raise_NotImplementedError(translate("Port does not accept pins or frequency. Construct and pass a PWMOut Carrier instead"));
106105
}
107106

108107
if (refcount == 0) {

ports/cxd56/common-hal/pulseio/PulseOut.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self,
6464
uint32_t frequency,
6565
uint16_t duty_cycle) {
6666
if (!carrier || pin || frequency) {
67-
mp_raise_NotImplementedError(translate("Port does not accept pins or frequency. \
68-
Construct and pass a PWMOut Carrier instead"));
67+
mp_raise_NotImplementedError(translate("Port does not accept pins or frequency. Construct and pass a PWMOut Carrier instead"));
6968
}
7069

7170
if (pulse_fd < 0) {
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
CONFIG_ESP32S2_SPIRAM_SUPPORT=y
2+
3+
#
4+
# SPI RAM config
5+
#
6+
# CONFIG_SPIRAM_TYPE_AUTO is not set
7+
CONFIG_SPIRAM_TYPE_ESPPSRAM16=y
8+
# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set
9+
# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set
10+
CONFIG_SPIRAM_SIZE=2097152
11+
12+
#
13+
# PSRAM clock and cs IO for ESP32S2
14+
#
15+
CONFIG_DEFAULT_PSRAM_CLK_IO=30
16+
CONFIG_DEFAULT_PSRAM_CS_IO=26
17+
# end of PSRAM clock and cs IO for ESP32S2
18+
19+
# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set
20+
# CONFIG_SPIRAM_RODATA is not set
21+
# CONFIG_SPIRAM_SPEED_80M is not set
22+
CONFIG_SPIRAM_SPEED_40M=y
23+
# CONFIG_SPIRAM_SPEED_26M is not set
24+
# CONFIG_SPIRAM_SPEED_20M is not set
25+
CONFIG_SPIRAM=y
26+
CONFIG_SPIRAM_BOOT_INIT=y
27+
# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set
28+
CONFIG_SPIRAM_USE_MEMMAP=y
29+
# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set
30+
# CONFIG_SPIRAM_USE_MALLOC is not set
31+
CONFIG_SPIRAM_MEMTEST=y
32+
# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set
33+
# end of SPI RAM config
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#include "boards/board.h"
28+
#include "mpconfigboard.h"
29+
#include "shared-bindings/microcontroller/Pin.h"
30+
31+
void board_init(void) {
32+
// USB
33+
common_hal_never_reset_pin(&pin_GPIO19);
34+
common_hal_never_reset_pin(&pin_GPIO20);
35+
36+
// Debug UART
37+
common_hal_never_reset_pin(&pin_GPIO43);
38+
common_hal_never_reset_pin(&pin_GPIO44);
39+
40+
// SPI Flash and RAM
41+
common_hal_never_reset_pin(&pin_GPIO26);
42+
common_hal_never_reset_pin(&pin_GPIO27);
43+
common_hal_never_reset_pin(&pin_GPIO28);
44+
common_hal_never_reset_pin(&pin_GPIO29);
45+
common_hal_never_reset_pin(&pin_GPIO30);
46+
common_hal_never_reset_pin(&pin_GPIO31);
47+
common_hal_never_reset_pin(&pin_GPIO32);
48+
}
49+
50+
bool board_requests_safe_mode(void) {
51+
return false;
52+
}
53+
54+
void reset_board(void) {
55+
56+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
//Micropython setup
28+
29+
#define MICROPY_HW_BOARD_NAME "microDev microS2"
30+
#define MICROPY_HW_MCU_NAME "ESP32S2"
31+
32+
#define MICROPY_HW_LED (&pin_GPIO21)
33+
#define MICROPY_HW_NEOPIXEL (&pin_GPIO33)
34+
35+
#define AUTORESET_DELAY_MS 500
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
USB_VID = 0x239A
2+
USB_PID = 0x80C6
3+
USB_PRODUCT = "microS2"
4+
USB_MANUFACTURER = "microDev"
5+
6+
INTERNAL_FLASH_FILESYSTEM = 1
7+
LONGINT_IMPL = MPZ
8+
9+
# The default queue depth of 16 overflows on release builds,
10+
# so increase it to 32.
11+
CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
12+
13+
CIRCUITPY_ESP_FLASH_MODE=qio
14+
CIRCUITPY_ESP_FLASH_FREQ=40m
15+
CIRCUITPY_ESP_FLASH_SIZE=16MB

0 commit comments

Comments
 (0)