diff --git a/ports/nrf/README.md b/ports/nrf/README.md index be799a6a27..053ef7a462 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_nrf_52840_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,11 +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) +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 @@ -101,18 +102,18 @@ note: On Linux it might be required to link SEGGER's `libjlinkarm.so` inside nrf sudo apt-get install build-essential libffi-dev pkg-config gcc-arm-none-eabi git python python-pip git clone https://github.com/adafruit/Adafruit_nRF52_Arduino.git cd Adafruit_nRF52_Arduino/tools/nrfutil-0.5.2/ - sudo pip install -r requirements.txt - sudo python setup.py install + pip3 install --user -r requirements.txt + python3 setup.py install --user **make flash** and **make sd** will not work with DFU targets. Hence, **dfu-gen** and **dfu-flash** must be used instead. * 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=feather52832 SD=s132 dfu-gen - make BOARD=feather52832 SD=s132 dfu-flash + make BOARD=feather_nrf52832 SD=s132 + make BOARD=feather_nrf52832 SD=s132 dfu-gen + make BOARD=feather_nrf52832 SD=s132 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 e49026d23d..0000000000 --- a/ports/nrf/boards/feather52832/mpconfigboard.mk +++ /dev/null @@ -1,11 +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_FILE = boards/feather52832/bootloader/feather52_bootloader_$(SOFTDEV_VERSION)_s132_single - -BOOT_SETTING_ADDR = 0x7F000 -NRF_DEFINES += -DNRF52832_XXAA diff --git a/ports/nrf/boards/feather52832/README.md b/ports/nrf/boards/feather_nrf52832/README.md similarity index 90% rename from ports/nrf/boards/feather52832/README.md rename to ports/nrf/boards/feather_nrf52832/README.md index cdd542068c..4f04a3f5ab 100644 --- a/ports/nrf/boards/feather52832/README.md +++ b/ports/nrf/boards/feather_nrf52832/README.md @@ -36,8 +36,8 @@ you can install pip via 'sudo easy_install pip' ``` $ cd ../../lib/nrfutil -$ sudo pip install -r requirements.txt -$ sudo python setup.py install +$ pip3 install --user -r requirements.txt +$ python3 setup.py install ``` # Building and flashing firmware images @@ -47,12 +47,12 @@ $ sudo python setup.py install #### 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') @@ -95,7 +95,7 @@ Feather52 boards to a single-bank CircuitPython compatible version: By default s132 v2.0.1 is used when no `SOFTDEV_VERSION` field is passed in: ``` -$ make BOARD=feather52832 SERIAL=/dev/tty.SLAB_USBtoUART boot-flash +$ make BOARD=feather_nrf52832 SERIAL=/dev/tty.SLAB_USBtoUART boot-flash ``` #### S132 v5.0.0 (BLE5, experimental): @@ -103,7 +103,7 @@ $ make BOARD=feather52832 SERIAL=/dev/tty.SLAB_USBtoUART boot-flash To enable BLE5 support and the latest S132 release, flash the v5.0.0 bootloader via: ``` -$ make BOARD=feather52832 SERIAL=/dev/tty.SLAB_USBtoUART SOFTDEV_VERSION=5.0.0 boot-flash +$ make BOARD=feather_nrf52832 SERIAL=/dev/tty.SLAB_USBtoUART SOFTDEV_VERSION=5.0.0 boot-flash ``` ### 2. Generate and flash a CircuitPython DFU .zip package over serial @@ -117,7 +117,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 @@ -125,7 +125,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/bootloader/.gitattributes b/ports/nrf/boards/feather_nrf52832/bootloader/.gitattributes similarity index 100% rename from ports/nrf/boards/feather52832/bootloader/.gitattributes rename to ports/nrf/boards/feather_nrf52832/bootloader/.gitattributes diff --git a/ports/nrf/boards/feather52832/bootloader/README.md b/ports/nrf/boards/feather_nrf52832/bootloader/README.md similarity index 100% rename from ports/nrf/boards/feather52832/bootloader/README.md rename to ports/nrf/boards/feather_nrf52832/bootloader/README.md diff --git a/ports/nrf/boards/feather52832/bootloader/feather52_bootloader_2.0.1_s132_single.zip b/ports/nrf/boards/feather_nrf52832/bootloader/feather52_bootloader_2.0.1_s132_single.zip similarity index 100% rename from ports/nrf/boards/feather52832/bootloader/feather52_bootloader_2.0.1_s132_single.zip rename to ports/nrf/boards/feather_nrf52832/bootloader/feather52_bootloader_2.0.1_s132_single.zip diff --git a/ports/nrf/boards/feather52832/bootloader/feather52_bootloader_5.0.0_s132_single.zip b/ports/nrf/boards/feather_nrf52832/bootloader/feather52_bootloader_5.0.0_s132_single.zip similarity index 100% rename from ports/nrf/boards/feather52832/bootloader/feather52_bootloader_5.0.0_s132_single.zip rename to ports/nrf/boards/feather_nrf52832/bootloader/feather52_bootloader_5.0.0_s132_single.zip 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..41f01bb048 --- /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_nrf_52832/custom_nrf52832_dfu_app_$(SOFTDEV_VERSION).ld +BOOT_FILE = boards/feather_nrf_52832/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/feather52840/bootloader/6.0.0/feather52840_bootloader_6.0.0_s140.hex b/ports/nrf/boards/feather_nrf52840_express/bootloader/6.0.0/feather52840_bootloader_6.0.0_s140.hex similarity index 100% rename from ports/nrf/boards/feather52840/bootloader/6.0.0/feather52840_bootloader_6.0.0_s140.hex rename to ports/nrf/boards/feather_nrf52840_express/bootloader/6.0.0/feather52840_bootloader_6.0.0_s140.hex diff --git a/ports/nrf/boards/feather52840/bootloader/6.0.0/feather52840_bootloader_6.0.0_s140.zip b/ports/nrf/boards/feather_nrf52840_express/bootloader/6.0.0/feather52840_bootloader_6.0.0_s140.zip similarity index 100% rename from ports/nrf/boards/feather52840/bootloader/6.0.0/feather52840_bootloader_6.0.0_s140.zip rename to ports/nrf/boards/feather_nrf52840_express/bootloader/6.0.0/feather52840_bootloader_6.0.0_s140.zip diff --git a/ports/nrf/boards/feather52840/mpconfigboard.h b/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h similarity index 52% rename from ports/nrf/boards/feather52840/mpconfigboard.h rename to ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h index ba9405a9d9..4c0d77b245 100644 --- a/ports/nrf/boards/feather52840/mpconfigboard.h +++ b/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h @@ -4,6 +4,7 @@ * 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 @@ -26,13 +27,49 @@ #define FEATHER52840 -#define MICROPY_HW_BOARD_NAME "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 PORT_HEAP_SIZE (128 * 1024) #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 || $? ))