7 years, 3 months ago.

How can you find out the revision of mbed-os5 inside an application?

Thanks

2 Answers

7 years, 3 months ago.

Hey, if you are using a release branch, you can find them in these macros - https://github.com/ARMmbed/mbed-os/blob/mbed-os-5.5/mbed.h#L23-L25

Accepted Answer

Thanks Sarah, Why are none of these items defined?

#if MBED_CONF_RTOS_PRESENT

// RTOS present, this is valid only for mbed OS 5

#define MBED_MAJOR_VERSION 5

#define MBED_MINOR_VERSION 5

#define MBED_PATCH_VERSION 5



#else

// mbed 2

#define MBED_MAJOR_VERSION 2

#define MBED_MINOR_VERSION 0

#define MBED_PATCH_VERSION MBED_LIBRARY_VERSION

#endif
posted by Kevin Braun 19 Aug 2017

They are defined after the "MBED_..." string name.

So the mbed.h file Sarah linked has the Mbed OS version 5.5, so the MBED_MAJOR_VERSION is 5 and the MBED_MINOR_VERSION is 5 for 5.5. Then there's a patch version (MBED_PATCH_VERSION).

posted by Jenny Plunkett 19 Aug 2017

I got that Jenny,

The problem is that the items MBED_MAJOR_VERSION, MBED_MINOR_VERSION and MBED_PATCH_VERSION come up as undefined in the compiler.

posted by Kevin Braun 21 Aug 2017

Yes, I believe that the online compiler uses the "latest" branch by default, which does not contain these macros. You will have to import mbed OS from a release branch -https://github.com/ARMmbed/mbed-os/releases.

posted by Sarah Marsh 22 Aug 2017

I am using the CLI / off-line compiler. I also imported mbed-os from the link you provided. Still, the #defines are not there

posted by Kevin Braun 24 Aug 2017

That link is used to show all the release branches. You will need to switch to one of those branches, like so:

mbed import mbed-os

cd mbed-os

mbed update mbed-os-5.5.5

posted by Sarah Marsh 24 Aug 2017

Thanks Sarah,

The "mbed update mbed-os-5.5.5" did the trick!!

So, any mbed library older will not work, correct?

posted by Kevin Braun 25 Aug 2017

No, only the release branches linked here - https://github.com/ARMmbed/mbed-os/releases - will work.

posted by Sarah Marsh 28 Aug 2017
7 years, 3 months ago.

Hi Kevin,

I usually navigate into the directory of a cloned Mbed OS application repository on my computer. For example...

cd mbed-os-example-blinky
cd mbed-os
git log

The git log inside of the mbed-os directory allows you to view the commit history of the mbed OS you currently have cloned locally. The very top line will tell you which revision of Mbed OS you are using to compare against https://github.com/armmbed/mbed-os

commit db4be94693c3a873cfa0c025a5ad2e62b86a8474

Let me know if you have any questions!

- Jenny, team mbed

How would I check inside an embedded application, like inside a printf statement?

posted by Kevin Braun 18 Aug 2017