9 years, 7 months ago.

Determine if firmware was just replaced?

Hello there,

I'm asking myself if there's a simple way to detect if mbed was reflashed with the last reset?

For sure one could use one of the RTC-registers, initialized with an known value, which probably would be cleared during reflashing - but I don't know if they are really cleared during this process. I'm using one of the RTC-registers to detect a watchdog-reset, as shown in the handbook, but maybe there's already a built-in mechanism to get more info about the actual firmware (perhaps checksum or something similar)? And - if mbed gets a power cycle, you can't say if firmware had been updated or not, using this technique.

I'm thinking about writing some bytes in an unused area of the flash-rom during the first start - or are there already better solutions?

Michael

1 Answer

9 years, 7 months ago.

RTC registers maintain a value through resets, but not power down, unless you have a battery connected.

I'd say the easiest would be to reserve a few bytes in the firmware image for a date or revision number.

Thanks for your response,

yes, maintaining an internal revision number - at least the compiler values date/compile-time could be used (it would be handy to have a simple compile-count variable, maintained by the online-compiler - date/time is not beeing changed with every compiler run, depending of what has changed). But there still is the question if the software has changed, because there's no way to detect if the running version is another than before. I really guess I'll have to save the firmware revision at least on the local filesystem, or flash it somewhere in an unused area during the first start...

posted by Michael Malms 25 Aug 2014