The Plan:
I needed a USB Generic HID bootloader. After looking at various
'frameworks' and such I could not find what that was small enough, or
was not full of complex conditional compiles of ancient processors,
making the code hard to follow.
In the attached .zip file can be found USB/usb_hid.c that gets as
close to the bare-metal of the Freescale Kinetis KL25 as used on the
Freedom Board, FRDM-KL25Z. No 'frameworks', no GUI, no complex
anything to get in the way of understanding what is going on at the
bare metal USB HID level.
I have included a Windows .exe based demo that controls the LED of
the Freedom Board, and shows a moving gauge when the touch slider on
the Freedom Board is moved. This demo should compile and run fine on
Linux, however I did not test.
This code, as it currently stands, is built up on
https://github.com/payne92/bare-metal-arm and the descriptor
processing code from the LUFA project http://www.lufa-lib.org .
With the GCC compiler setup, compile in the src/ directory as:
make -f usb_demo.mak
The S19 output will be created in a directory called Firmware, a
directory level about the 'src' directory.
This will create a `hid_demo.srec` image file to flash onto the
development board. (If you're using the standard bootloader, plug
SDA USB port to a host computer and then copy the .SREC file to the
FRDM-KL25Z block device.)
If everything is working, the RGB LEB will be steady green when the
board is connected, until the LED_DEMO program starts which will then
turn white. You can access the USB SDA serial port (at 115,200 baud)
and see the USB status messages. Moving the sliders on the PC will
change the LED color on the Freedom board. The touch slider on the
Freedom board will move the gague indicator on the PC.
All via USB HID messages.
The Windows demo code is build with DialogBlocks and the MinGW
compiler.
To make a new project copy usb_demo.mak to new name and change it
accordingly. Replace the bogus USB VID/PID 0xDEAD/0xBEEF with a
valid USB VID/PID before releasing your project to the world.
On the To Do list was:
Pass USB Consortium Compliance Test.
Currently not passing the 'halt' or 'resume' Feature Requests.
Figure out why you have to move the LED slider before the touch
slider shows up in the GUI demo.
Remove dependency on LUFA sources. There are to many headers etc,
needs simplified.
Replace ring.c et.al with cbuf.h .
http://blog.softwaresafety.net/2012/02/even-design-patterns-still-have-bugs.html
Reduce size to well under 4K, for Bootloader.
Complete Bootloader.
Make sure code is MISRA compliant.
Well documented with Doxygen to the same quality level as LUFA.
Compile with other compilers. Modify compiler.h and COMP_xxx
makefiles so source code doesn't need touched, when building with
different compilers.
Put on GitHub.
"If you want to make God laugh, tell Him your plans."
Reality:
My wife committed suicide due to the excruciating headache caused by
a Cerebral Spinal Fluid Leak (CSF or CFSL); Intracranial
Hypotension. She lost her twenty-three year battle with this
disease. In the coming weeks I'll be posting her medical history
at http://www.kpaddock.com so others may learn what we did right and
wrong.
http://blog.softwaresafety.net/2013/08/my-wifes-suicide.html
For now my life is going in a direction I never saw coming.
Rather that let this code bit rot until I can get back to it, I'm
posting in the hopes that others can use what I started.
Please keep us up to date on any progress.
Thank you.
References:
* Bare Metal Arm: https://github.com/payne92/bare-metal-arm
* DialogBlocks: http://www.dialogblocks.com
* Freescale Freedom FRDM-KL25Z: http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=FRDM-KL25Z
* GCC ARM toolchain: https://launchpad.net/gcc-arm-embedded
* MinGW: http://nuwen.net/mingw.html
* Newlib: http://sourceware.org/newlib/
Original Attachment has been moved to: KL25_Generic_HID_Demo.zip