As many others before me, I am trying to make a custom bootloader (reinventing the wheel, I guess). I have found the same problem as others with the K64 (I am using the K60). My srec lines are not aligned to 16 bytes, and when I write to flash, this causes a hard fault. I need to make my boot loader more robust to handle these situation, but then I found an "easy" answer. I am supposed to be able to put --srec-leg 0x10 in my project flash file settings and have the srec lines aligned to 8 byte lengths. It seems to do something (after experimenting with different lengths), but not fully work correctly. I still have lines in my srec file that are shorter than 16 bytes, like some of the lines below.
If I could make these all be 16 byte lengths, my bootloader would work fine. Is there anything I am doing wrong that would make this feature work correctly? I have attached a snip of my output.