I'm wondering if anyone has a USB mass storage class bootloader running on the MKL25Z128 processor? If so, can you share some pointers on how to get it working?
I'm running CW 10.4 (on Windows 7) and Freescale's USB stack 4.1.1. When I follow the instructions to build the sample MSC project (located at: C:\Freescale\Freescale USB Stack v4.1.1\Source\Device\app\msd\cw10\kinetis_l2k\.project) it doesn't even build cleanly - I get a long list of pretty serious warnings (pasted at the end of this post). Warnings like "missing braces" simply should not happen; something's broken; my guess is it's probably due to the plethora of #if's that are scattered throughout this USB stack code.
My original plan had been to start with the USB stack, get the MSC example running, then modify it based on (a) the DFU example code (which does flash writing) and (b) the much older Freescale AppNote which talks about a MSC bootloader. I had figured that starting from the most recent USB stack would be a safe bet. But I'm questioning that now.
If anyone has any suggestions I'd appreciate it.
Thanks,
Frank.
========================================
In file included from C:/Freescale/Freescale USB Stack v4.1.1/Source/Device/source/driver/usb_devapi.h:43:0,
from C:/Freescale/Freescale USB Stack v4.1.1/Source/Device/source/common/usb_class.h:46,
from C:/Freescale/Freescale USB Stack v4.1.1/Source/Device/source/common/usb_framework.c:39:
C:/Freescale/Freescale USB Stack v4.1.1/Source/Device/app/msd/cw10/kinetis_l2k/derivative.h:10:0: warning: "LITTLE_ENDIAN" redefined [enabled by default]
C:/Freescale/Freescale USB Stack v4.1.1/Source/Device/source/class/usb_msc_scsi.c:68:7: warning: missing braces around initializer [-Wmissing-braces]
C:/Freescale/Freescale USB Stack v4.1.1/Source/Device/source/class/usb_msc_scsi.c: In function 'msc_read_format_capacity_command':
C:/Freescale/Freescale USB Stack v4.1.1/Source/Device/source/class/usb_msc_scsi.c:1037:5: warning: missing braces around initializer [-Wmissing-braces]
C:/Freescale/Freescale USB Stack v4.1.1/Source/Device/app/msd/cw10/kinetis_l2k/derivative.h:10:0: warning: "LITTLE_ENDIAN" redefined [enabled by default]
C:/Freescale/Freescale USB Stack v4.1.1/Source/Device/app/msd/kinetis_spi/SPI_kinetis.c: In function 'SPI_Receive_byte':
C:/Freescale/Freescale USB Stack v4.1.1/Source/Device/app/msd/kinetis_spi/SPI_kinetis.c:355:10: warning: unused variable 'u8Data' [-Wunused-variable]
C:/Freescale/Freescale USB Stack v4.1.1/Source/Device/app/msd/kinetis_spi/SPI_kinetis.c:59:16: warning: 'gSPI_BaudRate' defined but not used [-Wunused-variable]
C:/Freescale/Freescale USB Stack v4.1.1/Source/Device/app/msd/kinetis_spi/SPI_kinetis.c:60:16: warning: 'gSPI_BeforeTransfDelay' defined but not used [-Wunused-variable]
C:/Freescale/Freescale USB Stack v4.1.1/Source/Device/app/msd/cw10/kinetis_l2k/derivative.h:10:0: warning: "LITTLE_ENDIAN" redefined [enabled by default]
C:/Freescale/Freescale USB Stack v4.1.1/Source/Device/app/msd/kinetis_spi/SD_kinetis.c: In function 'SD_Init':
C:/Freescale/Freescale USB Stack v4.1.1/Source/Device/app/msd/kinetis_spi/SD_kinetis.c:95:6: warning: implicit declaration of function 'Watchdog_Reset' [-Wimplicit-function-declaration]
C:/Freescale/Freescale USB Stack v4.1.1/Source/Device/app/msd/kinetis_spi/SD_kinetis.c: In function 'SD_Card_Info':
C:/Freescale/Freescale USB Stack v4.1.1/Source/Device/app/msd/kinetis_spi/SD_kinetis.c:434:4: warning: implicit declaration of function 'memcpy' [-Wimplicit-function-declaration]
C:/Freescale/Freescale USB Stack v4.1.1/Source/Device/app/msd/cw10/kinetis_l2k/derivative.h:10:0: warning: "LITTLE_ENDIAN" redefined [enabled by default]
C:/Freescale/Freescale USB Stack v4.1.1/Source/Device/app/msd/disk.c: In function 'MSD_Event_Callback':
C:/Freescale/Freescale USB Stack v4.1.1/Source/Device/app/msd/disk.c:169:34: warning: variable 'load_eject_start_ptr' set but not used [-Wunused-but-set-variable]
C:/Freescale/Freescale USB Stack v4.1.1/Source/Device/app/msd/disk.c: In function 'TestApp_Init':
C:/Freescale/Freescale USB Stack v4.1.1/Source/Device/app/msd/disk.c:256:11: warning: variable 'error' set but not used [-Wunused-but-set-variable]
C:/Freescale/Freescale USB Stack v4.1.1/Source/Device/app/msd/cw10/kinetis_l2k/derivative.h:10:0: warning: "LITTLE_ENDIAN" redefined [enabled by default]
C:/Freescale/Freescale USB Stack v4.1.1/Source/Device/app/msd/usb_descriptor.c:424:9: warning: missing braces around initializer [-Wmissing-braces]
C:/Freescale/Freescale USB Stack v4.1.1/Source/Device/app/msd/cw10/kinetis_l2k/derivative.h:10:0: warning: "LITTLE_ENDIAN" redefined [enabled by default]
Hi Frank,
Application Note AN4379 includes the MSD Bootloader for Kinetis K60 device; however, it hasn’t been ported to Kinetis L family yet.
On the following thread you can also find an alternate solution that could help you:
https://community.freescale.com/message/89954
Hope this will be useful for you.
Best regards!
/Carlos
Thanks for the link to uTasker; we're not planning on going that route however.
Hi Frank
OK. Thanks.
To clarify I should point out:
- the uTasker boot loader can be used with any application and so doesn't restrict what solution the application uses.
- it has been optimised for the job so includes code-protection and is slim-line, requiring 13k of space, whereby I think that the MSC demo is 26k in size (optimised for size). I believe that the MSC demo then needs to be modified to work with internal Flash before it can be used as a boot loader. Larger boot loaders reduce the application code size possible for a certain device.
- it has been proven on many Kl and K devices and so requires no further work, although its full source code allows changes to be made if desired.
Regards
Mark