Swiss Army Knife of Terminal Program for Serial Bootloaders

A bootloader shall be small and concise. I very much like bootloaders which do not need a ‘special’ program on the host, so I prefer a simple terminal for this. While porting my serial bootloader to the NXP FRDM-K64F board, I have found RealTerm which offers a lot of cool features:

RealTerm

RealTerm

The RealTerm terminal program can be downloaded from SourceForge here:  http://realterm.sourceforge.net/. (download page: https://sourceforge.net/projects/realterm/files/). I’m using the version 2.0.00.70.

Loading S-Record Files

In my serial bootloader, I use the shell command

BL load s19

to load a S19 (S-Record) file. The bootloader expects a normal S19 ASCII file, so I could type that file in if I wish ;-).

Much easier is to use the ability to send that file from the terminal. The problem is usually as the bootloader is only using RX and TX, there is no hardware flow control. A solution would be to use software flow control (XON/XOFF), but my experience is that this did not work out great.

What worked very well is to have the ability to slow down the sending with delays. And here RealTerm has two settings: A delay (ms) for each character sent, and a delay for each line:

Delay Settings

Delay Settings

Of course there are more advanced ways to deal with the missing flow control problem, but this approach is very simple and does not need any overhead in the bootloader.

FRDM-K64F Bootloader

The original bootloader (see “Serial Bootloader for the Freedom Board with Processor Expert“) is now ported to Kinetis Design Studio and FRDM-K64F board. It uses now a simple buffering for a flash page to cut programming time.

FRDM Shell Bootloader Commands

FRDM Shell Bootloader Commands

If you want to have a look at the updated serial bootloader for the NXP K64F (FRDM-K64F board), it is on GitHub.

You can try the bootloader with the example blinky project wich is in GitHub.

 💡 If using a OpenSDA USB CDC connection (Serial over USB), make sure you use the latest OpenSDA firmware, e.g. Segger J-Link OpenSDA Firmware with Virtual MSD. Earlier OpenSDA firmware has the issue that characters might be lost during transmission.

Summary

RealTerm is a powerful open source terminal program suitable for serial bootloaders. It has many features, and I love the most the ability to configure the file sending functionality.

Happy Loading 🙂

Links

Advertisements

8 thoughts on “Swiss Army Knife of Terminal Program for Serial Bootloaders

  1. I would really like to implement this on the KV31F, but many of the included components do not support it. Do you have any suggestions for how I could go about this?

    Like

  2. Hi Erich

    There is a little bug on function _CLS1_IterateTable.I have changed it

    {

    uint8_t res = ERR_FAILED;
    if (parserTable==NULL) { /* no table??? */
    return ERR_FAILED;
    }
    if (io==NULL) { /* no IO handler??? */
    return ERR_FAILED;
    }
    /* iterate through all parser functions in table */
    while(*parserTable!=NULL) {

    if ((*parserTable)(cmd, handled, io)==ERR_OK) {

    res = ERR_OK;
    }

    parserTable++;
    }
    return res;
    }

    Like

    • Hmm, what is the use case which causes a problem for you? maybe I don’t see it?

      I have the following:

      uint8_t res = ERR_OK;

      if (parserTable==NULL) { /* no table??? */
      return ERR_FAILED;
      }
      if (io==NULL) { /* no IO handler??? */
      return ERR_FAILED;
      }
      /* iterate through all parser functions in table */
      while(*parserTable!=NULL) {
      if ((*parserTable)(cmd, handled, io)!=ERR_OK) {
      res = ERR_FAILED;
      }
      parserTable++;
      }
      return res;

      It returns an error code (ERR_FAILED) if at least on of the parsers returned an error. The fact that no parser is handling the command is checked with the ‘handled’ parameter.
      I’m missing somehing?
      Thanks,
      Erich

      Like

      • Hi Erich,

        This is the output with your previous code:

        Boot> help

        ————————————————————–
        My Project Name
        ————————————————————–
        CLS1 ; Group of CLS1 commands
        help|status ; Print help or status information
        echo (on|off) ; Turn echo on or off
        BL ; Group of Bootloader commands
        help|status ; Print help or status information
        erase ; Erase application flash blocks
        restart ; Restart application with jump to reset vector
        load s19 ; Load S19 file
        *** Failed or unknown command: help
        *** Type help to get a list of available commands
        Boot>
        Boot> BL erase
        Erasing application flash blocks…done!
        *** Failed or unknown command: BL erase
        *** Type help to get a list of available commands
        Boot>

        Like

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s