6 years, 6 months ago.

Running 2 different .bin codes on MBED

Hi, It's me again. I can't find any good answer in the Questions section, so I'll ask it straight forward. Is it possible to choose which .bin file will execute from MBED? I have 2 tottaly different codes sharing the same hardware. Now, I still have to build the GUI (.NET framework), and I'm wondering if it is possible to choose which code will execute? I have incorporated the extern reset function (so I can reset MBED remotelly from the console). If it is not possible, then I'll have to copy the desired code to the MBED, nad then remotelly reset it to execute the desired code. I know, this is kinda limited to the flash write cycles (abt. 100.000 times), but doing this twice a day it still offers me some years of opperation ;)

Thank you for any suggestion.

Regards.

4 Answers

6 years, 6 months ago.

After a reset mbed will compare the timestamp of the flashed internal bin file with timestamps of bin files found on the local filestore. The file with the most recent timestamp will be loaded if necessary and then executed. So if you manage to update the timestamp of the bin files on the filestore and then perform a reset this will result in the 'most recent' file being executed.

The alternative may be to merge the two programs (assuming they are not larger than 512KB/32KB) into one and run a selection switch at startup of your main based on some value in a configfile in the local file or based on some serial command communication from your GUI. The GUI will have to 1) update the configfile and reset mbed or 2) reset mbed and send the bin selection command.

Accepted Answer
6 years, 6 months ago.

If your mbed will be connected to a PC whilst running, then you could use the touch utility to change the .bin file's timestamp to the current time and date. The touch utility comes as standard with Linux and OS X. Windows versions can be found online.

6 years, 6 months ago.

Ok, I can't Accept both answers, but I can say thank you both. I like the idea to change the timestamp of the binary, but I like the idea to merge the codes more, but I'm affraid, that I'm a little bit limited in my knowledge. I'll have to dig a little bit more, but thak you anyway. Your answers were usefull.

Regards.

6 years, 6 months ago.

I would personally try a function that changes the file extension of the one I wanted mbed to use to .bin and the other to .bxx and do a soft-reset.

Do the opposite when I wanted to run the other.

All done within the code, tied to a physical digital input switch or a soft switch.

Orhan

Orhan, your idea sounds good to. For sure I'll take a try. Thank you.

Regards

posted by Gorazd Rosbach 30 May 2013