David Brown

OpenOCD with Kinetis

Discussion created by David Brown on Jun 18, 2015

Hi,

 

I find OpenOCD along with an FTDI-based JTAG debugger to be the most convenient way to do debugging with Kinetis devices.  Compared to a P&E Micro debugger, it is more reliable, faster to use, more flexible, does not require extra licensed software, and works fine on Windows and Linux systems.  And as well as being useful for development, it can be integrated in test benches and automated for production test and programming.  It is even simple to add an FTDI device to your board and give yourself a built-in debugger.

 

However, Freescale seem to be working hard to make the whole process more difficult than necessary.  Key issues I have are:

 

1. KDS comes with a heavily patched OpenOCD, based on version 0.8.0.  OpenOCD development has continued in the meantime, with 0.9.0 being released recently.  But because the Freescale developers have kept these patches out of the main OpenOCD project, other OpenOCD users can't benefit from Freescale's patches, KDS users can't benefit from improvements to OpenOCD, and the Freescale developers will have to duplicate their efforts in order to catch up.  Many of the changes Freescale made to 0.8.0 are to support newer Kinetis parts, such as the K64.

 

2. Kinetis chips have the flash security flag activated by a mass erase, rather than by programming a security flag.  This is a seriously inconvenient way to handle security, especially since (in our experience) half the chips shipped by Freescale are delivered "secure".  Unlocking a chip is complicated, uses non-standard extensions to the ARM JTAG debugging, and on earlier Kinetis chips does not work reliably using the documented procedures.  (At least the procedures are documented.)

 

3. OpenOCD supports the unlock procedure - in version 0.9.0.  So a K64 user can choose between standard OpenOCD that doesn't support the K64, or Freescale's OpenOCD that doesn't support unlocking secure devices.

 

4. The build of OpenOCD that ships with KDS for Linux supports a wide variety of debugger interfaces, and works out of the box.  The binary build that ships with the Windows version of KDS supports only one interface - cmsis-dap - as used on Freescale's own boards.  Is it too much to ask that the Freescale folks doing the Windows build add a "--enable-ftdi" configuration flag and thereby allow Windows KDS users easy access to dozens of cheap debuggers?  Compiling OpenOCD on Windows is possible, but it's a lot of work and inconvenience.

 

Freescale gets bonus points for making their patches and source code (to OpenOCD, gcc, libusb, etc.) conveniently and easily available.  (The GPL license dictates that the source be available, but not that it has to be so conveniently available.)  But the whole system would be greatly improved if they worked closer with the upstream developers of OpenOCD and contributed to the project there, rather than keeping their own patches.  That would be better for KDS users, the Freescale developers, the OpenOCD developers, and anyone using Kinetis with different toolchains or setups.

 

David

Outcomes