Skip to content

Commit c534a87

Browse files
authored
Merge branch 'master' into master
2 parents 6490137 + 62b835a commit c534a87

File tree

369 files changed

+32791
-7148
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

369 files changed

+32791
-7148
lines changed

.github/workflows/build.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
jobs:
1212
test:
13-
runs-on: ubuntu-16.04
13+
runs-on: ubuntu-18.04
1414
steps:
1515
- name: Dump GitHub context
1616
env:
@@ -94,15 +94,16 @@ jobs:
9494
path: mpy-cross/mpy-cross.static.exe
9595

9696
mpy-cross-mac:
97-
runs-on: macos-latest
97+
runs-on: macos-10.15
9898
steps:
9999
- name: Dump GitHub context
100100
env:
101101
GITHUB_CONTEXT: ${{ toJson(github) }}
102102
run: echo "$GITHUB_CONTEXT"
103-
- name: Install deps
103+
- name: Make gettext programs available
104104
run: |
105-
brew link --force gettext
105+
brew install gettext
106+
echo "::set-env name=PATH::/usr/local/opt/gettext/bin:$PATH"
106107
- name: Versions
107108
run: |
108109
gcc --version
@@ -126,7 +127,7 @@ jobs:
126127
path: mpy-cross/mpy-cross
127128

128129
build-arm:
129-
runs-on: ubuntu-16.04
130+
runs-on: ubuntu-18.04
130131
needs: test
131132
strategy:
132133
fail-fast: false
@@ -200,18 +201,22 @@ jobs:
200201
- "monster_m4sk"
201202
- "ndgarage_ndbit6"
202203
- "nfc_copy_cat"
204+
- "nucleo_f746zg"
203205
- "nucleo_f767zi"
204206
- "nucleo_h743zi_2"
205207
- "ohs2020_badge"
206208
- "openbook_m4"
209+
- "openmv_h7"
207210
- "particle_argon"
208211
- "particle_boron"
209212
- "particle_xenon"
210213
- "pca10056"
211214
- "pca10059"
215+
- "pca10100"
212216
- "pewpew10"
213217
- "pewpew_m4"
214218
- "pirkey_m0"
219+
- "pitaya_go"
215220
- "pyb_nano_v2"
216221
- "pybadge"
217222
- "pybadge_airlift"
@@ -227,6 +232,7 @@ jobs:
227232
- "seeeduino_xiao"
228233
- "serpente"
229234
- "shirtty"
235+
- "simmel"
230236
- "snekboard"
231237
- "sparkfun_lumidrive"
232238
- "sparkfun_nrf52840_mini"
@@ -241,8 +247,10 @@ jobs:
241247
- "stm32f411ve_discovery"
242248
- "stm32f412zg_discovery"
243249
- "stm32f4_discovery"
250+
- "stm32f746g_discovery"
244251
- "stringcar_m0_express"
245252
- "teensy40"
253+
- "teensy41"
246254
- "teknikio_bluebird"
247255
- "thunderpack"
248256
- "trellis_m4_express"
@@ -299,7 +307,7 @@ jobs:
299307
if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested'))
300308

