For nRF52 J-Link was intended to be preferred as programmer over OpenOCD
when both are available, but falling back to OpenOCD when JLinkExe is
not found in `$PATH`. However, there was call the shell missing to
actually detect `JLinkExe`.
Replace `$(RIOTBOARD)/$(BOARD)` with `$(BOARDDIR)`, which also works for
external boards. This allows external boards to build on top of
`$(RIOTBOARD)/common/nrf52`.
nrf52 includes include $(RIOTBOARD)/$(BOARD)/Makefile.dep to know
if `nordic_softdevice_ble` is used, this changes dependency
resolution sinnce -include $(APPDIR)/Makefile.board.dep should
be resolved before.
This can be removed once #9913 is if `nordic_softdevice` is
deprecated.
cpu/$(CPU)/Makefile.features and cpu/$(CPU)/Makefile.dep are
automatically included
Part of moving CPU/CPU_MODEL definition to Makefile.features to have it
available before Makefile.include.
Enable the handling of flashing `softdevice.hex` when flashing the firmware
for openocd.
However, for flashing, only the `hexfile` and `binfile` can currently be used.
The `elffile` is generated with local pages aligned to `0x10000` which makes
the program starting at `0x1f000` be flashed from `0x10000` with padding bytes
even if the `.text` section is indeed at `0x1f000`:
readelf --sections bin/nrf52dk/gnrc_networking.elf
...
[ 1] .text PROGBITS 0001f000 00f000 00f698 00 AX 0 0 16
...
readelf --segments bin/nrf52dk/gnrc_networking.elf
...
LOAD 0x000000 0x00010000 0x00010000 0x1e6a0 0x1e6a0 R E 0x10000
...
The padding bytes would go through `verify_image` in `openocd` so be expected
to not be overwritten but are by `softdevice.hex`
Using --nmagic at link time removes the local page alignement but would
need dedicated testing.
softdevice needs the memory at 0x2000 to be initialized to 0xffffffff
according to #5893 and testing. However, the addresses [0x8bc, 0x3000[ are not
set in softdevice.hex.
So use a modified hex file with all the memory set to 0xff as it is the rom
reset value anyway.
This change updates the `.hex` file instead on relying on erasing the
memory.
When running tests using 'nordic_softdevice_ble', the 'softdevice.hex'
file must also be taken into account for the test hashing and be
uploaded to the separated murdock testing boards.
When listed as dependency from `test-input-hash` the file must have a
target, which he has not. The file is implicitly created when compiling
`ELFFILE` so declare it as order only dependency.
In practice `BASELIBS` could be enough or even `pkg-build-softdevice`
but I do not want to be depend that much on internals there.