Skip to main content

Compiling the Software

Prerequisite

Make sure the Toolchain is set up as described.

Build Configurations

ZSWatch supports different board targets and logging transports. You combine them when creating a build.

Board Targets

TargetBoard stringDescription
WatchDKwatchdk@1/nrf5340/cpuappCurrent development kit
ZSWatch Legacy v5zswatch_legacy@5/nrf5340/cpuappLegacy ZSWatch v5 hardware
ZSWatch Legacy v4zswatch_legacy@4/nrf5340/cpuappLegacy ZSWatch v4 hardware
Native simulatornative_sim/native/64Linux simulator, see Native Simulator

Debug Logging

For debug builds, you need a base config (debug.conf) plus a log transport:

TransportKconfig fragmentOverlay neededNotes
UARTdebug.conf, log_on_uart.conflog_on_uart.overlayLogs via serial
RTTdebug.conf, log_on_rtt.conf(none)Logs via SEGGER RTT (needs J-Link)
USBdebug.conf, log_on_usb.conflog_on_usb.overlayLogs via USB CDC ACM

For release builds (no logging, optimized), use release.conf instead of debug.conf.


Building

  1. Open VS Code with the nRF Connect extension.

  2. In the nRF Connect sidebar, under Application, select app.

  3. Click Add build configuration.

    • Target: Select your board (e.g. watchdk@1/nrf5340/cpuapp).
    • Extra Kconfig fragments: Add the config files, e.g.: debug.conf, log_on_uart.conf
    • Extra Devicetree overlays: Add if needed, e.g.: log_on_uart.overlay
    • Build Directory: Optionally name it, e.g. build_devkit.

    For the native simulator (native_sim/native/64), you also need to add under Extra CMake arguments:

    -DSB_CONF_FILE=sysbuild_no_mcuboot_no_xip.conf
  4. Click Generate and Build.


Flashing

Use the nRF Connect extension: Actions → Flash.

When hovering the Flash button, an icon to the right will appear "Erase and Flash to Board". Use it as it will be much faster.


Debugging

For information on debugging, see the Debugging guide.