6 years, 5 months ago.

K-series bootloader

Can this be 'tweaked' to operate like the LPC11u35 bootloader?

Question relating to:

Example of a Serial bootloader for the K64F platform bootloader, FreescaleIAP, K64F

1 Answer

6 years, 5 months ago.

In theory: Yes. However in practice I think it is going to be a real pain to move the entire USB library manually to the end of the flash memory using those statements. Thats also why it uses a custom Serial interface, which is just a few simple functions. It might be easier to compile it offline with a compiler where you can just move all your code to a region, and then use the same trick of modifying the NMI handler location of new bin files. That will require alot larger bootloader also though (however the K64F for example has plenty of flash).

I found a dirty trick to do this by using the assembler to fill the space between the end of the vectors and FOPT and the start of the .text segment.

Create a new file in your project ending in .s and copy the following in:


                AREA    |.ARM.__at_0x410|, CODE, READONLY 
                FILL    0x6fbf0,0xfeedbeef,4 ; pad to 0x70000 (minus existing RESET from 0 to 0x410)

and replace "0x6fbf0" with the address you want your code to begin at (in this case 0x70000) minus 0x410.

When you build with this file in your project, the space between 0x410 and 0x70000 will be usable for flashing whatever you like. Because the application segment normally starts at 0x410 and the larger Kinetis parts have 2k flash pages, you can use the same trick to push the code for a payload application out to the next page at 0x800.

Of course this results in a .bin that's nearly as large as the total flash space, but there's no way around that.

posted by Andrew Litt 27 Jul 2015