Debugging
The Skywire Nano has the ability to be controlled with a debugger, such as a J-Link. The Skywire Nano devkit uses the same on-board debugger as the nRF9160 devkit.
The stack firmware will disable all access to Secure resources from debuggers using the nRF9160's SECUREAPPROTECT bit found in its UICR block. This means that a debugger will not have any access whatsoever to Secure flash, RAM, or peripherals. The Non-Secure resources will still be accessible to debuggers by default, however, as the APPROTECT bit will not come set. This means that a debugger using Non-Secure transfers will be able to interact with Non-Secure resources.
There is a configuration bit that should be used in the AHB-AP register set that indicates to the nRF9160 core that the debugger is acting in either a Secure or Non-Secure context. More information can be found here, under the SProt bit's documentation.
As of version 10.12.0, Nordic's nrfjprog tool does not fully support Non-Secure transaction handling. The NimbeLink SDK provides a flashing utility that will properly handle writing Non-Secure application firmware images to a Skywire Nano.
NimbeLink recommends using GDB Server when debugging, as it is a debug server that consistently successfully connects to the Skywire Nano as a Non-Secure debugger.
In most cases, the best experience will be achieved by first manually flashing your application firmware pre-debugging and then launching your debugger.
SEGGER Embedded Studio (SES)
When using SES, you will need to configure two options for your project: the debug server to use and a "load script". To change these configurations, first right click on your top-level "solution" and then choose "Options...".
To configure the debug server, navigate to:
Debug->Debugger->Target Connection
and change the selection to:
GDB Server
To configure the "load script", navigate to:
Debug->Target Script->Load Begin Script
and change the value to:
CWSys.run("west nano device flash -d ../", true)
TargetInterface.resetAndStop()