Skip to content

Commit 23d6a3d

Browse files
committed
merge from upstream
2 parents 1caf6bd + 6759300 commit 23d6a3d

File tree

422 files changed

+19684
-3020
lines changed

Some content is hidden

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

422 files changed

+19684
-3020
lines changed

.github/workflows/build.yml

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ jobs:
2222
python-version: 3.5
2323
- name: Install deps
2424
run: |
25-
sudo apt-get install -y gettext librsvg2-bin
25+
sudo apt-get install -y eatmydata
26+
sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64
2627
pip install requests sh click setuptools cpp-coveralls Sphinx sphinx-rtd-theme recommonmark sphinxcontrib-svg2pdfconverter polib pyyaml
2728
- name: Versions
2829
run: |
@@ -66,20 +67,71 @@ jobs:
6667
run: python3 -u ci_new_boards_check.py
6768
working-directory: tools
6869

70+
- name: Build mpy-cross.static-raspbian
71+
run: make -C mpy-cross -j2 -f Makefile.static-raspbian
72+
- uses: actions/[email protected]
73+
with:
74+
name: mpy-cross.static-raspbian
75+
path: mpy-cross/mpy-cross.static-raspbian
76+
77+
- name: Build mpy-cross.static
78+
run: make -C mpy-cross -j2 -f Makefile.static
79+
- uses: actions/[email protected]
80+
with:
81+
name: mpy-cross.static-amd64-linux
82+
path: mpy-cross/mpy-cross.static
83+
84+
- name: Build mpy-cross.static-mingw
85+
run: make -C mpy-cross -j2 -f Makefile.static-mingw
86+
- uses: actions/[email protected]
87+
with:
88+
name: mpy-cross.static-x64-windows
89+
path: mpy-cross/mpy-cross.static.exe
90+
91+
mpy-cross-mac:
92+
runs-on: macos-latest
93+
steps:
94+
- name: Dump GitHub context
95+
env:
96+
GITHUB_CONTEXT: ${{ toJson(github) }}
97+
run: echo "$GITHUB_CONTEXT"
98+
- name: Install deps
99+
run: |
100+
brew link --force gettext
101+
- name: Versions
102+
run: |
103+
gcc --version
104+
python3 --version
105+
msgfmt --version
106+
- uses: actions/checkout@v1
107+
with:
108+
submodules: true
109+
- name: CircuitPython version
110+
run: git describe --dirty --always --tags
111+
- name: Build mpy-cross
112+
run: make -C mpy-cross -j2
113+
- uses: actions/[email protected]
114+
with:
115+
name: mpy-cross-macos-catalina
116+
path: mpy-cross/mpy-cross
117+
69118
build-arm:
70119
runs-on: ubuntu-16.04
71120
needs: test
72121
strategy:
73122
fail-fast: false
74123
matrix:
75124
board:
125+
- "aramcon_badge_2019"
76126
- "arduino_mkr1300"
77127
- "arduino_mkrzero"
78128
- "arduino_nano_33_ble"
79129
- "arduino_zero"
80130
- "bast_pro_mini_m0"
81131
- "capablerobot_usbhub"
82132
- "catwan_usbstick"
133+
- "circuitbrains_basic_m0"
134+
- "circuitbrains_deluxe_m4"
83135
- "circuitplayground_bluefruit"
84136
- "circuitplayground_express"
85137
- "circuitplayground_express_crickit"
@@ -94,6 +146,9 @@ jobs:
94146
- "electronut_labs_blip"
95147
- "electronut_labs_papyr"
96148
- "escornabot_makech"
149+
- "espruino_pico"
150+
- "espruino_wifi"
151+
- "feather_bluefruit_sense"
97152
- "feather_m0_adalogger"
98153
- "feather_m0_basic"
99154
- "feather_m0_express"
@@ -102,6 +157,7 @@ jobs:
102157
- "feather_m0_rfm9x"
103158
- "feather_m0_supersized"
104159
- "feather_m4_express"
160+
- "feather_m7_1011"
105161
- "feather_mimxrt1011"
106162
- "feather_mimxrt1062"
107163
- "feather_nrf52840_express"
@@ -112,19 +168,25 @@ jobs:
112168
- "hallowing_m0_express"
113169
- "hallowing_m4_express"
114170
- "imxrt1010_evk"
171+
- "imxrt1020_evk"
172+
- "imxrt1060_evk"
115173
- "itsybitsy_m0_express"
116174
- "itsybitsy_m4_express"
117175
- "itsybitsy_nrf52840_express"
118176
- "kicksat-sprite"
119177
- "makerdiary_nrf52840_mdk"
120178
- "makerdiary_nrf52840_mdk_usb_dongle"
179+
- "meowbit_v121"
121180
- "meowmeow"
122181
- "metro_m0_express"
123182
- "metro_m4_airlift_lite"
124183
- "metro_m4_express"
125184
- "metro_nrf52840_express"
126185
- "mini_sam_m4"
127186
- "monster_m4sk"
187+
- "ndgarage_ndbit6"
188+
- "ohs2020_badge"
189+
- "openbook_m4"
128190
- "particle_argon"
129191
- "particle_boron"
130192
- "particle_xenon"
@@ -137,13 +199,15 @@ jobs:
137199
- "pybadge"
138200
- "pybadge_airlift"
139201
- "pyboard_v11"
202+
- "pycubed"
140203
- "pygamer"
141204
- "pygamer_advance"
142205
- "pyportal"
143206
- "pyportal_titano"
144207
- "pyruler"
145208
- "robohatmm1_m4"
146209
- "sam32"
210+
- "seeeduino_xiao"
147211
- "serpente"
148212
- "shirtty"
149213
- "snekboard"
@@ -158,7 +222,9 @@ jobs:
158222
- "stm32f411ce_blackpill"
159223
- "stm32f411ve_discovery"
160224
- "stm32f412zg_discovery"
225+
- "stm32f4_discovery"
161226
- "stringcar_m0_express"
227+
- "teensy40"
162228
- "teknikio_bluebird"
163229
- "trellis_m4_express"
164230
- "trinket_m0"

