Application Switcher

29 May 2013

Many users have asked if it is possible to run multiple binaries on their mbed. They wish to change the application that runs without needing to connect the mbed to a PC. I was inspired by a recent request and decided to investigate.

The short answer is, yes, it is possible. I have created a simple program to demonstrate how to do it.

Import programAppSwitcher

Run multiple binaries on your mbed.

The gist is as follows:

The binaries are all present on the local filesystem, but are renamed to app1.mbd, app2.mbd and so on. Note that the filenames must conform to the local filesystem's 8+3 filename rule and have an extension other than .bin. Doing this ensures that the files can be accessed by the local filesystem library and that the interface chip does not act upon the binaries.

Another requirement is that all other .bin files must be deleted from the local filesystem. This is necessary because downloaded files will always have more recent timestamps than ones created by the local filesystem.

To switch applications, the current .bin file is deleted, the chosen application file is copied to a .bin and the nR pin is driven low. The interface chip then loads the .bin file into mbed's Flash.

To use the demo, follow the instructions in the program. This will create three "copies" of the application that have different MYNAME strings. A spare I/O pin is used for a reset output. I used pin 9 but another pin may be used. This pin needs to be connected to pin 4 (nR) using a wire jumper.

The program uses the virtual serial port at 9600 baud and has a simple command interpreter. All commands end with <Enter>. The ? command gives a help summary. Use the 1, 2 and 3 commands to switch applications.

Simples!

29 May 2013

Nice program. One of the few poorly documented features of mbed's are talking to the mbed interface chip, you can send a command in software to execute a reset, which should remove the need to connect a pin to the reset pin, see: http://mbed.org/forum/mbed/topic/318/?page=1#comment-1609

29 May 2013

Erik, thanks for the suggestion.

I updated the program to use mbed_reset() and removed the wire jumper. It works OK on my LPC1768 mbed. I don't have any other flavour of mbed to try it on.