boards/common/nrf52: allow ST-LINKV2 as programmer#13858
boards/common/nrf52: allow ST-LINKV2 as programmer#13858gschorcht wants to merge 1 commit intoRIOT-OS:masterfrom
Conversation
aabadie
left a comment
There was a problem hiding this comment.
I think this could be done differently, more generically. What do you think ?
| @@ -1,3 +1,6 @@ | |||
| transport select swd | |||
There was a problem hiding this comment.
Maybe this line could simply be moved to https://github.com/RIOT-OS/RIOT/blob/master/makefiles/tools/openocd-adapters/jlink.inc.mk
With a line like:
OPENOCD_ADAPTER_INIT ?= -c 'transport select swd'Other boards like kw41z which can also be flashed using openocd and the jlink adapter could be simplified the same wayl.
Another benefit is that one could also use DEBUG_ADAPTER=dap and a DAPLink programmer without any change in the code to be able to flash the nrf52 boards.
There was a problem hiding this comment.
Any approach that is better than mine is welcome. I'm not familiar with J-Link or any other adapters. The only adapter I have ever used is ST-LINKV2 with nucleo-64 boards. The change I suggested was simply the way I figured out how to use my ST-LINKV2 for the nRF52 board in PR #13860 because it doesn't have a J-Link adapter on the board.
should probably be changed to
OPENOCD_ADAPTER_INIT ?= -c 'source [find interface/jlink.cfg]' -c 'transport select swd'
Right?
I'm just wondering whether all boards that use OpenOCD and J-Link adapter also use SWD.
There was a problem hiding this comment.
Right ?
You got my point :)
I'm just wondering whether all boards that use OpenOCD and J-Link adapter also use SWD.
Good question. In fact, Jlink adapter supports both SWD and JTAG (see here).
But in RIOT, all boards flashed using jlink are using SWD, for the moment. We could have a new make variable for that OPENOCD_JLINK_ADAPTER_TRANSPORT or something like that set by default to swd and handle the possible values (swd/jtag) in jlink.inc.mk. What do you think ?
There was a problem hiding this comment.
Jlink adapter supports both SWD and JTAG
Therefore I was wondering whether all boards use SWD as transport protocol.
We could have a new make variable for that
OPENOCD_JLINK_ADAPTER_TRANSPORTor something like that set by default toswdand handle the possible values (swd/jtag) injlink.inc.mk. What do you think ?
This is the way as it is done in stlink.inc.mk. The question is how we can figure out which boards use or could use jlink and which of them set a transport protocol other than swd, which would then has to be set in the board's Makefile.include. If we suppose that a board could use openocd has to define an openocd.cfg file, the following boards select a certain transport protocol:
boards/mcb2388/dist/openocd.cfg jtag
boards/msba2/dist/openocd.cfg jtag
boards/ek-lm4f120xl/dist/openocd.cfg hla_jtag
boards/common/nrf52/dist/openocd.cfg swd
boards/common/cc26x2_cc13x2/dist/openocd.cfg jtag
boards/common/frdm/dist/openocd-klx.cfg swd
Some of them don't use jlink but dap.
There was a problem hiding this comment.
Most of those don't use DEBUG_ADAPTER though, which means the Makefiles in openocd-adapters/ do no get included.
|
Closed in favor of PR #14480. |
Contribution description
The PR povides a small change in the OpenOCD configuration for nRF52 boards, which allows to use the SWD interface of a ST-LINKV2 in-circuit debugger/programmer to flash nRF52 boards that do not have an on-board programmer.
Testing procedure
Use a ST-LINKV2, connect any nRF52 board and flash any program:
For example, to use the ST-LINKV2 of a STM32 nucleo-64/144 board, the nRF52 board has to be connected as follows:
To use the ST-LINKV2 adapter, the nRF52 board has to be connected as follows:
Issues/PRs references