.gitmodules

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,7 @@
110110
url = https://github.com/adafruit/Adafruit_MP3
111111
[submodule "ports/mimxrt10xx/sdk"]
112112
path = ports/mimxrt10xx/sdk
113-
url = https://github.com/arturo182/MIMXRT10xx_SDK
113+
url = https://github.com/adafruit/MIMXRT10xx_SDK
114+
[submodule "frozen/Adafruit_CircuitPython_Register"]
115+
path = frozen/Adafruit_CircuitPython_Register
116+
url = https://github.com/adafruit/Adafruit_CircuitPython_Register.git

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(BASEOPTS)
3636
# the i18n builder cannot share the environment and doctrees with the others
3737
I18NSPHINXOPTS = $(BASEOPTS)
3838

39-
TRANSLATE_SOURCES = extmod lib main.c ports/atmel-samd ports/nrf py shared-bindings shared-module supervisor
39+
TRANSLATE_SOURCES = extmod lib main.c ports/atmel-samd ports/cxd56 ports/mimxrt10xx ports/nrf ports/stm32f4 py shared-bindings shared-module supervisor
4040

4141
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext stubs
4242

README.rst

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,12 @@ Differences from `MicroPython <https://github.com/micropython/micropython>`__
9494

9595
CircuitPython:
9696

97-
- includes ports for MicroChip SAMD21 (Commonly known as M0 in Adafruit
98-
product names) and SAMD51 (M4).
99-
- supports only SAMD21, SAMD51, and nRF52840 ports.
100-
- tracks MicroPython's releases (not master).
101-
- floats (aka decimals) are enabled for all builds.
102-
- error messages are translated into 10+ languages.
103-
- does not support concurrency within Python (including interrupts and threading). Some concurrency
97+
- Supports native USB on all boards, allowing file editing without special tools.
98+
- Supports only SAMD21, SAMD51, nRF52840, CXD56, STM32F4 and i.MX RT ports.
99+
- Tracks MicroPython's releases (not master).
100+
- Floats (aka decimals) are enabled for all builds.
101+
- Error messages are translated into 10+ languages.
102+
- Does not support concurrency within Python (including interrupts and threading). Some concurrency
104103
is achieved with native modules for tasks that require it such as audio file playback.
105104

