AnsweredAssumed Answered

HID boot loader (referencing AN4764)

Question asked by Mark Butcher on Apr 28, 2014
Latest reply on Jun 11, 2014 by Mark Butcher

Hi All

 

I have been monitoring with interest the new Kinetis boot loader developments and also the HID loader as detailed in the application note AN4764.

For those who don't know it, the AN4764 HID loader is a small piece of code which allows Kinetis (and some other families of devices) to be programmed via USB (HID class) from a small PC application (HIDBootloader.exe), which is included in the software belonging to the application note. The SW includes loaders for a few Kinetis types and these are small, occupying just 4k Flash space.

 

So I decided to see whether it would be difficult to support the Freescale "HIDBootloader.exe" program in the uTasker serial boot loader. After about 4 hours work it was possible to use this program to load any KL or K device.

 

However the idea is not to replace the small 4k HID loader in the AN4764 package but instead to allow it more flexibility (if and when needed). For this reason, and also to make development and maintenance simpler and more efficient, the uTasker OS and generic USB stack was used (the development could also be performed in the uTasker simulator, which made is fast). The result is a bigger code size of about 10k for the HIB loader but with a number of advantages when the code size is not critical:

- builds on all K and KL devices and boards (it also builds in Coldfire V2 projects if of interest)
- builds with GCC, KDS, IAR, Keil, Rowley Crossworks, Atollic, CooCox CoIDE or CodeWarrior 10.x (therefore no missing device/board support)

- automatic program end recognition and application startup, plus adjustable operation displays (like LEDs showing state and SLCD messages, etc.)
- simpler to modify and customise

- can be combined with other loaders (eg. HID loader and SREC and SD-card loader and Web Server loader at the same time, or any other combinations)

These are the code sizes of a few combinations that I checked:

- HID loader alone (10k)               [comparison: - USB-MSD loader 12k]

- HID loader + UART SREC loader (14k)

- HID loader + SD card loader (16k)     [comparison USB-MSD loader + SD card loader 18k]
- HID loader + SD card + UART SREC (20k)

- HID loader + Ethernet Web Server loader (22k)     [comparison - Ethernet Web Server loader alone (16k)]
- HID loader + UART SREC + Ethernet Web Server loader (26k)

 

For anyone interested, I have attached a zip file containing code for the FRDM-KL25Z and TWR-K60F120 (two popular but quite different beasts).

- In the directory FRDM-KL25Z there is an *.imp file for configuring the PC program for the board, plus a boot loader binary for the board and an application that can be loaded via the PC tool. The boot loader shows both HID via USB (for the PC program) and SREC on its UART (via OpenSDA) [short J1-pin 6 to GND to force the boot loader mode at reset]

- In the directory TWR-K60F120 there is an *.imp file for configuring the PC program for the board, plus a boot loader binary for the board and an application that can be loaded via the PC tool. The boot loader shows HID via USB (for the PC programn) plus SREC UART on the tower SER board, as well as Ethernet Web Server loader on address 192.168.0.125. The application (when loaded either using a web browser or the HID loader PC tool will move to IP 192.168.0.3. [hold SW2 to force the boot loader mode at reset]

 

Personally I find combining Ethernet Web server (when the board has Ethernet) and a local method (like HID loading with the Freescale PC program) to be interesting since it gives remote and local loading support. Combining different local methods then caters for personal taste as to which method is preferred.

 

 

Now I am however a little worried about the PC tool. My feeling is that it is probably not going to be further developed due to the newer FSL program that will become available (which I can't get working on my PC yet though) and it presently has a few issues:
- crashes when attempting to delete flash on a board that is not attached
- loads old SREC content if the path is not re-selected when the SREC on disk changes

 

But it is otherwise fast and usable.

 

The final issue that is worrying is that the VID/PID that the connected device uses "should" be configurable in the *.imp file but if any combination apart from Freescale's

VendorID=0x15A2

ProductID=0xFF03

is attempted the program also crashes.

 

This means that I am presently (forced to) setting these values in the HID bootloader.

 

Therefore I would like to ask Freescale whether this is acceptable and/or whether the PC program could be slightly improved to make it a good tool for Kinetis users with an interest in using its capabilities?

 

Thanks!

 

Mark

Original Attachment has been moved to: HID_Loader.zip

Outcomes