diff --git a/boards/acd52832/doc.txt b/boards/acd52832/doc.txt index 8ed60bf838..ee389426c1 100644 --- a/boards/acd52832/doc.txt +++ b/boards/acd52832/doc.txt @@ -2,4 +2,9 @@ @defgroup boards_acd52832 ACD52832 @ingroup boards @brief Support for the aconnoâ„¢ ACD52832 + +## Flash the board + +See the `Flashing` section in @ref boards_common_nrf52. + */ diff --git a/boards/common/nrf52/Makefile.include b/boards/common/nrf52/Makefile.include index 269a84f145..2df50ef0a3 100644 --- a/boards/common/nrf52/Makefile.include +++ b/boards/common/nrf52/Makefile.include @@ -9,24 +9,36 @@ PORT_LINUX ?= /dev/ttyACM0 PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) include $(RIOTMAKE)/tools/serial.inc.mk -# define jlink as default programmer, but overridable -PROGRAMMER ?= jlink +# The following configuration is dependencies specific +# but they are resolved later +# Hack to know now if 'nordic_softdevice_ble' is used +include $(RIOTBOARD)/$(BOARD)/Makefile.dep +PROGRAMMER ?= jlink ifeq (jlink,$(PROGRAMMER)) # setup JLink for flashing export JLINK_DEVICE := nrf52 - # The following configuration is dependencies specific - # but they are resolved later - # Hack to know now if 'nordic_softdevice_ble' is used - include $(RIOTBOARD)/$(BOARD)/Makefile.dep - # special options when using SoftDevice ifneq (,$(filter nordic_softdevice_ble,$(USEPKG))) export JLINK_PRE_FLASH := erase\nloadfile $(BINDIR)/softdevice.hex export FLASH_ADDR := 0x1f000 export LINKER_SCRIPT ?= $(RIOTCPU)/$(CPU)/ldscripts/$(CPU_MODEL)_sd.ld endif - include $(RIOTMAKE)/tools/jlink.inc.mk +else ifeq (openocd,$(PROGRAMMER)) + ifneq (,$(filter $(BOARD),ruuvitag thingy52)) + # openocd doesn't fully work with ruuvitag and thingy52 + $(error Cannot use OpenOCD with $(BOARD) board) + endif + # setup OpenOCD for flashing. Version 0.10 of OpenOCD doesn't contain support + # for nrf52dk and nrf52840dk boards. To use OpenOCD with these a version + # build from source (master > 2018, August the 13rd) is required. + ifneq (,$(filter nordic_softdevice_ble,$(USEPKG))) + # openocd doesn't work (yet) with softdevice + $(error Cannot use OpenOCD with nordic_softdevice module) + endif + export DEBUG_ADAPTER ?= jlink + export OPENOCD_CONFIG := $(RIOTBOARD)/common/nrf52/dist/openocd.cfg + include $(RIOTMAKE)/tools/openocd.inc.mk endif diff --git a/boards/nrf52840-mdk/dist/openocd.cfg b/boards/common/nrf52/dist/openocd.cfg similarity index 98% rename from boards/nrf52840-mdk/dist/openocd.cfg rename to boards/common/nrf52/dist/openocd.cfg index 60f0681d52..75659d4ab3 100644 --- a/boards/nrf52840-mdk/dist/openocd.cfg +++ b/boards/common/nrf52/dist/openocd.cfg @@ -1,2 +1,3 @@ transport select swd + source [find target/nrf52.cfg] diff --git a/boards/common/nrf52/doc.txt b/boards/common/nrf52/doc.txt new file mode 100644 index 0000000000..332c538f4b --- /dev/null +++ b/boards/common/nrf52/doc.txt @@ -0,0 +1,28 @@ +/** +@defgroup boards_common_nrf52 nRF52 common +@ingroup boards_common +@brief Common files and configuration for nRF52 boards. + +## Flashing nrf52 boards + +By default, nrf52 boards are flashed using Jlink. @ref boards_nrf52840-mdk +uses PyOCD by default. + +To flash the board, use `BOARD=` with the `make` command.
+Example with `hello-world` application: +``` + make BOARD= -C examples/hello-world flash +``` + +OpenOCD can also be used to flash nrf52 boards (except thingy52 and ruuvitag +because they are hardly coupled with JLink segger_rtt stdio). +For the moment, the latest stable version of OpenOCD (0.10) doesn't contain any +support for nrf52 but versions built against the current development version +can be used. + +To flash the board with OpenOCD, use the `PROGRAMMER` variable: +``` + PROGRAMMER=openocd make BOARD= -C examples/hello-world flash +``` + +*/ diff --git a/boards/common/nrf52/include/board_common.h b/boards/common/nrf52/include/board_common.h index c3be793e25..333b1af986 100644 --- a/boards/common/nrf52/include/board_common.h +++ b/boards/common/nrf52/include/board_common.h @@ -7,8 +7,7 @@ */ /** - * @defgroup boards_common_nrf52 NRF52 common - * @ingroup boards_common + * @ingroup boards_common_nrf52 * @brief Shared files and configuration for all nRF52 boards. * @{ * diff --git a/boards/nrf52840-mdk/Makefile.include b/boards/nrf52840-mdk/Makefile.include index 8c03241645..34c3a015c3 100644 --- a/boards/nrf52840-mdk/Makefile.include +++ b/boards/nrf52840-mdk/Makefile.include @@ -10,9 +10,6 @@ ifeq (pyocd,$(PROGRAMMER)) # option is passed explicitly export FLASH_TARGET_TYPE ?= -t $(CPU) include $(RIOTMAKE)/tools/pyocd.inc.mk -else ifeq (openocd,$(PROGRAMMER)) - export DEBUG_ADAPTER ?= dap - include $(RIOTMAKE)/tools/openocd.inc.mk endif include $(RIOTBOARD)/common/nrf52/Makefile.include diff --git a/boards/nrf52840-mdk/doc.txt b/boards/nrf52840-mdk/doc.txt index b02b5c96f8..9e9024ebad 100644 --- a/boards/nrf52840-mdk/doc.txt +++ b/boards/nrf52840-mdk/doc.txt @@ -23,20 +23,8 @@ PyOCD can be installed using Python package manager: pip install pyocd --user -U ``` -To flash the board `BOARD=nrf52840-mdk` with the `make` command.
-Example with `hello-world` application: -``` - make BOARD=nrf52840-mdk -C examples/hello-world flash -``` +See the `Flashing` section in @ref boards_common_nrf52. -OpenOCD can also be used. For the moment, the latest stable version of OpenOCD -(0.10) doesn't contain any support for nrf52 but versions built against the -actual development version can be used. - -To flash the board with OpenOCD, use the `PROGRAMMER` variable: -``` - PROGRAMMER=openocd make BOARD=nrf52840-mdk -C examples/hello-world flash -``` ### Accessing STDIO via UART diff --git a/boards/nrf52840dk/doc.txt b/boards/nrf52840dk/doc.txt index 3129f87482..73048077d2 100644 --- a/boards/nrf52840dk/doc.txt +++ b/boards/nrf52840dk/doc.txt @@ -13,4 +13,18 @@ this, RIOT provides a little tool in `dist/tools/nrf52_resetpin_cfg`. Simply compile, flash, and run that tool on your board, and the reset pin should work for the time being. +## Flash the board + +See the `Flashing` section in @ref boards_common_nrf52. + +## Accessing STDIO via UART + +The STDIO is directly accessible via the USB port. On a Linux host, it's +generally mapped to `/dev/ttyACM0`. + +Use the `term` target to connect to the board serial port
+``` + make BOARD=nrf52840dk -C examples/hello-world term +``` + */ diff --git a/boards/nrf52dk/doc.txt b/boards/nrf52dk/doc.txt index b32c08d7e5..da28180459 100644 --- a/boards/nrf52dk/doc.txt +++ b/boards/nrf52dk/doc.txt @@ -104,4 +104,18 @@ work for the time being. There are two pins for current measurement on board. Don't connect these pins to GND!. The left pin is at 3.3V level and the right pin is connected to V33. Divide the measured voltage between this pins by 22 to get the current. + +## Flash the board + +See the `Flashing` section in @ref boards_common_nrf52. + +## Accessing STDIO via UART + +The STDIO is directly accessible via the USB port. On a Linux host, it's +generally mapped to `/dev/ttyACM0`. + +Use the `term` target to connect to the board serial port
+``` + make BOARD=nrf52dk -C examples/hello-world term +``` */ diff --git a/boards/ruuvitag/doc.txt b/boards/ruuvitag/doc.txt index 4bf7036125..191d5c6cd8 100644 --- a/boards/ruuvitag/doc.txt +++ b/boards/ruuvitag/doc.txt @@ -2,4 +2,9 @@ @defgroup boards_ruuvitag RuuviTag @ingroup boards @brief Support for the RuuviTag board + +## Flash the board + +See the `Flashing` section in @ref boards_common_nrf52. + */ diff --git a/boards/thingy52/doc.txt b/boards/thingy52/doc.txt index 016cdf349f..8b9dbe870f 100644 --- a/boards/thingy52/doc.txt +++ b/boards/thingy52/doc.txt @@ -2,4 +2,9 @@ @defgroup boards_thingy52 Nordic Thingy:52 @ingroup boards @brief Support for the Nordic Thingy:52 board + +## Flash the board + +See the `Flashing` section in @ref boards_common_nrf52. + */