106105
Behavior

conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@
125125
"ports/cc3200",
126126
"ports/cc3200/FreeRTOS",
127127
"ports/cc3200/hal",
128+
"ports/cxd56/mkspk",
128129
"ports/cxd56/spresense-exported-sdk",
129130
"ports/esp32",
130131
"ports/esp8266/boards",

docs/shared_bindings_matrix.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def get_excluded_boards(base):
185185
board_is_excluded = True
186186

187187
# check if module is specifically disabled for this board
188-
re_pattern = "CIRCUITPY_{}\s=\s(\w)".format(module.upper())
188+
re_pattern = r"CIRCUITPY_{}\s=\s(\w)".format(module.upper())
189189
find_module = re.search(re_pattern, contents)
190190
if not find_module:
191191
if base[module]["default_value"].isdigit():
@@ -204,9 +204,7 @@ def get_excluded_boards(base):
204204
]):
205205
check_dependent_modules[module] = base[module]["default_value"]
206206
else:
207-
if (find_module.group(1) == "0" and
208-
find_module.group(1) != base[module]["default_value"]):
209-
board_is_excluded = True
207+
board_is_excluded = find_module.group(1) == "0"
210208

211209
if board_is_excluded:
212210
if board_chip in base[module]["excluded"]:

extmod/modframebuf.c

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <string.h>
2929

3030
#include "py/runtime.h"
31+
#include "py/objtype.h"
3132
#include "py/proto.h"
3233

3334
#if MICROPY_PY_FRAMEBUF
@@ -304,17 +305,26 @@ STATIC mp_obj_t framebuf_make_new(const mp_obj_type_t *type, size_t n_args, cons
304305
return MP_OBJ_FROM_PTR(o);
305306
}
306307

308+
STATIC const mp_obj_type_t mp_type_framebuf;
309+
310+
// Helper to ensure we have the native super class instead of a subclass.
311+
static mp_obj_framebuf_t* native_framebuf(mp_obj_t framebuf_obj) {
312+
mp_obj_t native_framebuf = mp_instance_cast_to_native_base(framebuf_obj, &mp_type_framebuf);
313+
mp_obj_assert_native_inited(native_framebuf);
314+
return MP_OBJ_TO_PTR(native_framebuf);
315+
}
316+
307317
STATIC mp_int_t framebuf_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_uint_t flags) {
308318
(void)flags;
309-
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(self_in);
319+
mp_obj_framebuf_t *self = native_framebuf(self_in);
310320
bufinfo->buf = self->buf;
311321
bufinfo->len = self->stride * self->height * (self->format == FRAMEBUF_RGB565 ? 2 : 1);
312322
bufinfo->typecode = 'B'; // view framebuf as bytes
313323
return 0;
314324
}
315325

