From b5fc646e3d8e74d4a5c5c274c988847000b32b49 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 23 May 2019 16:15:52 -0400 Subject: Update frozen libs --- frozen/Adafruit_CircuitPython_BusDevice | 2 +- frozen/Adafruit_CircuitPython_Crickit | 2 +- frozen/Adafruit_CircuitPython_HID | 2 +- frozen/Adafruit_CircuitPython_IRRemote | 2 +- frozen/Adafruit_CircuitPython_LIS3DH | 2 +- frozen/Adafruit_CircuitPython_Motor | 2 +- frozen/Adafruit_CircuitPython_NeoPixel | 2 +- frozen/Adafruit_CircuitPython_seesaw | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/frozen/Adafruit_CircuitPython_BusDevice b/frozen/Adafruit_CircuitPython_BusDevice index 6b3402965..182eebdc8 160000 --- a/frozen/Adafruit_CircuitPython_BusDevice +++ b/frozen/Adafruit_CircuitPython_BusDevice @@ -1 +1 @@ -Subproject commit 6b3402965999d068316882d63fae3ab26006477c +Subproject commit 182eebdc8168e3d14cd0cb28db3abb734c9e45f3 diff --git a/frozen/Adafruit_CircuitPython_Crickit b/frozen/Adafruit_CircuitPython_Crickit index a16868035..617bb0787 160000 --- a/frozen/Adafruit_CircuitPython_Crickit +++ b/frozen/Adafruit_CircuitPython_Crickit @@ -1 +1 @@ -Subproject commit a1686803566793ec2de7e043bf6822e47cfa31d1 +Subproject commit 617bb0787f2c61283d248632a62b27be80f64b29 diff --git a/frozen/Adafruit_CircuitPython_HID b/frozen/Adafruit_CircuitPython_HID index 836bb9843..c9e07857d 160000 --- a/frozen/Adafruit_CircuitPython_HID +++ b/frozen/Adafruit_CircuitPython_HID @@ -1 +1 @@ -Subproject commit 836bb9843fd793683061c15150944f8897d806e9 +Subproject commit c9e07857dc10ff5e6c743e5e8c00e9b049800d09 diff --git a/frozen/Adafruit_CircuitPython_IRRemote b/frozen/Adafruit_CircuitPython_IRRemote index aa4428f30..70865ac6e 160000 --- a/frozen/Adafruit_CircuitPython_IRRemote +++ b/frozen/Adafruit_CircuitPython_IRRemote @@ -1 +1 @@ -Subproject commit aa4428f304b982aa19a5800822e78c47dc8a3b6c +Subproject commit 70865ac6e09f821b26ec727e2df300a6d9ebf6b3 diff --git a/frozen/Adafruit_CircuitPython_LIS3DH b/frozen/Adafruit_CircuitPython_LIS3DH index a03f90112..f5892e24f 160000 --- a/frozen/Adafruit_CircuitPython_LIS3DH +++ b/frozen/Adafruit_CircuitPython_LIS3DH @@ -1 +1 @@ -Subproject commit a03f9011279f9e630549432589463912831fcee1 +Subproject commit f5892e24f7235c4bde2908cbb3cd0a3d6b34d421 diff --git a/frozen/Adafruit_CircuitPython_Motor b/frozen/Adafruit_CircuitPython_Motor index 98563ab65..5a5083081 160000 --- a/frozen/Adafruit_CircuitPython_Motor +++ b/frozen/Adafruit_CircuitPython_Motor @@ -1 +1 @@ -Subproject commit 98563ab65800aac6464f671c0d005df56ecaa6c6 +Subproject commit 5a50830814aaeeb1fda34ed0ba2f8397415d9796 diff --git a/frozen/Adafruit_CircuitPython_NeoPixel b/frozen/Adafruit_CircuitPython_NeoPixel index c0ed34813..c0bdd8b10 160000 --- a/frozen/Adafruit_CircuitPython_NeoPixel +++ b/frozen/Adafruit_CircuitPython_NeoPixel @@ -1 +1 @@ -Subproject commit c0ed34813a608b64ed044826553918ddbad12f0c +Subproject commit c0bdd8b10383725ee9293f5d88fb8d47eb1272bd diff --git a/frozen/Adafruit_CircuitPython_seesaw b/frozen/Adafruit_CircuitPython_seesaw index 1d12cfc0b..4b101f003 160000 --- a/frozen/Adafruit_CircuitPython_seesaw +++ b/frozen/Adafruit_CircuitPython_seesaw @@ -1 +1 @@ -Subproject commit 1d12cfc0b729b4ae0a2f3f4e7c1933a0fbd3b166 +Subproject commit 4b101f00320d36b23f8cc28cf3f12127085894c1 -- cgit v1.2.3 From e84f3b1c6a4a4fde58842d85d002b8964a4e74ad Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 23 May 2019 21:21:47 -0400 Subject: make crickit cpx pinyin build fit --- .../boards/circuitplayground_express_crickit/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk index bdcb4d350..99ce90b3c 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk @@ -20,7 +20,7 @@ CHIP_FAMILY = samd21 # Tweak inlining depending on language. ifeq ($(TRANSLATION), zh_Latn_pinyin) -CFLAGS_INLINE_LIMIT = 35 +CFLAGS_INLINE_LIMIT = 23 else CFLAGS_INLINE_LIMIT = 55 endif -- cgit v1.2.3 From 4e85c1ef91683929df0afe105e92ce6e4291b445 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 24 May 2019 15:32:24 -0400 Subject: Implement forced clean builds for boards so designated. Mark boards that set CFLAGS_INLINE_LIMIT for particular langauges as needing clean builds. Fixes #1910. --- .../circuitplayground_express/mpconfigboard.mk | 1 + .../mpconfigboard.mk | 1 + .../boards/feather_m0_express/mpconfigboard.mk | 1 + .../boards/itsybitsy_m0_express/mpconfigboard.mk | 1 + .../boards/metro_m0_express/mpconfigboard.mk | 1 + ports/atmel-samd/boards/pewpew10/mpconfigboard.mk | 1 + .../sparkfun_redboard_turbo/mpconfigboard.mk | 1 + py/circuitpy_defns.mk | 5 +++ tools/build_release_files.py | 37 ++++++++++++++++++---- 9 files changed, 43 insertions(+), 6 deletions(-) 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 99ce90b3c..0a8ac37b8 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk @@ -21,6 +21,7 @@ CHIP_FAMILY = samd21 # Tweak inlining depending on language. ifeq ($(TRANSLATION), zh_Latn_pinyin) 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/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 1aca33901..fd8e00354 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -361,3 +361,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/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) -- cgit v1.2.3 From a9a222716722f3477ecaf27f07f7d4c66862818e Mon Sep 17 00:00:00 2001 From: Jason Pecor <14111408+jpecor@users.noreply.github.com> Date: Mon, 27 May 2019 14:08:19 -0500 Subject: Removed warning box regarding SAMD21 builds The support matrix shows that pulseio is supported for all SAMD21/SAMD51 variants. Removing warning to avoid confusion. --- shared-bindings/pulseio/__init__.c | 4 ---- 1 file changed, 4 deletions(-) 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 -- cgit v1.2.3 From 71c7aca29ca49102c0c6c01cca65e901bc0a0184 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 28 May 2019 09:09:00 -0400 Subject: Add top-level Makefile target to update frozen libs easily; Update CPX lib --- Makefile | 6 +++++- frozen/Adafruit_CircuitPython_CircuitPlayground | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5d5d99fb8..dfb6e4b75 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. @@ -203,3 +203,7 @@ translate: locale/circuitpython.pot check-translate: locale/circuitpython.pot $(wildcard locale/*.po) $(PYTHON) tools/check_translations.py $^ + +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/frozen/Adafruit_CircuitPython_CircuitPlayground b/frozen/Adafruit_CircuitPython_CircuitPlayground index 1d38fd81e..0cc2e975e 160000 --- a/frozen/Adafruit_CircuitPython_CircuitPlayground +++ b/frozen/Adafruit_CircuitPython_CircuitPlayground @@ -1 +1 @@ -Subproject commit 1d38fd81edd30f1bd70c0cfe77819ab610ea89a3 +Subproject commit 0cc2e975ed22ace0d679c6fb8f3388034b88bcf1 -- cgit v1.2.3 From 4a7122d3541529823a6dc84e0c91520c3c50618b Mon Sep 17 00:00:00 2001 From: Tavish Naruka Date: Thu, 23 May 2019 13:58:02 +0530 Subject: boards: add support for Electronut labs Blip Signed-off-by: Tavish Naruka --- .travis.yml | 2 +- ports/nrf/README.md | 1 + ports/nrf/boards/electronut_labs_blip/README.md | 67 ++++++++++++++++++++ ports/nrf/boards/electronut_labs_blip/board.c | 38 ++++++++++++ .../boards/electronut_labs_blip/mpconfigboard.h | 53 ++++++++++++++++ .../boards/electronut_labs_blip/mpconfigboard.mk | 22 +++++++ ports/nrf/boards/electronut_labs_blip/pins.c | 72 ++++++++++++++++++++++ 7 files changed, 254 insertions(+), 1 deletion(-) create mode 100644 ports/nrf/boards/electronut_labs_blip/README.md create mode 100644 ports/nrf/boards/electronut_labs_blip/board.c create mode 100644 ports/nrf/boards/electronut_labs_blip/mpconfigboard.h create mode 100644 ports/nrf/boards/electronut_labs_blip/mpconfigboard.mk create mode 100644 ports/nrf/boards/electronut_labs_blip/pins.c 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/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/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); -- cgit v1.2.3 From 62de2506e47c14a71c7a9fe04360697ccb966aeb Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 6 Jun 2019 17:49:32 -0400 Subject: Include display objects in gc. --- main.c | 5 +++++ ports/nrf/background.c | 4 ++-- ports/nrf/supervisor/port.c | 10 ++++++++-- py/gc.c | 4 ++++ py/gc.h | 1 + shared-bindings/board/__init__.c | 1 - shared-module/board/__init__.c | 2 +- shared-module/displayio/__init__.c | 16 ++++++++++++++-- shared-module/displayio/__init__.h | 1 + 9 files changed, 36 insertions(+), 8 deletions(-) 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/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/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/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 82a0cab67..448b397ab 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-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 156640440..3b98536e9 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" @@ -181,7 +182,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) { @@ -218,5 +218,17 @@ 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); + + } } diff --git a/shared-module/displayio/__init__.h b/shared-module/displayio/__init__.h index 5b56ed55c..de021276c 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_BINDINGS_DISPLAYIO___INIT___H -- cgit v1.2.3 From 5164a6eb26ebc8f02a90081b610496e2517259ed Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 11 Jun 2019 15:22:32 -0400 Subject: forgot tools/git-checkout-latest-tag.sh in PR #1909 --- tools/git-checkout-latest-tag.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 tools/git-checkout-latest-tag.sh 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`) -- cgit v1.2.3