NXP OpenSDA

Overview

OpenSDA is a serial and debug adapter that is built into several NXP evaluation boards. It provides a bridge between your computer (or other USB host) and the embedded target processor, which can be used for debugging, flash programming, and serial communication, all over a simple USB cable.

The OpenSDA hardware features a Kinetis K2x microcontroller with an integrated USB controller. On the software side, it implements a mass storage device bootloader which offers a quick and easy way to load OpenSDA applications such as flash programmers, run-control debug interfaces, serial to USB converters, and more.

Zephyr supports the following debug tools through OpenSDA:

Program the Firmware

Once you’ve selected which debug tool you wish to use, you need to program the associated OpenSDA firmware application to the OpenSDA adapter.

Put the OpenSDA adapter into bootloader mode by holding the reset button while you power on the board. After you power on the board, release the reset button and a USB mass storage device called BOOTLOADER or MAINTENANCE will enumerate. Copy the OpenSDA firmware application binary to the USB mass storage device. Power cycle the board, this time without holding the reset button.

pyOCD

pyOCD is an Open Source python 2.7 based library for programming and debugging ARM Cortex-M microcontrollers using CMSIS-DAP.

Host Tools and Firmware

Follow the instructions in pyOCD Installation to install the pyOCD flash tool and GDB server for your host computer.

Select your board in OpenSDA and download the latest DAPLink firmware application binary. Program the Firmware with this application.

Flashing

Use the CMake flash target with the argument OPENSDA_FW=daplink to build your Zephyr application, invoke the pyOCD flash tool and program your Zephyr application to flash. Some boards set the argument by default, so it is not always necessary to set explicitly.

# On Linux/macOS
cd $ZEPHYR_BASE/samples/hello_world
mkdir build && cd build

# On Windows
cd %ZEPHYR_BASE%\samples\hello_world
mkdir build & cd build

# Use cmake to configure a Ninja-based build system:
cmake -GNinja -DOPENSDA_FW=daplink ..

# Now run ninja on the generated build system:
ninja flash

Debugging

Use the CMake debug target with the argument OPENSDA_FW=daplink to build your Zephyr application, invoke the pyOCD GDB server, attach a GDB client, and program your Zephyr application to flash. It will leave you at a GDB prompt. Some boards set the argument by default, so it is not always necessary to set explicitly.

# On Linux/macOS
cd $ZEPHYR_BASE/samples/hello_world
mkdir build && cd build

# On Windows
cd %ZEPHYR_BASE%\samples\hello_world
mkdir build & cd build

# Use cmake to configure a Ninja-based build system:
cmake -GNinja -DOPENSDA_FW=daplink ..

# Now run ninja on the generated build system:
ninja debug