Is there a detailed description of the bootloader functionality somewhere? I found bits and pieces in several threads but they provided more questions than answers. I am not asking for bootloader code, of course, just general information on how it all works together step by step.
Here is my understanding so far:
- Since MKL02 is not connected to USB data lines (only to sense pin) there is no way for it to communicate with loader software.
- MKL02 chip is connected to JTAG pins of MK20. This allows it to switch MCU into debug/programming mode and upload code into MCU flash.
- Conclusion: MKL02 is not a "bootloader". It is what is usually called "bootstrap", i.e. something that loads startup code into MCU.
If the above is correct then bootloader code gets loaded into MCU and executed. At this time it configures USB entry points, registers itself with USB host (using PJRC-owned device ID) and is available for programming. Here is inconsistency though - on several threads Paul mentioned that entire MCU flash is available for user code. I do not understand how this is possible, unless MKL02 is doing some crazy magic by supplying MCU one command at a time.
And final question - if there is an actual bootloader code that can be uploaded and run on MK20, can that code be loaded into MK20 permanently? With CRP or something to protect PJRC interests.
Now, for the real reason behind these questions. I have a project on backburner that is severely space-constrained. There is no way to fit loader chip on board. An option to buy MK20 pre-programmed with bootloader is very appealing to me.
To preempt suggestions like "write your own bootloader" I'd like to say - not everybody has time and/or (most important) skills for that. Or money to pay USB-IF for vendor ID. No matter how it sounds but people do prefer buying "solutions". In this case the solution is a combination of convenient hardware, reliable bootloader, USB programming + IDs, compatibility with huge volume of existing libraries and (from what I can see so far) great customer relationship and support. I certainly would like to keep all that, except after all testing and debugging is done I have to use different hardware in the final product.
Here is my understanding so far:
- Since MKL02 is not connected to USB data lines (only to sense pin) there is no way for it to communicate with loader software.
- MKL02 chip is connected to JTAG pins of MK20. This allows it to switch MCU into debug/programming mode and upload code into MCU flash.
- Conclusion: MKL02 is not a "bootloader". It is what is usually called "bootstrap", i.e. something that loads startup code into MCU.
If the above is correct then bootloader code gets loaded into MCU and executed. At this time it configures USB entry points, registers itself with USB host (using PJRC-owned device ID) and is available for programming. Here is inconsistency though - on several threads Paul mentioned that entire MCU flash is available for user code. I do not understand how this is possible, unless MKL02 is doing some crazy magic by supplying MCU one command at a time.
And final question - if there is an actual bootloader code that can be uploaded and run on MK20, can that code be loaded into MK20 permanently? With CRP or something to protect PJRC interests.
Now, for the real reason behind these questions. I have a project on backburner that is severely space-constrained. There is no way to fit loader chip on board. An option to buy MK20 pre-programmed with bootloader is very appealing to me.
To preempt suggestions like "write your own bootloader" I'd like to say - not everybody has time and/or (most important) skills for that. Or money to pay USB-IF for vendor ID. No matter how it sounds but people do prefer buying "solutions". In this case the solution is a combination of convenient hardware, reliable bootloader, USB programming + IDs, compatibility with huge volume of existing libraries and (from what I can see so far) great customer relationship and support. I certainly would like to keep all that, except after all testing and debugging is done I have to use different hardware in the final product.