301309
build-riscv:
302-
runs-on: ubuntu-16.04
310+
runs-on: ubuntu-18.04
303311
needs: test
304312
strategy:
305313
fail-fast: false
@@ -323,9 +331,14 @@ jobs:
323331
gcc --version
324332
riscv64-unknown-elf-gcc --version
325333
python3 --version
326-
- uses: actions/checkout@v1
334+
- uses: actions/checkout@v2
327335
with:
328336
submodules: true
337+
fetch-depth: 0
338+
- run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
339+
- run: git submodule sync
340+
- run: git submodule foreach git remote -v
341+
- run: git submodule foreach git fetch --recurse-submodules=no origin +refs/tags/*:refs/tags/*
329342
- name: mpy-cross
330343
run: make -C mpy-cross -j2
331344
- name: build

.gitmodules

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,21 @@
122122
[submodule "lib/protomatter"]
123123
path = lib/protomatter
124124
url = https://github.com/adafruit/Adafruit_Protomatter
125+
[submodule "frozen/Adafruit_CircuitPython_LSM6DS"]
126+
path = frozen/Adafruit_CircuitPython_LSM6DS
127+
url = https://github.com/adafruit/Adafruit_CircuitPython_LSM6DS
128+
[submodule "frozen/Adafruit_CircuitPython_FocalTouch"]
129+
path = frozen/Adafruit_CircuitPython_FocalTouch
130+
url = https://github.com/adafruit/Adafruit_CircuitPython_FocalTouch
131+
[submodule "frozen/Adafruit_CircuitPython_DS3231"]
132+
path = frozen/Adafruit_CircuitPython_DS3231
133+
url = https://github.com/adafruit/Adafruit_CircuitPython_DS3231
134+
[submodule "frozen/Adafruit_CircuitPython_DRV2605"]
135+
path = frozen/Adafruit_CircuitPython_DRV2605
136+
url = https://github.com/adafruit/Adafruit_CircuitPython_DRV2605
137+
[submodule "frozen/Adafruit_CircuitPython_BLE"]
138+
path = frozen/Adafruit_CircuitPython_BLE
139+
url = https://github.com/adafruit/Adafruit_CircuitPython_BLE
140+
[submodule "frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center"]
141+
path = frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center
142+
url = https://github.com/adafruit/Adafruit_CircuitPython_BLE_Apple_Notification_Center

docs/porting.rst

Lines changed: 40 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,44 @@ 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+
# 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
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+
# These modules are implemented in shared-module/ - they can be included in
71+
# 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
82+
4583
Step 2: Init
4684
--------------
4785
Once your build is setup, the next step should be to get your clocks going as

docs/shared_bindings_matrix.py

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

2828

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

3131

3232
def parse_port_config(contents, chip_keyword=None):
@@ -98,7 +98,7 @@ def build_module_map():
9898
for module in modules:
9999
full_name = module
100100
search_name = module.lstrip("_")
101-
re_pattern = "CIRCUITPY_{}\s=\s(.+)".format(search_name.upper())
101+
re_pattern = "CIRCUITPY_{}\s*\??=\s*(.+)".format(search_name.upper())
102102
find_config = re.findall(re_pattern, configs)
103103
if not find_config:
104104
continue
@@ -139,7 +139,10 @@ def get_excluded_boards(base):
139139
re_board_chip = re.compile("CHIP_FAMILY\s=\s(\w+)")
140140
chip_keyword = "CHIP_FAMILY"
141141
elif port in ["nrf"]:
142-
re_board_chip = re.compile("MCU_VARIANT\s=\s(\w+)")
142+
re_board_chip = re.compile(r"MCU_VARIANT\s=\s(\w+)")
143+
elif port in ["stm"]:
144+
re_board_chip = re.compile(r"MCU_SERIES\s*=\s*(\w+)")
145+
chip_keyword = "MCU_SERIES"
143146

144147
port_dir = "ports/{}".format(port)
145148

@@ -158,10 +161,10 @@ def get_excluded_boards(base):
158161
contents = board.read()
159162

160163
board_chip = re_board_chip.search(contents)
161-
#print(entry.name, board_chip.group(1))
162164
if not board_chip:
163165
board_chip = "Unknown Chip"
164166
else:
167+
#print(entry.name, board_chip.group(1))
165168
board_chip = board_chip.group(1)
166169

167170
# add port_config results to contents
@@ -172,18 +175,12 @@ def get_excluded_boards(base):
172175
check_dependent_modules = dict()
173176
for module in modules:
174177
board_is_excluded = False
175-
# check if board uses `SMALL_BUILD`. if yes, and current
178+
# check if board turns off `FULL_BUILD`. if yes, and current
176179
# module is marked as `FULL_BUILD`, board is excluded
177-
small_build = re.search("CIRCUITPY_SMALL_BUILD = 1", contents)
180+
small_build = re.search("CIRCUITPY_FULL_BUILD = 0", contents)
178181
if small_build and base[module]["full_build"] == "1":
179182
board_is_excluded = True
180183

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-
187184
# check if module is specifically disabled for this board
188185
re_pattern = r"CIRCUITPY_{}\s=\s(\w)".format(module.upper())
189186
find_module = re.search(re_pattern, contents)

docs/supported_ports.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
Supported Ports
22
==============================
33

4-
Adafruit's CircuitPython currently has limited support with a focus on supporting the Atmel SAMD
5-
and ESP8266.
4+
CircuitPython supports a number of microcontroller families. Support quality for each varies
5+
depending on the active contributors for each port.
6+
7+
Adafruit sponsored developers are actively contributing to atmel-samd, mimxrt10xx, nrf and stm
8+
ports. They also maintain the other ports in order to ensure the boards build. Additional testing
9+
is limited.
610

711
.. toctree::
812
:maxdepth: 2
913

1014
../ports/atmel-samd/README
15+
../ports/cxd56/README
16+
../ports/litex/README
1117
../ports/mimxrt10xx/README
1218
../ports/nrf/README
1319
../ports/stm/README
14-
../ports/cxd56/README

extmod/modujson.c

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ STATIC mp_obj_t mod_ujson_dumps(mp_obj_t obj) {
5353
}
5454
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_ujson_dumps_obj, mod_ujson_dumps);
5555

56+
#define JSON_DEBUG(...) (void)0
57+
// #define JSON_DEBUG(...) mp_printf(&mp_plat_print __VA_OPT__(,) __VA_ARGS__)
58+
59+
5660
// The function below implements a simple non-recursive JSON parser.
5761
//
5862
// The JSON specification is at http://www.ietf.org/rfc/rfc4627.txt
@@ -80,6 +84,7 @@ typedef struct _ujson_stream_t {
8084

8185
STATIC byte ujson_stream_next(ujson_stream_t *s) {
8286
mp_uint_t ret = s->read(s->stream_obj, &s->cur, 1, &s->errcode);
87+
JSON_DEBUG(" usjon_stream_next err:%2d cur: %c \n", s->errcode, s->cur);
8388
if (s->errcode != 0) {
8489
mp_raise_OSError(s->errcode);
8590
}
@@ -89,9 +94,10 @@ STATIC byte ujson_stream_next(ujson_stream_t *s) {
8994
return s->cur;
9095
}
9196

92-
STATIC mp_obj_t mod_ujson_load(mp_obj_t stream_obj) {
97+
STATIC mp_obj_t _mod_ujson_load(mp_obj_t stream_obj, bool return_first_json) {
9398
const mp_stream_p_t *stream_p = mp_get_stream_raise(stream_obj, MP_STREAM_OP_READ);
9499
ujson_stream_t s = {stream_obj, stream_p->read, 0, 0};
100+
JSON_DEBUG("got JSON stream\n");
95101
vstr_t vstr;
96102
vstr_init(&vstr, 8);
97103
mp_obj_list_t stack; // we use a list as a simple stack for nested JSON
@@ -262,13 +268,18 @@ STATIC mp_obj_t mod_ujson_load(mp_obj_t stream_obj) {
262268
}
263269
}
264270
success:
265-
// eat trailing whitespace
266-
while (unichar_isspace(S_CUR(s))) {
267-
S_NEXT(s);
268-
}
269-
if (!S_END(s)) {
270-
// unexpected chars
271-
goto fail;
271+
// It is legal for a stream to have contents after JSON.
272+
// E.g., A UART is not closed after receiving an object; in load() we will
273+
// return the first complete JSON object, while in loads() we will retain
274+
// strict adherence to the buffer's complete semantic.
275+
if (!return_first_json) {
276+
while (unichar_isspace(S_CUR(s))) {
277+
S_NEXT(s);
278+
}
279+
if (!S_END(s)) {
280+
// unexpected chars
281+
goto fail;
282+
}
272283
}
273284
if (stack_top == MP_OBJ_NULL || stack.len != 0) {
274285
// not exactly 1 object
@@ -280,14 +291,18 @@ STATIC mp_obj_t mod_ujson_load(mp_obj_t stream_obj) {
280291
fail:
281292
mp_raise_ValueError(translate("syntax error in JSON"));
282293
}
294+
295+
STATIC mp_obj_t mod_ujson_load(mp_obj_t stream_obj) {
296+
return _mod_ujson_load(stream_obj, true);
297+
}
283298
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_ujson_load_obj, mod_ujson_load);
284299

285300
STATIC mp_obj_t mod_ujson_loads(mp_obj_t obj) {
286301
size_t len;
287302
const char *buf = mp_obj_str_get_data(obj, &len);
288303
vstr_t vstr = {len, len, (char*)buf, true};
289304
mp_obj_stringio_t sio = {{&mp_type_stringio}, &vstr, 0, MP_OBJ_NULL};
290-
return mod_ujson_load(MP_OBJ_FROM_PTR(&sio));
305+
return _mod_ujson_load(MP_OBJ_FROM_PTR(&sio), false);
291306
}
292307
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_ujson_loads_obj, mod_ujson_loads);
293308

frozen/Adafruit_CircuitPython_BLE

0 commit comments

Comments
 (0)