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.
S214080CA00000FF1FF8B500BFF8BC08BC9E4670479A
S210080CB0F8B500BFF8BC08BC9E467047AC
S20C080CBCA8F7FF7F0100000005
S208080CC435040800DE
S208080CC811040800FE
S214080CCC000000000000000000000000000000000B
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.