It is said that every non-trivial piece of software can be shortened by at least one line of code and the software has at least one bug in it. While the base version of Ruuvi firmware known as “Weather Station” is widely tested with over 2500 users and over 10 000 devices in the field (at the time of writing), introducing new features introduces new bugs.
In general most of these bugs can be analyzed by printing out the relevant variables using NRF_LOG macros sprinkled over the code. To enable these logs, you must set in NRF_LOG_ENABLE 1 in SDK Config file of your project.
To actually read the logs you’ll need the Ruuvi Developer Shield. Once you have RuuviTag connected to the dev shield and the dev shield you can run RTT Viewer available in Segger J-Link software pack to view the log prints.
However, Segger RTT Viewer is not available for Linux. If you’re developing on Linux, you’ll need to take some additional steps to view the log output. Run JLinkExe and connect to your RuuviTag (device NRF52832_XXAA, interface SWD) and then open JLinkRTTClient.
There are cases where printing debug messages just does not cut it. When you need to step through the code and analyze each step to find what is causing the bug, GNU project debugger GDB is an invaluable tool.
To connect GDB you need to connect JLinkDGBServer to the board first with JLinkGDBServer -If SWD -Speed 4000 -Device Cortex-M4. Then you’ll want to start GDB and load debug symbols from your file with arm-none-eabi-gdb _build/test_drivers.out . Replace the .out file to match your application. Finally, Connect GDB Client to GDB Server with target extended localhost:2331 in GDB client.