Debugging Hexiwear in Linux

Debugging Hexiwear in Linux

Go checkout the Hexiwear IoT Platform if you haven't, its one small device with a load of sensors! Its basically a development platform, focusing the IoT world. I recently happen to come across one, and wanted to flash/debug the stuff, but had some issue with it. Here I describe a quickfix for that!

Official IDE

Kinetis Design Studio is supported by NXP on Linux, Mac and Windows, but they have little interest in fixing issues with anything other than Windows. KDS is an modified version of the famous Eclipse IDE. Through this software, you should be able to debug the Hexiwear using the basedboard provided in the Hexiwear IoT Kit.

Debug Hardware

The baseboard for Hexiwear comes with an OpenSDA based debug adapted circuit, which connects to your computer through USB. The firmware running on this OpenSDA adapted is DAPLink. It is an open source project that implements the logic for debugging ARM Cortex series microcontrollers. A combination of these, makes the baseboard show up as USB Communication Class device, or basically a UART device at /dev/ttyACM0 or likewise.

Debug Software

From your computer, you should use pyOCD to debug/flash the firmware you generate for the Hexiwear. Once you follow the Getting Started Guide from Hexiwear, you will have pyOCD configuration ready in the Debug Configurations within KDS.

The Problem

So once you start the debug, you will face strange errors, with pyOCD. The problem is that KDS tries to start pyOCD as normal user, while it requires elevated privileges to read a specific parameter from USB device connected to it. Being run as normal user, without enough previleges, the tool gives up, and cannot debug anymore.

The Solution

After some tinkering the pyOCD, I've found a hack to make it work without root privileges. I've submitted a pull request to pyOCD. Until its accepted, you can find you solution in my fork of pyOCD.

All you need to do as of now, is to install my version of pyOCD rather than the official version. Once you do that, Debug should work like a charm!

Related Article