0
\$\begingroup\$

I have a board that features a Freescale Kinetis K60 MCU and I want to write a bootloader for it but I don't have hardware in place to signal it after a reset to go into "load new firmware" mode vs. "normal operation" mode. What are my alternative possibilities? Can I set a flag in flash to signal the bootloader to enter one or the other mode? How would I do this? Any ideas?

\$\endgroup\$
1
\$\begingroup\$

That really depends on how complex a bootloader you want to write, and what you have in place in the way of communications options.

For example, if the bootloader is using a UART to take in the application code, you could include a minimal console (menu-driven, for simplicity) in the bootloader that allows you to issue various commands, e.g. erase the existing application, start the existing application, or load a new application. Include a startup timeout - if you don't press a key within 3 seconds of boot, it automatically starts the existing application, if there is one, otherwise it stays in the menu waiting for an application to be loaded.

If the bootloader implements a simple, well-documented and widely supported serial file transfer protocol e.g. Y-Modem (yes, Z-modem is far, far better, but it's complicated), then you can upload application binaries from just about any terminal program.

\$\endgroup\$
0
\$\begingroup\$

That's actually pretty simple. The steps are as follows:

  • Define a section for the linker where your special flash page will be stored
  • Make sure that both bootloader and application know about this section

A good example is outlined here: http://mspgcc.sourceforge.net/faq/x71.html, although it's not special for the K60 family.

You will also need to figure out where you are going to place that section. I would reserve one full page near the end of the flash. If this is where your stack is stored, you might want to go forward before that section. Your linker file should tell you about your sections.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.