summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2019-06-11 18:01:04 -0400
committerDan Halbert <halbert@halwitz.org>2019-06-11 18:01:04 -0400
commitaa3316b619c8a8bcddd889fa0b806e5798973137 (patch)
tree1775e6ec52138cb18f89455026887c785ffa7dac
parentea760c042bcdff61792a4b5f3de0b3ec212c44c4 (diff)
parent541c2a70acab02c419f1ddd4a0ffc38c23a054a0 (diff)
Merge remote-tracking branch 'adafruit/master' into vm-computed-goto
-rwxr-xr-x.travis.yml2
-rw-r--r--Makefile6
-rwxr-xr-xmain.c5
-rw-r--r--ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk1
-rw-r--r--ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk3
-rw-r--r--ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk1
-rw-r--r--ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.mk1
-rw-r--r--ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk1
-rw-r--r--ports/atmel-samd/boards/pewpew10/mpconfigboard.mk1
-rwxr-xr-xports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk1
-rw-r--r--ports/nrf/README.md1
-rw-r--r--ports/nrf/background.c4
-rw-r--r--ports/nrf/boards/electronut_labs_blip/README.md67
-rw-r--r--ports/nrf/boards/electronut_labs_blip/board.c38
-rw-r--r--ports/nrf/boards/electronut_labs_blip/mpconfigboard.h53
-rw-r--r--ports/nrf/boards/electronut_labs_blip/mpconfigboard.mk22
-rw-r--r--ports/nrf/boards/electronut_labs_blip/pins.c72
-rw-r--r--ports/nrf/supervisor/port.c10
-rw-r--r--py/circuitpy_defns.mk5
-rwxr-xr-xpy/gc.c4
-rw-r--r--py/gc.h1
-rw-r--r--shared-bindings/board/__init__.c1
-rw-r--r--shared-bindings/pulseio/__init__.c4
-rw-r--r--shared-module/board/__init__.c2
-rw-r--r--shared-module/displayio/__init__.c16
-rw-r--r--shared-module/displayio/__init__.h1
-rwxr-xr-xtools/build_release_files.py37
-rwxr-xr-xtools/git-checkout-latest-tag.sh3
28 files changed, 342 insertions, 21 deletions
diff --git a/.travis.yml b/.travis.yml
index a9e0bc3cc..1702089c3 100755
--- a/.travis.yml
+++ b/.travis.yml
@@ -21,7 +21,7 @@ git:
# that SDK is shortest and add it there. In the case of major re-organizations,
# just try to make the builds "about equal in run time"
env:
- - TRAVIS_TESTS="unix docs translations website" TRAVIS_BOARDS="circuitplayground_express mini_sam_m4 grandcentral_m4_express capablerobot_usbhub pygamer pca10056 pca10059 feather_nrf52840_express makerdiary_nrf52840_mdk makerdiary_nrf52840_mdk_usb_dongle particle_boron particle_argon particle_xenon sparkfun_nrf52840_mini electronut_labs_papyr" TRAVIS_SDK=arm:nrf
+ - TRAVIS_TESTS="unix docs translations website" TRAVIS_BOARDS="circuitplayground_express mini_sam_m4 grandcentral_m4_express capablerobot_usbhub pygamer pca10056 pca10059 feather_nrf52840_express makerdiary_nrf52840_mdk makerdiary_nrf52840_mdk_usb_dongle particle_boron particle_argon particle_xenon sparkfun_nrf52840_mini electronut_labs_papyr electronut_labs_blip" TRAVIS_SDK=arm:nrf
- TRAVIS_BOARDS="metro_m0_express metro_m4_express metro_m4_airlift_lite pirkey_m0 trellis_m4_express trinket_m0 sparkfun_lumidrive sparkfun_redboard_turbo bast_pro_mini_m0" TRAVIS_SDK=arm
- TRAVIS_BOARDS="feather_radiofruit_zigbee gemma_m0 hallowing_m0_express itsybitsy_m0_express itsybitsy_m4_express meowmeow sam32 uchip escornabot_makech" TRAVIS_SDK=arm
- TRAVIS_BOARDS="feather_m0_express_crickit feather_m0_rfm69 feather_m0_rfm9x feather_m4_express arduino_zero arduino_mkr1300 arduino_mkrzero pewpew10 kicksat-sprite ugame10 robohatmm1" TRAVIS_SDK=arm
diff --git a/Makefile b/Makefile
index 09fbf9c1a..8a4cf609f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# Makefile for Sphinx documentation
+# Top-level Makefile for documentation builds and miscellaneous tasks.
#
# You can set these variables from the command line.
@@ -215,3 +215,7 @@ check-translate: locale/circuitpython.pot $(wildcard locale/*.po)
stubs:
rst2pyi $(VALIDATE) shared-bindings/ $(STUBDIR)
python setup.py sdist
+
+update-frozen-libraries:
+ @echo "Updating all frozen libraries to latest tagged version."
+ cd frozen; for library in *; do cd $$library; ../../tools/git-checkout-latest-tag.sh; cd ..; done
diff --git a/main.c b/main.c
index 107b5b3c2..6d7502ba4 100755
--- a/main.c
+++ b/main.c
@@ -455,6 +455,11 @@ void gc_collect(void) {
// This collects root pointers from the VFS mount table. Some of them may
// have lost their references in the VM even though they are mounted.
gc_collect_root((void**)&MP_STATE_VM(vfs_mount_table), sizeof(mp_vfs_mount_t) / sizeof(mp_uint_t));
+
+ #if CIRCUITPY_DISPLAYIO
+ displayio_gc_collect();
+ #endif
+
// This naively collects all object references from an approximate stack
// range.
gc_collect_root((void**)sp, ((uint32_t)&_estack - sp) / sizeof(uint32_t));
diff --git a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk
index bc33be315..3b9eba7be 100644
--- a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk
@@ -28,6 +28,7 @@ FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Thermistor
# Tweak inlining depending on language.
ifeq ($(TRANSLATION), zh_Latn_pinyin)
CFLAGS_INLINE_LIMIT = 25
+RELEASE_NEEDS_CLEAN_BUILD = 1
else
CFLAGS_INLINE_LIMIT = 55
endif
diff --git a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk
index bdcb4d350..0a8ac37b8 100644
--- a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk
@@ -20,7 +20,8 @@ CHIP_FAMILY = samd21
# Tweak inlining depending on language.
ifeq ($(TRANSLATION), zh_Latn_pinyin)
-CFLAGS_INLINE_LIMIT = 35
+CFLAGS_INLINE_LIMIT = 23
+RELEASE_NEEDS_CLEAN_BUILD = 1
else
CFLAGS_INLINE_LIMIT = 55
endif
diff --git a/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk
index a6190267d..64d81c64c 100644
--- a/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk
@@ -15,4 +15,5 @@ CHIP_FAMILY = samd21
# Tweak inlining depending on language.
ifeq ($(TRANSLATION), zh_Latn_pinyin)
CFLAGS_INLINE_LIMIT = 60
+RELEASE_NEEDS_CLEAN_BUILD = 1
endif
diff --git a/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.mk
index 4f3e1ca66..1b2a039b8 100644
--- a/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.mk
@@ -15,6 +15,7 @@ CHIP_FAMILY = samd21
# Tweak inlining depending on language.
ifeq ($(TRANSLATION), zh_Latn_pinyin)
CFLAGS_INLINE_LIMIT = 45
+RELEASE_NEEDS_CLEAN_BUILD = 1
else
CFLAGS_INLINE_LIMIT = 70
endif
diff --git a/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk
index ce9c4baba..ff5284aab 100644
--- a/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk
@@ -16,4 +16,5 @@ CHIP_FAMILY = samd21
# Tweak inlining depending on language.
ifeq ($(TRANSLATION), zh_Latn_pinyin)
CFLAGS_INLINE_LIMIT = 50
+RELEASE_NEEDS_CLEAN_BUILD = 1
endif
diff --git a/ports/atmel-samd/boards/pewpew10/mpconfigboard.mk b/ports/atmel-samd/boards/pewpew10/mpconfigboard.mk
index b36a21368..ef0f8faa7 100644
--- a/ports/atmel-samd/boards/pewpew10/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/pewpew10/mpconfigboard.mk
@@ -25,4 +25,5 @@ CIRCUITPY_SMALL_BUILD = 1
# Tweak inlining depending on language.
ifeq ($(TRANSLATION), zh_Latn_pinyin)
CFLAGS_INLINE_LIMIT = 40
+RELEASE_NEEDS_CLEAN_BUILD = 1
endif
diff --git a/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk b/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk
index 9e45f8ad9..57400d6a7 100755
--- a/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk
@@ -16,4 +16,5 @@ EXTERNAL_FLASH_DEVICES = "W25Q32FV"
# Tweak inlining depending on language.
ifeq ($(TRANSLATION), zh_Latn_pinyin)
CFLAGS_INLINE_LIMIT = 50
+RELEASE_NEEDS_CLEAN_BUILD = 1
endif
diff --git a/ports/nrf/README.md b/ports/nrf/README.md
index 65a66b7b0..5f6d03720 100644
--- a/ports/nrf/README.md
+++ b/ports/nrf/README.md
@@ -79,6 +79,7 @@ feather_nrf52840_express | s140 | Peripheral and Scanner | UF
makerdiary_nrf52840_mdk | s140 | Peripheral and Scanner | pyocd or ARM mbed DAPLink
makerdiary_nrf52840_mdk_usb_dongle | s140 | Peripheral and Scanner | DFU bootloader & nrfutil
electronut_labs_papyr | s140 | Peripheral and Scanner | UF2 bootloader
+electronut_labs_blip | s140 | Peripheral and Scanner | Black Magic Probe
## Segger Targets
diff --git a/ports/nrf/background.c b/ports/nrf/background.c
index 3fb5febd3..9c4f3ab27 100644
--- a/ports/nrf/background.c
+++ b/ports/nrf/background.c
@@ -29,7 +29,7 @@
#include "supervisor/usb.h"
#include "supervisor/shared/stack.h"
-#ifdef CIRCUITPY_DISPLAYIO
+#if CIRCUITPY_DISPLAYIO
#include "shared-module/displayio/__init__.h"
#endif
@@ -48,7 +48,7 @@ void run_background_tasks(void) {
filesystem_background();
usb_background();
- #ifdef CIRCUITPY_DISPLAYIO
+ #if CIRCUITPY_DISPLAYIO
displayio_refresh_displays();
#endif
running_background_tasks = false;
diff --git a/ports/nrf/boards/electronut_labs_blip/README.md b/ports/nrf/boards/electronut_labs_blip/README.md
new file mode 100644
index 000000000..c34ef16f8
--- /dev/null
+++ b/ports/nrf/boards/electronut_labs_blip/README.md
@@ -0,0 +1,67 @@
+# Setup
+
+The `Electronut Labs Blip` board is a development board based on the `nRF52840` SoC from
+Nordic Semiconductors. It has a Black Magic Probe compatible programmer and debugger
+built in, along with temperature/humidity sensor, ambient light intensity sensor, and
+a 3-axis accelerometer. It can be used to prototype very low power devices. It also has
+provision for an SD card slot, which makes it a complete and versatile development board.
+
+Schematic, datasheet, pin mapping etc. can be found over [here](https://docs.electronut.in/blip/).
+
+Features:
+
+* Raytac MDBT50Q-1M module based on Nordic Semiconductor's nRF52840
+* LIS2DDH12 High-performance 3-axis "femto" accelerometer
+* Optical Sensor LTR-329ALS-01
+* Si7006-A20 I2C humidity and temperature sensor
+* On board STM32F103CBT6 as Black magic probe debugger
+* NFC Antenna
+* MicroSD slot
+* Power Supply: USB, JST connector for Li-ion/Li-po
+* BQ24079 battery charging and power management IC
+
+## Installing CircuitPython submodules
+
+Before you can build, you will need to run the following commands once, which
+will install the submodules that are part of the CircuitPython ecosystem, and
+build the `mpy-cross` tool:
+
+```
+$ cd circuitpython
+$ git submodule update --init
+$ make -C mpy-cross
+```
+
+## Building and Flashing CircuitPython
+
+No special notes for this, follow `ports/nrf` generic `README.md`.
+
+### Flashing CircuitPython with GDB using on board Black magic probe debugger
+
+```
+$ cd ports/nrf
+$ make V=1 SD=s140 SERIAL=/dev/ttyACM0 BOARD=electronut_labs_blip all
+...
+...
+LINK build-electronut_labs_blip-s140/firmware.elf
+
+778588 bytes free in flash out of 1048576 bytes ( 1024.0 kb ).
+228320 bytes free in ram for stack out of 245760 bytes ( 240.0 kb ).
+
+Create build-electronut_labs_blip-s140/firmware.bin
+Create build-electronut_labs_blip-s140/firmware.hex
+Create build-electronut_labs_blip-s140/firmware.uf2
+python3 ../../tools/uf2/utils/uf2conv.py -f 0xADA52840 -c -o "build-electronut_labs_blip-s140/firmware.uf2" build-electronut_labs_blip-s140/firmware.hex
+Converting to uf2, output size: 540160, start address: 0x26000
+Wrote 540160 bytes to build-electronut_labs_blip-s140/firmware.uf2.
+```
+
+Now you can use either `.hex` or `.elf` from the generated files inside
+`build-electronut_labs_blip-s140` directory. Now you can use `arm-none-eabi-gdb`
+to flash circuitpython on Blip.
+
+### Other tips
+
+Once circuitpython is running on your board, it will come up as a mass storage
+device named `CIRCUITPY`, where you can drop in your python code. The file names
+it looks for are `main.py`, `main.txt`, `code.py` or `code.txt`.
diff --git a/ports/nrf/boards/electronut_labs_blip/board.c b/ports/nrf/boards/electronut_labs_blip/board.c
new file mode 100644
index 000000000..4421970ee
--- /dev/null
+++ b/ports/nrf/boards/electronut_labs_blip/board.c
@@ -0,0 +1,38 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Scott Shawcroft 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.
+ */
+
+#include "boards/board.h"
+
+void board_init(void) {
+}
+
+bool board_requests_safe_mode(void) {
+ return false;
+}
+
+void reset_board(void) {
+
+}
diff --git a/ports/nrf/boards/electronut_labs_blip/mpconfigboard.h b/ports/nrf/boards/electronut_labs_blip/mpconfigboard.h
new file mode 100644
index 000000000..21e8c3ef6
--- /dev/null
+++ b/ports/nrf/boards/electronut_labs_blip/mpconfigboard.h
@@ -0,0 +1,53 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016 Glenn Ruben Bakke
+ * Copyright (c) 2018 Dan Halbert for Adafruit Industries
+ * Copyright (c) 2019 tavish@electronut.in
+ *
+ * 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.
+ */
+
+#include "nrfx/hal/nrf_gpio.h"
+
+#define ELECTRONUT_LABS_PAPYR
+
+#define MICROPY_HW_BOARD_NAME "Electronut Labs Blip"
+#define MICROPY_HW_MCU_NAME "nRF52840"
+#define MICROPY_PY_SYS_PLATFORM "ElectronutLabsPapyr"
+
+#define CIRCUITPY_AUTORELOAD_DELAY_MS 500
+
+// TODO #define CIRCUITPY_INTERNAL_NVM_SIZE 8192
+
+#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE)
+
+#define BOARD_HAS_CRYSTAL 1
+
+#define DEFAULT_I2C_BUS_SCL (&pin_P0_11)
+#define DEFAULT_I2C_BUS_SDA (&pin_P0_12)
+
+#define DEFAULT_SPI_BUS_SCK (&pin_P0_25)
+#define DEFAULT_SPI_BUS_MOSI (&pin_P1_02)
+#define DEFAULT_SPI_BUS_MISO (&pin_P0_24)
+
+#define DEFAULT_UART_BUS_RX (&pin_P0_08)
+#define DEFAULT_UART_BUS_TX (&pin_P0_06)
diff --git a/ports/nrf/boards/electronut_labs_blip/mpconfigboard.mk b/ports/nrf/boards/electronut_labs_blip/mpconfigboard.mk
new file mode 100644
index 000000000..bf82400d1
--- /dev/null
+++ b/ports/nrf/boards/electronut_labs_blip/mpconfigboard.mk
@@ -0,0 +1,22 @@
+USB_VID = 0x239A
+USB_PID = 0x803C
+USB_PRODUCT = "Blip"
+USB_MANUFACTURER = "Electronut Labs"
+
+MCU_SERIES = m4
+MCU_VARIANT = nrf52
+MCU_SUB_VARIANT = nrf52840
+MCU_CHIP = nrf52840
+SD ?= s140
+SOFTDEV_VERSION ?= 6.1.0
+
+BOOT_SETTING_ADDR = 0xFF000
+
+ifeq ($(SD),)
+ LD_FILE = boards/nrf52840_1M_256k.ld
+else
+ LD_FILE = boards/adafruit_$(MCU_SUB_VARIANT)_$(SD_LOWER)_v$(firstword $(subst ., ,$(SOFTDEV_VERSION))).ld
+ CIRCUITPY_BLEIO = 1
+endif
+
+NRF_DEFINES += -DNRF52840_XXAA -DNRF52840 \ No newline at end of file
diff --git a/ports/nrf/boards/electronut_labs_blip/pins.c b/ports/nrf/boards/electronut_labs_blip/pins.c
new file mode 100644
index 000000000..a8f9af1cd
--- /dev/null
+++ b/ports/nrf/boards/electronut_labs_blip/pins.c
@@ -0,0 +1,72 @@
+#include "shared-bindings/board/__init__.h"
+
+STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_03) },
+ { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_04) },
+ { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_P0_28) },
+ { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_P0_29) },
+ { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_P0_30) },
+ { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_P0_31) },
+
+ { MP_ROM_QSTR(MP_QSTR_NFC1), MP_ROM_PTR(&pin_P0_09) },
+ { MP_ROM_QSTR(MP_QSTR_NFC2), MP_ROM_PTR(&pin_P0_10) },
+
+ // odd row
+ { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_P0_02) },
+ { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_P0_04) },
+ { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_P0_06) },
+ { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_P0_08) },
+ { MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_P0_19) },
+ { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_P0_21) },
+ { MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_P0_26) },
+ { MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_P0_27) },
+ { MP_ROM_QSTR(MP_QSTR_D29), MP_ROM_PTR(&pin_P0_29) },
+ { MP_ROM_QSTR(MP_QSTR_D31), MP_ROM_PTR(&pin_P0_31) },
+ { MP_ROM_QSTR(MP_QSTR_D33), MP_ROM_PTR(&pin_P1_01) },
+ { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_P1_04) },
+ { MP_ROM_QSTR(MP_QSTR_D38), MP_ROM_PTR(&pin_P1_06) },
+
+ // even row
+ { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_P0_03) },
+ { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_P0_05) },
+ { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_P0_07) },
+ { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_P0_16) },
+ { MP_ROM_QSTR(MP_QSTR_D20), MP_ROM_PTR(&pin_P0_20) },
+ { MP_ROM_QSTR(MP_QSTR_D22), MP_ROM_PTR(&pin_P0_22) },
+ { MP_ROM_QSTR(MP_QSTR_D23), MP_ROM_PTR(&pin_P0_23) },
+ { MP_ROM_QSTR(MP_QSTR_D28), MP_ROM_PTR(&pin_P0_28) },
+ { MP_ROM_QSTR(MP_QSTR_D30), MP_ROM_PTR(&pin_P0_30) },
+ { MP_ROM_QSTR(MP_QSTR_D32), MP_ROM_PTR(&pin_P1_00) },
+ { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_P1_03) },
+ { MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_P1_05) },
+ { MP_ROM_QSTR(MP_QSTR_D40), MP_ROM_PTR(&pin_P1_08) },
+
+ // SCL SDA as pins also
+ { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_P0_11) },
+ { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_P0_12) },
+ { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_11) },
+ { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_12) },
+
+ { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_25) },
+ { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_24) },
+ { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P1_02) },
+ { MP_ROM_QSTR(MP_QSTR_CS), MP_ROM_PTR(&pin_P0_17) },
+
+ { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P0_06) },
+ { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P0_08) },
+
+ { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_P0_14) },
+ { MP_ROM_QSTR(MP_QSTR_RED_LED), MP_ROM_PTR(&pin_P0_14) },
+
+ { MP_ROM_QSTR(MP_QSTR_BLUE_LED), MP_ROM_PTR(&pin_P0_15) },
+ { MP_ROM_QSTR(MP_QSTR_GREEN_LED), MP_ROM_PTR(&pin_P0_13) },
+
+ { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_P1_07) },
+ { MP_ROM_QSTR(MP_QSTR_RESET), MP_ROM_PTR(&pin_P0_18) },
+
+ { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
+ { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
+ { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
+};
+
+MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
diff --git a/ports/nrf/supervisor/port.c b/ports/nrf/supervisor/port.c
index 85ecd6afe..8fbf75498 100644
--- a/ports/nrf/supervisor/port.c
+++ b/ports/nrf/supervisor/port.c
@@ -93,16 +93,22 @@ void reset_port(void) {
i2c_reset();
spi_reset();
uart_reset();
+
+#if CIRCUITPY_PULSEIO
pwmout_reset();
pulseout_reset();
pulsein_reset();
+#endif
+
timers_reset();
- #if CIRCUITPY_RTC
+#if CIRCUITPY_RTC
rtc_reset();
- #endif
+#endif
+#if CIRCUITPY_BLEIO
bleio_reset();
+#endif
reset_all_pins();
}
diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk
index 722f06e93..28d90dfea 100644
--- a/py/circuitpy_defns.mk
+++ b/py/circuitpy_defns.mk
@@ -366,3 +366,8 @@ $(addprefix lib/,\
libm/atan2f.c \
)
endif
+
+.PHONY: check-release-needs-clean-build
+
+check-release-needs-clean-build:
+ @echo "RELEASE_NEEDS_CLEAN_BUILD = $(RELEASE_NEEDS_CLEAN_BUILD)"
diff --git a/py/gc.c b/py/gc.c
index e9b85fa7c..10b36950c 100755
--- a/py/gc.c
+++ b/py/gc.c
@@ -383,6 +383,10 @@ void gc_collect_start(void) {
#endif
}
+void gc_collect_ptr(void *ptr) {
+ gc_mark(ptr);
+}
+
void gc_collect_root(void **ptrs, size_t len) {
for (size_t i = 0; i < len; i++) {
void *ptr = ptrs[i];
diff --git a/py/gc.h b/py/gc.h
index 757a2a6e0..02bf45158 100644
--- a/py/gc.h
+++ b/py/gc.h
@@ -43,6 +43,7 @@ bool gc_is_locked(void);
// A given port must implement gc_collect by using the other collect functions.
void gc_collect(void);
void gc_collect_start(void);
+void gc_collect_ptr(void *ptr);
void gc_collect_root(void **ptrs, size_t len);
void gc_collect_end(void);
diff --git a/shared-bindings/board/__init__.c b/shared-bindings/board/__init__.c
index b4cc8cb12..47e2d64bc 100644
--- a/shared-bindings/board/__init__.c
+++ b/shared-bindings/board/__init__.c
@@ -34,7 +34,6 @@
//|
//| .. module:: board
//| :synopsis: Board specific pin names
-//| :platform: SAMD21
//|
//| Common container for board base pin names. These will vary from board to
//| board so don't expect portability when using this module.
diff --git a/shared-bindings/pulseio/__init__.c b/shared-bindings/pulseio/__init__.c
index 1114b604b..a3cec3dca 100644
--- a/shared-bindings/pulseio/__init__.c
+++ b/shared-bindings/pulseio/__init__.c
@@ -54,10 +54,6 @@
//| PWMOut
//|
-//| .. warning:: This module is not available in some SAMD21 builds. See the
-//| :ref:`module-support-matrix` for more info.
-//|
-
//| All classes change hardware state and should be deinitialized when they
//| are no longer needed if the program continues after use. To do so, either
//| call :py:meth:`!deinit` or use a context manager. See
diff --git a/shared-module/board/__init__.c b/shared-module/board/__init__.c
index ac4de2fe5..be8502bc0 100644
--- a/shared-module/board/__init__.c
+++ b/shared-module/board/__init__.c
@@ -103,7 +103,7 @@ void reset_board_busses(void) {
#endif
#if BOARD_SPI
bool display_using_spi = false;
- #ifdef CIRCUITPY_DISPLAYIO
+ #if CIRCUITPY_DISPLAYIO
for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) {
if (displays[i].fourwire_bus.bus == spi_singleton) {
display_using_spi = true;
diff --git a/shared-module/displayio/__init__.c b/shared-module/displayio/__init__.c
index 0f2e727dc..35bdad8fe 100644
--- a/shared-module/displayio/__init__.c
+++ b/shared-module/displayio/__init__.c
@@ -3,6 +3,7 @@
#include "shared-module/displayio/__init__.h"
#include "lib/utils/interrupt_char.h"
+#include "py/gc.h"
#include "py/reload.h"
#include "py/runtime.h"
#include "shared-bindings/board/__init__.h"
@@ -192,7 +193,6 @@ void common_hal_displayio_release_displays(void) {
}
void reset_displays(void) {
- #if CIRCUITPY_DISPLAYIO
// The SPI buses used by FourWires may be allocated on the heap so we need to move them inline.
for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) {
if (displays[i].fourwire_bus.base.type != &displayio_fourwire_type) {
@@ -229,7 +229,19 @@ void reset_displays(void) {
display->auto_brightness = true;
common_hal_displayio_display_show(display, &circuitpython_splash);
}
- #endif
+}
+
+void displayio_gc_collect(void) {
+ for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) {
+ if (displays[i].display.base.type == NULL) {
+ continue;
+ }
+
+ // Alternatively, we could use gc_collect_root over the whole object,
+ // but this is more precise, and is the only field that needs marking.
+ gc_collect_ptr(displays[i].display.current_group);
+
+ }
}
void displayio_area_shift(displayio_area_t* area, int16_t dx, int16_t dy) {
diff --git a/shared-module/displayio/__init__.h b/shared-module/displayio/__init__.h
index 7ffc8eab2..18c1a4f4a 100644
--- a/shared-module/displayio/__init__.h
+++ b/shared-module/displayio/__init__.h
@@ -46,5 +46,6 @@ extern displayio_group_t circuitpython_splash;
void displayio_refresh_displays(void);
void reset_displays(void);
+void displayio_gc_collect(void);
#endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO___INIT___H
diff --git a/tools/build_release_files.py b/tools/build_release_files.py
index 872302a4f..e29b098c7 100755
--- a/tools/build_release_files.py
+++ b/tools/build_release_files.py
@@ -1,3 +1,5 @@
+#! /usr/bin/env python3
+
import os
import sys
import subprocess
@@ -6,7 +8,7 @@ import build_board_info as build_info
import time
for port in build_info.SUPPORTED_PORTS:
- result = subprocess.run("rm -rf ../ports/{}/build*".format(port), shell=True)
+ result = subprocess.run("rm -rf ../ports/{port}/build*".format(port=port), shell=True)
ROSIE_SETUPS = ["rosie-ci"]
rosie_ok = {}
@@ -37,7 +39,25 @@ for board in build_boards:
bin_directory = "../bin/{board}/{language}".format(board=board, language=language)
os.makedirs(bin_directory, exist_ok=True)
start_time = time.monotonic()
- make_result = subprocess.run("make -C ../ports/" + board_info["port"] + " TRANSLATION=" + language + " BOARD=" + board, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+
+ # Normally different language builds are all done based on the same set of compiled sources.
+ # But sometimes a particular language needs to be built from scratch, if, for instance,
+ # CFLAGS_INLINE_LIMIT is set for a particular language to make it fit.
+ clean_build_check_result = subprocess.run(
+ "make -C ../ports/{port} TRANSLATION={language} BOARD={board} check-release-needs-clean-build | fgrep 'RELEASE_NEEDS_CLEAN_BUILD = 1'".format(
+ port = board_info["port"], language=language, board=board),
+ shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ clean_build = clean_build_check_result.returncode == 0
+
+ build_dir = "build-{board}".format(board=board)
+ if clean_build:
+ build_dir += "-{language}".format(language=language)
+
+ make_result = subprocess.run(
+ "make -C ../ports/{port} TRANSLATION={language} BOARD={board} BUILD={build}".format(
+ port = board_info["port"], language=language, board=board, build=build_dir),
+ shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+
build_duration = time.monotonic() - start_time
success = "\033[32msucceeded\033[0m"
if make_result.returncode != 0:
@@ -47,11 +67,14 @@ for board in build_boards:
other_output = ""
for extension in board_info["extensions"]:
- temp_filename = "../ports/{port}/build-{board}/firmware.{extension}".format(port=board_info["port"], board=board, extension=extension)
+ temp_filename = "../ports/{port}/{build}/firmware.{extension}".format(
+ port=board_info["port"], build=build_dir, extension=extension)
for alias in board_info["aliases"] + [board]:
- bin_directory = "../bin/{alias}/{language}".format(alias=alias, language=language)
+ bin_directory = "../bin/{alias}/{language}".format(
+ alias=alias, language=language)
os.makedirs(bin_directory, exist_ok=True)
- final_filename = "adafruit-circuitpython-{alias}-{language}-{version}.{extension}".format(alias=alias, language=language, version=version, extension=extension)
+ final_filename = "adafruit-circuitpython-{alias}-{language}-{version}.{extension}".format(
+ alias=alias, language=language, version=version, extension=extension)
final_filename = os.path.join(bin_directory, final_filename)
try:
shutil.copyfile(temp_filename, final_filename)
@@ -62,7 +85,9 @@ for board in build_boards:
if travis:
print('travis_fold:start:adafruit-bins-{}-{}\\r'.format(language, board))
- print("Build {} for {} took {:.2f}s and {}".format(board, language, build_duration, success))
+ print("Build {board} for {language}{clean_build} took {build_duration:.2f}s and {success}".format(
+ board=board, language=language, clean_build=(" (clean_build)" if clean_build else ""),
+ build_duration=build_duration, success=success))
if make_result.returncode != 0:
print(make_result.stdout.decode("utf-8"))
print(other_output)
diff --git a/tools/git-checkout-latest-tag.sh b/tools/git-checkout-latest-tag.sh
new file mode 100755
index 000000000..f6242a946
--- /dev/null
+++ b/tools/git-checkout-latest-tag.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+git fetch --tags
+git checkout $(git describe --tags `git rev-list --tags --max-count=1`)