Skip to content

Getting Started: Flashing & Debugging

Flashing

To flash the binary, assuming you went with the SEGGER J-Link

  1. connect the J-Link to your Computer's USB Port and to the device hardware - the hardware needs to be powered up by an external supply, J-Link doesn't provide the supply power itself.
  2. run JLink.exe (or JLinkEXE on MacOSX) and enter connect to connect to the device.
  3. the first time you flash your application, the bootloader needs to be installed: on the JLink Executable's command line enter loadfile [AppName]-[version]-boot.hex - you might need to provide the full path to the hex file here, if it is not in the same path, you started J-Link from
  4. repeat step 3, but with the command loadfile [AppName]-[version].hex
  5. wait for the process to complete and then restart the hardware via JLink Commandline r <Enter>, then g <Enter>
  6. If you want to see log output, open a second terminal window and start JLinkRTTClient(.exe)

Debugging

If you want to debug from your IDE, the binary has to be signed every time before a version is uploaded. The Coldwave OS build system supports this, if you pass the fololowing two variables to CMake:

-DSIGN_AND_UPLOAD=TRUE 	
-DPATH_TO_JLINK_COMMANDER_EXE=<path_to_jlink_executable>

The target you need to select when building your application is [AppName]-[version]-signed You can try, if the automatic signing and uploading works, by calling ninja [AppName]-[version]-signed from within the cmake-build-debug build directory.

INFO

The upload.jlink script in the coldwave-os directory assumes you are using the SWD port of your Cortex-M MCU. If you for some reason prefer JTag, you need to alter the script manually by removing the line si 1 from it.