316326
STATIC mp_obj_t framebuf_fill(mp_obj_t self_in, mp_obj_t col_in) {
317-
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(self_in);
327+
mp_obj_framebuf_t *self = native_framebuf(self_in);
318328
mp_int_t col = mp_obj_get_int(col_in);
319329
formats[self->format].fill_rect(self, 0, 0, self->width, self->height, col);
320330
return mp_const_none;
@@ -324,7 +334,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(framebuf_fill_obj, framebuf_fill);
324334
STATIC mp_obj_t framebuf_fill_rect(size_t n_args, const mp_obj_t *args) {
325335
(void)n_args;
326336

327-
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args[0]);
337+
mp_obj_framebuf_t *self = native_framebuf(args[0]);
328338
mp_int_t x = mp_obj_get_int(args[1]);
329339
mp_int_t y = mp_obj_get_int(args[2]);
330340
mp_int_t width = mp_obj_get_int(args[3]);
@@ -338,7 +348,7 @@ STATIC mp_obj_t framebuf_fill_rect(size_t n_args, const mp_obj_t *args) {
338348
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_fill_rect_obj, 6, 6, framebuf_fill_rect);
339349

340350
STATIC mp_obj_t framebuf_pixel(size_t n_args, const mp_obj_t *args) {
341-
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args[0]);
351+
mp_obj_framebuf_t *self = native_framebuf(args[0]);
342352
mp_int_t x = mp_obj_get_int(args[1]);
343353
mp_int_t y = mp_obj_get_int(args[2]);
344354
if (0 <= x && x < self->width && 0 <= y && y < self->height) {
@@ -357,7 +367,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_pixel_obj, 3, 4, framebuf_pi
357367
STATIC mp_obj_t framebuf_hline(size_t n_args, const mp_obj_t *args) {
358368
(void)n_args;
359369

360-
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args[0]);
370+
mp_obj_framebuf_t *self = native_framebuf(args[0]);
361371
mp_int_t x = mp_obj_get_int(args[1]);
362372
mp_int_t y = mp_obj_get_int(args[2]);
363373
mp_int_t w = mp_obj_get_int(args[3]);
@@ -372,7 +382,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_hline_obj, 5, 5, framebuf_hl
372382
STATIC mp_obj_t framebuf_vline(size_t n_args, const mp_obj_t *args) {
373383
(void)n_args;
374384

375-
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args[0]);
385+
mp_obj_framebuf_t *self = native_framebuf(args[0]);
376386
mp_int_t x = mp_obj_get_int(args[1]);
377387
mp_int_t y = mp_obj_get_int(args[2]);
378388
mp_int_t h = mp_obj_get_int(args[3]);
@@ -387,7 +397,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_vline_obj, 5, 5, framebuf_vl
387397
STATIC mp_obj_t framebuf_rect(size_t n_args, const mp_obj_t *args) {
388398
(void)n_args;
389399

390-
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args[0]);
400+
mp_obj_framebuf_t *self = native_framebuf(args[0]);
391401
mp_int_t x = mp_obj_get_int(args[1]);
392402
mp_int_t y = mp_obj_get_int(args[2]);
393403
mp_int_t w = mp_obj_get_int(args[3]);
@@ -406,7 +416,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_rect_obj, 6, 6, framebuf_rec
406416
STATIC mp_obj_t framebuf_line(size_t n_args, const mp_obj_t *args) {
407417
(void)n_args;
408418

409-
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args[0]);
419+
mp_obj_framebuf_t *self = native_framebuf(args[0]);
410420
mp_int_t x1 = mp_obj_get_int(args[1]);
411421
mp_int_t y1 = mp_obj_get_int(args[2]);
412422
mp_int_t x2 = mp_obj_get_int(args[3]);
@@ -470,8 +480,8 @@ STATIC mp_obj_t framebuf_line(size_t n_args, const mp_obj_t *args) {
470480
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_line_obj, 6, 6, framebuf_line);
471481

472482
STATIC mp_obj_t framebuf_blit(size_t n_args, const mp_obj_t *args) {
473-
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args[0]);
474-
mp_obj_framebuf_t *source = MP_OBJ_TO_PTR(args[1]);
483+
mp_obj_framebuf_t *self = native_framebuf(args[0]);
484+
mp_obj_framebuf_t *source = native_framebuf(args[1]);
475485
mp_int_t x = mp_obj_get_int(args[2]);
476486
mp_int_t y = mp_obj_get_int(args[3]);
477487
mp_int_t key = -1;
@@ -513,7 +523,7 @@ STATIC mp_obj_t framebuf_blit(size_t n_args, const mp_obj_t *args) {
513523
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_blit_obj, 4, 5, framebuf_blit);
514524

515525
STATIC mp_obj_t framebuf_scroll(mp_obj_t self_in, mp_obj_t xstep_in, mp_obj_t ystep_in) {
516-
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(self_in);
526+
mp_obj_framebuf_t *self = native_framebuf(self_in);
517527
mp_int_t xstep = mp_obj_get_int(xstep_in);
518528
mp_int_t ystep = mp_obj_get_int(ystep_in);
519529
int sx, y, xend, yend, dx, dy;
@@ -546,7 +556,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(framebuf_scroll_obj, framebuf_scroll);
546556

547557
STATIC mp_obj_t framebuf_text(size_t n_args, const mp_obj_t *args) {
548558
// extract arguments
549-
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args[0]);
559+
mp_obj_framebuf_t *self = native_framebuf(args[0]);
550560
const char *str = mp_obj_str_get_str(args[1]);
551561
mp_int_t x0 = mp_obj_get_int(args[2]);
552562
mp_int_t y0 = mp_obj_get_int(args[3]);

extmod/vfs_fat.c

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -345,24 +345,31 @@ STATIC mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) {
345345
} else {
346346
mode |= MP_S_IFREG;
347347
}
348-
mp_uint_t seconds = timeutils_seconds_since_epoch(
349-
1980 + ((fno.fdate >> 9) & 0x7f),
350-
(fno.fdate >> 5) & 0x0f,
351-
fno.fdate & 0x1f,
352-
(fno.ftime >> 11) & 0x1f,
353-
(fno.ftime >> 5) & 0x3f,
354-
2 * (fno.ftime & 0x1f)
355-
);
348+
#if MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_NONE
349+
// On non-longint builds, the number of seconds since 1970 (epoch) is too
350+
// large to fit in a smallint, so just return 31-DEC-1999 (0).
351+
mp_obj_t seconds = MP_OBJ_NEW_SMALL_INT(946684800);
352+
#else
353+
mp_obj_t seconds = mp_obj_new_int_from_uint(
354+
timeutils_seconds_since_epoch(
355+
1980 + ((fno.fdate >> 9) & 0x7f),
356+
(fno.fdate >> 5) & 0x0f,
357+
fno.fdate & 0x1f,
358+
(fno.ftime >> 11) & 0x1f,
359+
(fno.ftime >> 5) & 0x3f,
360+
2 * (fno.ftime & 0x1f)
361+
));
362+
#endif
356363
t->items[0] = MP_OBJ_NEW_SMALL_INT(mode); // st_mode
357364
t->items[1] = MP_OBJ_NEW_SMALL_INT(0); // st_ino
358365
t->items[2] = MP_OBJ_NEW_SMALL_INT(0); // st_dev
359366
t->items[3] = MP_OBJ_NEW_SMALL_INT(0); // st_nlink
360367
t->items[4] = MP_OBJ_NEW_SMALL_INT(0); // st_uid
361368
t->items[5] = MP_OBJ_NEW_SMALL_INT(0); // st_gid
362369
t->items[6] = mp_obj_new_int_from_uint(fno.fsize); // st_size
363-
t->items[7] = mp_obj_new_int_from_uint(seconds); // st_atime
364-
t->items[8] = mp_obj_new_int_from_uint(seconds); // st_mtime
365-
t->items[9] = mp_obj_new_int_from_uint(seconds); // st_ctime
370+
t->items[7] = seconds; // st_atime
371+
t->items[8] = seconds; // st_mtime
372+
t->items[9] = seconds; // st_ctime
366373

367374
return MP_OBJ_FROM_PTR(t);
368375
}

extmod/vfs_fat_file.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#if MICROPY_VFS && MICROPY_VFS_FAT
2929

3030
#include <stdio.h>
31+
#include <string.h>
3132

3233
#include "py/runtime.h"
3334
#include "py/stream.h"
@@ -199,7 +200,7 @@ STATIC mp_obj_t file_open(fs_user_mount_t *vfs, const mp_obj_type_t *type, mp_ar
199200
FRESULT res = f_open(&vfs->fatfs, &o->fp, fname, mode);
200201
if (res != FR_OK) {
201202
m_del_obj(pyb_file_obj_t, o);
202-
mp_raise_OSError(fresult_to_errno_table[res]);
203+
mp_raise_OSError_errno_str(fresult_to_errno_table[res], args[0].u_obj);
203204
}
204205
// If we're reading, turn on fast seek.
205206
if (mode == FA_READ) {

0 commit comments

Comments
 (0)