Segger just has released their OpenSDAv2 firmware. The OpenSDAv2 firmware is different from the OpenSDAv1 as it is using a different memory map and bootloader. The OpenSDAv2 e.g. is present on the new FRDM-K64F board. The availability of the Segger firmware is definitely good news for any owner of the FRDM-K64F board: so far only the CMSIS-DAP firmware was available (on top of the mbed bootloader). With this, it was not possible to use the board with CodeWarrior, except with using an external P&E Multilink or Segger J-Link. With that new Segger J-Link OpenSDAv2 firmware, I can now use the FRDM-K64F with any IDE which supports the Segger J-Link :-).
OpenSDA (v1 & v2)
OpenSDAv2 is the ‘second’ generation of debug firmware on Freescale Freedom (and Tower) boards.
OpenSDA is the ‘on board’ debugger provided so no external debug cable is needed The OpenSDA concept has two parts:
- The bootloader on the debug chip (Kinetis K20).
- The firmware/application on top of the bootloader.
The first version (OpenSDAv1) bootloader has been developed by P&E, and is not open source. On top of this bootloader I can load different *.SDA firmware (e.g. P&E OpenSDA, Segger OpenSDA or the ARM CMSIS-DAP). While it is possible to have any kind of applications running on top of the bootloader (e.g. a data logger or something else), the main purpose is running a debug firmware so a debugger can debug the target processor.
The second version (OpenSDAv2) is present on the FRDM-K64F board, and is based on the mbed bootloader and is open source. As the bootloader is different, and the memory mapping too, the OpenSDAv1 applications do not run on top of the mbed bootloader. Even more, as the OpenSDAv1 accepts S19 files, but the OpenSDAv2 bootloader only accepts binary files (see “Binary Files for the mbed Bootloader with Eclipse and GNU ARM Eclipse Plugins“). Up to now the only available OpenSDAv2 firmware is the mbed CMSIS-DAP one (see “mbed CMSIS-DAP“).
Now there is an alternative: The Segger J-Link OpenSDAv2 firmware 🙂
❗ Update: the latest USBDM (http://usbdm.sourceforge.net/USBDM_V4.10/Freedom/html/index.html) has suppport for OpenSDAv2 included too.
- Go to http://www.segger.com/opensda.html and scroll to the end of the page with the OpenSDAv2 section and download the firmware. NOTE that you need the V2.0 (V2) for K64F, *not* the V2.1.!
- Unpack the content of the zip file (JLink_OpenSDA_V2.bin).
- Power the board withtheOpenSDAv2 USB connector while having the reset button pressed.
- Release the reset button,the greenOpenSDAv2 LED shall blink (about 1 Hz).
- OpenSDAv2 LED
- TheboardenumeratesasBOOTLOADER device.
- Copy (drag&drop) the JLink_OpenSDA_V2.bin to the BOOTLOADER device.
- After the file is copied, the green OpenSDAv2 LED will blink fast (about 5 Hz).
- Unplug the board and power it again.
- Newdriverswill be installed automatically, and device will show up as J-Link.
- The firmware includes a USB CDC virtual COM port, which gets automatically installed too:
That’s it. With this, the board looks like a normal Segger J-Link for the debugger.
Comparison OpenSDAv2: Segger J-Link vs. mbed CMSIS-DAP
With the availability of the Segger J-Link firmware for OpenSDAv2, there is a true alternative to the mbed CMSIS-DAP firmware.
❗ The mbed CMSIS-DAP firmware so far was not very robust (even caused my FRDM-K64F board to be blocked several times, see “Recovering FRDM-K64F mbed Board“). There is now a new mbed CMSIS-DAP firmware 0202 available which seems to solve these issues: http://mbed.org/handbook/Firmware-FRDM-K64F
Below is a comparison of the two debug options for the FRDM-K64F board with OpenSDAv2. I have used Eclipse with Segger GDB and OpenOCD with CMSIS-DAP.
💡 P&E has provided a OpenSDAv2 firmware at FTF for hands-on-classes using the FRDM-K64F board. As this firmware is (not yet) officially available, I have not compared it in the table below.
|mbed CMSIS-DAP||Segger J-Link OpenSDAV2|
|1. Debug Speed||1.8 kByte/sec||40 KByte/sec|
|2. MSD Bootloader||yes||no|
|3. USB CDC Bridge||yes||yes|
|4. Number of Breakpoints||limited by hardware||(unlimited)|
|5. Open Source||yes||no|
|6. Debug other boards||yes||(no)|
|7. Semihosting||yes (29 bytes/sec)||yes (500 bytes/sec)|
|8. Debug Stepping||fair||fast|
|9. IDE’s||mbed, Keil, IAR, KDS, … (CMSIS-DAP)||CodeWarrior, Eclipse, Keil, IAR, KDS, … (Segger J-Link)|
Comments to the entries above:
- Measured the time from the start of ‘debug’ until reaching main(). The mbed CMSIS-DAP failed for my test application (120 KByte code) and locked constantly my board. Loading smaller applications worked, but would not be comparable (mbed CMSIS-DAP needed 1.7 seconds for launching a 1.5 KByte application). With the MSD bootloader it took 6 secondes (20 KByte/second). In general mbed is expected to be slow as it is using USB HID class for download/debugging which is not fast.
- Segger J-Link firmware has no MSD Bootloader implemented.
- Both have USB-CDC bridge/virtual implemented. I prefer the Segger one because the mbed one needs a special driver, and can only be installed with the board plugged into the host computer.
- mbed is limited to the number of hardware breakpoints (6 for K64F), while Segger offers ‘unlimited’ FLASH breakpoints. The ‘unlimited’ number of breakpoints is sold separately, but available for ‘evaluation’ in the OpenSDA firmware. This feature is essential e.g. for Kinetis-L where there are only two hardware breakpoints.
- mbed is open source, while Segger is closed source.
- The Segger licensing terms forbid to use the firmware to debug an external board (while it would be technically possible). Mbed does not have this limitation.
- Tested with writing 2000 characters using semihosting. Special care needs to be taken as for the mbed case with no debug connection this effectively locked the board.
- Tested with stepping through the code. While with Segger stepping is instantly, with mbed CMSIS-DAP there is a small delay between steps. This is a general reflection how fast the connection is.
- CMSIS-DAP is not supported by CodeWarrior, so for anyone who wants to use CodeWarrior, then the choice is the Segger Firmware. If using the mbed compiler/IDE, as this does not have debugging capabilites, then the mbed CMSIS-DAP firmware is needed as it offers the MSD bootloader. To use CMSIS-DAP with Eclipse on Windows, it needs OpenOCD. However, such an OpenOCD binary is not available (yet).
For anyone interested in serious development with Eclipse and OpenSDAv2, with the availability of the Segger OpenSDAv2 firmware there is finally something which can be used in ‘real’ development: it is fast, easy to use and matches the professional tools Segger provides. mbed and CMSIS-DAP on the other side is just at the beginning of a journey, and very likely will mature and get better over time. mbed has the bonos of open source and that it is pushed by ARM. The Segger firmware lacks the MSD bootloader, but for me this is not a critical item anyway. So as for myself, using mainly Eclipse and CodeWarrior, the Segger J-Link OpenSDAv2 firmware is my choice. Of course until something better shows up 🙂
Happy Seggering 🙂