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
Segger J-Link¶
Segger offers firmware running on the OpenSDA platform which makes OpenSDA compatible to J-Link Lite, allowing users to take advantage of most J-Link features like the ultra fast flash download and debugging speed or the free-to-use GDB Server, by using a low-cost OpenSDA platform for developing on evaluation boards.
Host Tools and Firmware¶
Download and install the Segger J-Link Software and Documentation Pack to get the J-Link GDB server for your host computer.
Select your board in OpenSDA and download the Segger J-Link firmware application binary. Program the Firmware with this application.
Flashing¶
The Segger J-Link firmware does not support command line flashing, therefore
the CMake flash
target is not supported.
Debugging¶
Use the CMake debug
target with the argument OPENSDA_FW=jlink
to build
your Zephyr application, invoke the J-Link 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=jlink .. # Now run ninja on the generated build system: ninja debug
Console¶
If you configured your Zephyr application to use a UART console (most boards enable this by default), open a serial terminal (minicom, putty, etc.) with the following settings:
- Speed: 115200
- Data: 8 bits
- Parity: None
- Stop bits: 1
If you configured your Zephyr application to use Segger RTT console instead, open telnet:
telnet localhost 19021 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. SEGGER J-Link V6.14b - Real time terminal output J-Link OpenSDA 2 compiled Feb 28 2017 19:27:57 V1.0, SN=621000000 Process: JLinkGDBServer