diff --git a/chester/firmware-sdk/debug.md b/chester/firmware-sdk/debug.md new file mode 100644 index 0000000..9b506ea --- /dev/null +++ b/chester/firmware-sdk/debug.md @@ -0,0 +1,57 @@ +--- +slug: debug +title: Debug +--- +import Image from '@theme/IdealImage'; + +# Debug + +Most of the code is possible to debug with Zephyr logging functions like `LOG_INF`, `LOG_HEXDUMP_INF` and others. + +However, sometimes it is necessary to do proper low-level hardware debugging with single stepping and memory view. + +You can easily do that with [**nRF Connect for VS Code**](https://marketplace.visualstudio.com/items?itemName=nordic-semiconductor.nrf-connect) extension in your VSCode. + +![](debug/debugging.png) + + +## Install + +In VSCode hit `Ctrl` + `P` and type `ext install nordic-semiconductor.nrf-connect`, hit enter. + +## Debugging + +1. Open the **nRF Connect for VS Code** extension, click `Open Existing Application` and choose a folder of the application, where you usually call `west build`. + +![](debug/open-existing-application.png) + +2. In the project `prj.conf` comment with `#` or **remove `CONFIG_CTR_BLE=y`. BLE is timing sensitive and when enabled, debugging don't work correctly.** + +![](debug/disable-ble.png) + +3. In the left panel in **Applications** section, click **+ Add build configuration** + +4. In the **Board** option select `chester_nrf52840`. Set **Optimization level** to **Optimize for debugging (-Og)**. Then click **Build Configuration** button on the bottom. The project is built. + +5. In the left panel in **Actions** click on the **Debug** and start debugging your code. + +:::warning + +Do not use **Erase board** or any other similar option. CHESTER uses UICR region to save serial number and communication keys. If you erase that, you will need to recover [**PIB data**](../developer-tools/command-line-tools.md#product-information-block). + +For erasing the board use [**HARDWARIO CLI**](../developer-tools/command-line-tools.md) erase command which keeps the UICR regions. + +::: + +## Shell over RTT + +In the **Connected devices** left panel, you can open RTT communication with the device. It uses channel 0 which is Zehpyr shell. You can type commands to the terminal. The second RTT channel with logs is not displayed here. + +![](debug/rtt-shell.png) + +## Threads + +In the **NRF DEBUG** tab you can inspect threads and memory. + +![](debug/nrf-debug.png) + diff --git a/chester/firmware-sdk/debug/debugging.png b/chester/firmware-sdk/debug/debugging.png new file mode 100644 index 0000000..c6f901e Binary files /dev/null and b/chester/firmware-sdk/debug/debugging.png differ diff --git a/chester/firmware-sdk/debug/disable-ble.png b/chester/firmware-sdk/debug/disable-ble.png new file mode 100644 index 0000000..4cb18c3 Binary files /dev/null and b/chester/firmware-sdk/debug/disable-ble.png differ diff --git a/chester/firmware-sdk/debug/nrf-debug.png b/chester/firmware-sdk/debug/nrf-debug.png new file mode 100644 index 0000000..6346766 Binary files /dev/null and b/chester/firmware-sdk/debug/nrf-debug.png differ diff --git a/chester/firmware-sdk/debug/open-existing-application.png b/chester/firmware-sdk/debug/open-existing-application.png new file mode 100644 index 0000000..a3219cb Binary files /dev/null and b/chester/firmware-sdk/debug/open-existing-application.png differ diff --git a/chester/firmware-sdk/debug/rtt-shell.png b/chester/firmware-sdk/debug/rtt-shell.png new file mode 100644 index 0000000..8fd880c Binary files /dev/null and b/chester/firmware-sdk/debug/rtt-shell.png differ diff --git a/sidebars-chester.js b/sidebars-chester.js index 0da0f19..98966b7 100644 --- a/sidebars-chester.js +++ b/sidebars-chester.js @@ -126,6 +126,7 @@ const sidebars = { 'firmware-sdk/installation-on-windows', 'firmware-sdk/installation-in-virtualbox', 'firmware-sdk/build-and-deploy', + 'firmware-sdk/debug', 'firmware-sdk/applications', 'firmware-sdk/samples', 'firmware-sdk/application-customization',