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.
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!
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.
Last commit 29 May 2013 by Paul Griffith
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!