diff --git a/.travis.yml b/.travis.yml index 93d981518c..ecc94ba648 100755 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,8 @@ env: - TRAVIS_BOARD=pirkey_m0 - TRAVIS_BOARD=gemma_m0 - TRAVIS_BOARD=hallowing_m0_express - - TRAVIS_BOARD=feather52832 + - TRAVIS_BOARD=feather_nrf52832 + - TRAVIS_BOARD=feather_nrf52840_express addons: artifacts: @@ -54,7 +55,7 @@ before_script: - ([[ -z "$TRAVIS_BOARD" || $TRAVIS_BOARD = "feather_huzzah" ]] || (wget https://s3.amazonaws.com/adafruit-circuit-python/gcc-arm-embedded_7-2018q2-1~trusty1_amd64.deb && sudo dpkg -i gcc-arm-embedded*_amd64.deb)) # For nrf builds - - ([[ $TRAVIS_BOARD != "feather52832" && $TRAVIS_BOARD != "pca10056" ]] || sudo ports/nrf/drivers/bluetooth/download_ble_stack.sh) + - ([[ $TRAVIS_BOARD != "feather_nrf52832" && $TRAVIS_BOARD != "feather_nrf52840_express" && $TRAVIS_BOARD != "pca10056" ]] || sudo ports/nrf/drivers/bluetooth/download_ble_stack.sh) # For huzzah builds - if [[ $TRAVIS_BOARD = "feather_huzzah" ]]; then wget https://github.com/jepler/esp-open-sdk/releases/download/2018-06-10/xtensa-lx106-elf-standalone.tar.gz && tar xavf xtensa-lx106-elf-standalone.tar.gz; PATH=$(readlink -f xtensa-lx106-elf/bin):$PATH; fi # For coverage testing (upgrade is used to get latest urllib3 version) diff --git a/ports/nrf/README.md b/ports/nrf/README.md index 6cc97703af..b17a5ad7dd 100644 --- a/ports/nrf/README.md +++ b/ports/nrf/README.md @@ -36,9 +36,9 @@ the following links: > **NOTE**: These board specific readmes may be more up to date than the generic board-neutral documentation further down. -* Adafruit [Feather nRF52](boards/feather52/README.md): 512KB Flash, 64KB SRAM -* Adafruit [Feather nRF52840](boards/feather52840/README.md): 1MB Flash, 256KB SRAM -* Nordic PCA10056 see [Feather nRF52840](boards/feather52840/README.md) +* Adafruit [Feather nRF52](boards/feather_nrf52832/README.md): 512KB Flash, 64KB SRAM +* Adafruit [Feather nRF52840](boards/feather_nrf52840_express/README.md): 1MB Flash, 256KB SRAM +* Nordic PCA10056 see [Feather nRF52840](boards/pca10056/README.md) For all other board targets, see the generic notes below. @@ -74,12 +74,12 @@ Note: further tuning of features to include in bluetooth or even setting up the ## Target Boards and Make Flags -Target Board (BOARD) | Bluetooth Stack (SD) | Bluetooth Support | Flash Util ----------------------|-------------------------|------------------------|------------------------------- -pca10040 | s132 | Peripheral and Scanner | [Segger](#segger-targets) -feather52832 | s132 | Peripheral and Scanner | [UART DFU](#dfu-targets) -pca10056 | s140 | Peripheral and Scanner | [Segger](#segger-targets) -feather52840 | s140 | Peripheral and Scanner | [UART DFU](#dfu-targets) +Target Board (BOARD) | Bluetooth Stack (SD) | Bluetooth Support | Flash Util +-------------------------|-------------------------|------------------------|------------------------------- +pca10040 | s132 | Peripheral and Scanner | [Segger](#segger-targets) +pca10056 | s140 | Peripheral and Scanner | [Segger](#segger-targets) +feather_nrf52832 | s132 | Peripheral and Scanner | [UART DFU](#dfu-targets) +feather_nrf52840_express | s140 | Peripheral and Scanner | UF2 bootloader ## Segger Targets @@ -107,9 +107,9 @@ run follow command to install [adafruit-nrfutil](https://github.com/adafruit/Ada * dfu-gen: Generates a Firmware zip to be used by the DFU flash application. * dfu-flash: Triggers the DFU flash application to upload the firmware from the generated Firmware zip file. -Example on how to generate and flash feather52832 target: +Example on how to generate and flash feather_nrf52832 target: - make BOARD=feather52832 SD=s132 + make BOARD=feather_nrf52832 SD=s132 make BOARD=feather52832 SD=s132 dfu-gen dfu-flash ## Bluetooth LE REPL diff --git a/ports/nrf/boards/feather52832/mpconfigboard.mk b/ports/nrf/boards/feather52832/mpconfigboard.mk deleted file mode 100644 index a42decd89e..0000000000 --- a/ports/nrf/boards/feather52832/mpconfigboard.mk +++ /dev/null @@ -1,10 +0,0 @@ -MCU_SERIES = m4 -MCU_VARIANT = nrf52 -MCU_SUB_VARIANT = nrf52 -SD ?= s132 -SOFTDEV_VERSION ?= 2.0.1 - -LD_FILE = boards/feather52832/custom_nrf52832_dfu_app_$(SOFTDEV_VERSION).ld - -BOOT_SETTING_ADDR = 0x7F000 -NRF_DEFINES += -DNRF52832_XXAA diff --git a/ports/nrf/boards/feather52840/mpconfigboard.h b/ports/nrf/boards/feather52840/mpconfigboard.h deleted file mode 100644 index ba9405a9d9..0000000000 --- a/ports/nrf/boards/feather52840/mpconfigboard.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2016 Glenn Ruben Bakke - * - * 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. - */ - -#define FEATHER52840 - -#define MICROPY_HW_BOARD_NAME "Feather52840" -#define MICROPY_HW_MCU_NAME "nRF52840" -#define MICROPY_PY_SYS_PLATFORM "Feather52840" - -#define MICROPY_HW_UART_RX NRF_GPIO_PIN_MAP(0, 8) -#define MICROPY_HW_UART_TX NRF_GPIO_PIN_MAP(0, 6) -#define MICROPY_HW_UART_HWFC (0) - -#define PORT_HEAP_SIZE (128 * 1024) -#define CIRCUITPY_AUTORELOAD_DELAY_MS 500 diff --git a/ports/nrf/boards/feather52832/README.md b/ports/nrf/boards/feather_nrf52832/README.md similarity index 94% rename from ports/nrf/boards/feather52832/README.md rename to ports/nrf/boards/feather_nrf52832/README.md index 9fecee8069..b5acd63603 100644 --- a/ports/nrf/boards/feather52832/README.md +++ b/ports/nrf/boards/feather_nrf52832/README.md @@ -38,12 +38,12 @@ run following command to install [adafruit-nrfutil](https://github.com/adafruit/ #### REPL over UART (default settings) To build a CircuitPython binary with default settings for the -`feather52832` target enter: +`feather_nrf52832` target enter: -> **NOTE:** `BOARD=feather52832` is the default option and isn't stricly required. +> **NOTE:** `BOARD=feather_nrf52832` is the default option and isn't stricly required. ``` -$ make BOARD=feather52832 V=1 +$ make BOARD=feather_nrf52832 V=1 ``` #### REPL over BLE UART (AKA 'NUS') @@ -113,7 +113,7 @@ image, as described earlier in this readme. > The name of the serial port target will vary, depending on your OS. ``` -$ make BOARD=feather52832 SERIAL=/dev/tty.SLAB_USBtoUART dfu-gen dfu-flash +$ make BOARD=feather_nrf52832 SERIAL=/dev/tty.SLAB_USBtoUART dfu-gen dfu-flash ``` By default, CircuitPython will build with **BLE** support enabled using @@ -121,7 +121,7 @@ By default, CircuitPython will build with **BLE** support enabled using SD family or version you can enter the optional fields as shown below: ``` -$ make BOARD=feather52832 SERIAL=/dev/tty.SLAB_USBtoUART SD=s132 SOFTDEV_VERSION=5.0.0 dfu-gen dfu-flash +$ make BOARD=feather_nrf52832 SERIAL=/dev/tty.SLAB_USBtoUART SD=s132 SOFTDEV_VERSION=5.0.0 dfu-gen dfu-flash ``` ## Working with CircuitPython diff --git a/ports/nrf/boards/feather52832/board.c b/ports/nrf/boards/feather_nrf52832/board.c similarity index 100% rename from ports/nrf/boards/feather52832/board.c rename to ports/nrf/boards/feather_nrf52832/board.c diff --git a/ports/nrf/boards/feather52832/custom_nrf52832_dfu_app_2.0.1.ld b/ports/nrf/boards/feather_nrf52832/custom_nrf52832_dfu_app_2.0.1.ld similarity index 100% rename from ports/nrf/boards/feather52832/custom_nrf52832_dfu_app_2.0.1.ld rename to ports/nrf/boards/feather_nrf52832/custom_nrf52832_dfu_app_2.0.1.ld diff --git a/ports/nrf/boards/feather52832/custom_nrf52832_dfu_app_5.0.0.ld b/ports/nrf/boards/feather_nrf52832/custom_nrf52832_dfu_app_5.0.0.ld similarity index 100% rename from ports/nrf/boards/feather52832/custom_nrf52832_dfu_app_5.0.0.ld rename to ports/nrf/boards/feather_nrf52832/custom_nrf52832_dfu_app_5.0.0.ld diff --git a/ports/nrf/boards/feather52832/examples/ble_scan.py b/ports/nrf/boards/feather_nrf52832/examples/ble_scan.py similarity index 100% rename from ports/nrf/boards/feather52832/examples/ble_scan.py rename to ports/nrf/boards/feather_nrf52832/examples/ble_scan.py diff --git a/ports/nrf/boards/feather52832/examples/blinky.py b/ports/nrf/boards/feather_nrf52832/examples/blinky.py similarity index 100% rename from ports/nrf/boards/feather52832/examples/blinky.py rename to ports/nrf/boards/feather_nrf52832/examples/blinky.py diff --git a/ports/nrf/boards/feather52832/examples/i2c_scan.py b/ports/nrf/boards/feather_nrf52832/examples/i2c_scan.py similarity index 100% rename from ports/nrf/boards/feather52832/examples/i2c_scan.py rename to ports/nrf/boards/feather_nrf52832/examples/i2c_scan.py diff --git a/ports/nrf/boards/feather52832/examples/pulseio.py b/ports/nrf/boards/feather_nrf52832/examples/pulseio.py similarity index 100% rename from ports/nrf/boards/feather52832/examples/pulseio.py rename to ports/nrf/boards/feather_nrf52832/examples/pulseio.py diff --git a/ports/nrf/boards/feather52832/mpconfigboard.h b/ports/nrf/boards/feather_nrf52832/mpconfigboard.h similarity index 100% rename from ports/nrf/boards/feather52832/mpconfigboard.h rename to ports/nrf/boards/feather_nrf52832/mpconfigboard.h diff --git a/ports/nrf/boards/feather_nrf52832/mpconfigboard.mk b/ports/nrf/boards/feather_nrf52832/mpconfigboard.mk new file mode 100644 index 0000000000..c370b724e7 --- /dev/null +++ b/ports/nrf/boards/feather_nrf52832/mpconfigboard.mk @@ -0,0 +1,11 @@ +MCU_SERIES = m4 +MCU_VARIANT = nrf52 +MCU_SUB_VARIANT = nrf52 +SD ?= s132 +SOFTDEV_VERSION ?= 2.0.1 + +LD_FILE = boards/feather_nrf52832/custom_nrf52832_dfu_app_$(SOFTDEV_VERSION).ld +BOOT_FILE = boards/feather_nrf52832/bootloader/feather52_bootloader_$(SOFTDEV_VERSION)_s132_single + +BOOT_SETTING_ADDR = 0x7F000 +NRF_DEFINES += -DNRF52832_XXAA diff --git a/ports/nrf/boards/feather52832/pins.csv b/ports/nrf/boards/feather_nrf52832/pins.csv similarity index 100% rename from ports/nrf/boards/feather52832/pins.csv rename to ports/nrf/boards/feather_nrf52832/pins.csv diff --git a/ports/nrf/boards/feather52840/README.md b/ports/nrf/boards/feather_nrf52840_express/README.md similarity index 100% rename from ports/nrf/boards/feather52840/README.md rename to ports/nrf/boards/feather_nrf52840_express/README.md diff --git a/ports/nrf/boards/feather52840/board.c b/ports/nrf/boards/feather_nrf52840_express/board.c similarity index 100% rename from ports/nrf/boards/feather52840/board.c rename to ports/nrf/boards/feather_nrf52840_express/board.c diff --git a/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h b/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h new file mode 100644 index 0000000000..ce21e73861 --- /dev/null +++ b/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h @@ -0,0 +1,75 @@ +/* + * 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 + * + * 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. + */ + +#define FEATHER52840 + +#define MICROPY_HW_BOARD_NAME "Adafruit Feather nRF52840 Express" +#define MICROPY_HW_MCU_NAME "nRF52840" +#define MICROPY_PY_SYS_PLATFORM "Feather52840" + +// #define MICROPY_HW_NEOPIXEL NRF_GPIO_PIN_MAP(0, 13) + +// #define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(1, 9) +// #define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 11) +// #define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 12) +// #define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(0, 14) +// #define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(0, 8) +// #define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(1, 8) + +// #define MICROPY_HW_UART_RX NRF_GPIO_PIN_MAP(0, 8) +// #define MICROPY_HW_UART_TX NRF_GPIO_PIN_MAP(0, 6) +// #define MICROPY_HW_UART_HWFC (0) + +#define CIRCUITPY_AUTORELOAD_DELAY_MS 500 + +// If you change this, then make sure to update the linker scripts as well to +// make sure you don't overwrite code +#define PORT_HEAP_SIZE (128 * 1024) +// TODO #define CIRCUITPY_INTERNAL_NVM_SIZE 8192 + +#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE) + +// TODO #include "external_flash/devices.h" + +#define EXTERNAL_FLASH_DEVICE_COUNT 1 +#define EXTERNAL_FLASH_DEVICES GD25Q16C + +#define EXTERNAL_FLASH_QSPI_DUAL + +// TODO include "external_flash/external_flash.h" + +#define BOARD_HAS_CRYSTAL 1 + +#define DEFAULT_I2C_BUS_SCL NRF_GPIO_PIN_MAP(1, 11) +#define DEFAULT_I2C_BUS_SDA NRF_GPIO_PIN_MAP(1, 12) + +#define DEFAULT_SPI_BUS_SCK NRF_GPIO_PIN_MAP(0, 20) +#define DEFAULT_SPI_BUS_MOSI NRF_GPIO_PIN_MAP(0, 23) +#define DEFAULT_SPI_BUS_MISO NRF_GPIO_PIN_MAP(0, 22) + +#define DEFAULT_UART_BUS_RX NRF_GPIO_PIN_MAP(1, 0) +#define DEFAULT_UART_BUS_TX NRF_GPIO_PIN_MAP(0, 24) diff --git a/ports/nrf/boards/feather52840/mpconfigboard.mk b/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.mk similarity index 100% rename from ports/nrf/boards/feather52840/mpconfigboard.mk rename to ports/nrf/boards/feather_nrf52840_express/mpconfigboard.mk diff --git a/ports/nrf/boards/feather52840/pins.csv b/ports/nrf/boards/feather_nrf52840_express/pins.csv similarity index 100% rename from ports/nrf/boards/feather52840/pins.csv rename to ports/nrf/boards/feather_nrf52840_express/pins.csv diff --git a/ports/nrf/common-hal/board/__init__.c b/ports/nrf/common-hal/board/__init__.c index 257b8108d4..287f546d5c 100644 --- a/ports/nrf/common-hal/board/__init__.c +++ b/ports/nrf/common-hal/board/__init__.c @@ -25,4 +25,4 @@ */ // Pins aren't actually defined here. They are in the board specific directory -// such as boards/feather52832/pins.csv +// such as boards/feather_nrf52832/pins.csv diff --git a/tools/build_adafruit_bins.sh b/tools/build_adafruit_bins.sh index 13d65e317b..c665b82ac1 100755 --- a/tools/build_adafruit_bins.sh +++ b/tools/build_adafruit_bins.sh @@ -2,7 +2,30 @@ rm -rf ports/atmel-samd/build* rm -rf ports/esp8266/build* rm -rf ports/nrf/build* -ATMEL_BOARDS="arduino_zero circuitplayground_express circuitplayground_express_crickit feather_radiofruit_zigbee feather_m0_basic feather_m0_adalogger itsybitsy_m0_express itsybitsy_m4_express feather_m0_rfm69 feather_m0_rfm9x feather_m0_express feather_m0_express_crickit feather_m4_express metro_m0_express metro_m4_express pirkey_m0 trinket_m0 gemma_m0 feather52832 feather_huzzah pca10056 hallowing_m0_express" +ATMEL_BOARDS="\ +arduino_zero \ +circuitplayground_express \ +circuitplayground_express_crickit \ +feather_huzzah \ +feather_m0_adalogger \ +feather_m0_basic \ +feather_m0_express \ +feather_m0_express_crickit \ +feather_m0_rfm69 \ +feather_m0_rfm9x \ +feather_m4_express \ +feather_nrf52832 \ +feather_nrf52840 \ +feather_radiofruit_zigbee \ +gemma_m0 \ +hallowing_m0_express \ +itsybitsy_m0_express \ +itsybitsy_m4_express \ +metro_m0_express \ +metro_m4_express \ +pirkey_m0 \ +trinket_m0 \ +" ROSIE_SETUPS="rosie-ci" PARALLEL="-j 5" @@ -41,11 +64,16 @@ for board in $boards; do (( exit_status = exit_status || $? )) temp_filename=ports/esp8266/build/firmware-combined.bin extension=bin - elif [ $board == "feather52832" ]; then - make $PARALLEL -C ports/nrf TRANSLATION=$language BOARD=feather52832 + elif [ $board == "feather_nrf52832" ]; then + make $PARALLEL -C ports/nrf TRANSLATION=$language BOARD=feather_nrf52832 (( exit_status = exit_status || $? )) temp_filename=ports/nrf/build-$board-s132/firmware.bin extension=bin + elif [ $board == "feather_nrf52840_express" ]; then + make $PARALLEL -C ports/nrf TRANSLATION=$language BOARD=feather_nrf52840_express SD=s140 + (( exit_status = exit_status || $? )) + temp_filename=ports/nrf/build-$board-s140/firmware.bin + extension=bin elif [ $board == "pca10056" ]; then make $PARALLEL -C ports/nrf TRANSLATION=$language BOARD=pca10056 SD=s140 (( exit_status = exit_status || $? ))