Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp@5:ca9bf0d65cc6, 2018-07-16 (annotated)
- Committer:
- mbed_official
- Date:
- Mon Jul 16 21:15:39 2018 +0100
- Revision:
- 5:ca9bf0d65cc6
- Parent:
- 0:db1600a88ae1
- Child:
- 15:0d8d06c4864d
Print OS version in ld format\
.
Commit copied from https://github.com/ARMmbed/mbed-os-example-sys-info
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| mbed_official | 0:db1600a88ae1 | 1 | #include "mbed.h" |
| mbed_official | 0:db1600a88ae1 | 2 | |
| mbed_official | 0:db1600a88ae1 | 3 | #if !defined(MBED_SYS_STATS_ENABLED) |
| mbed_official | 0:db1600a88ae1 | 4 | #error [NOT_SUPPORTED] test not supported |
| mbed_official | 0:db1600a88ae1 | 5 | #endif |
| mbed_official | 0:db1600a88ae1 | 6 | |
| mbed_official | 0:db1600a88ae1 | 7 | int main() |
| mbed_official | 0:db1600a88ae1 | 8 | { |
| mbed_official | 0:db1600a88ae1 | 9 | mbed_stats_sys_t stats; |
| mbed_official | 0:db1600a88ae1 | 10 | mbed_stats_sys_get(&stats); |
| mbed_official | 0:db1600a88ae1 | 11 | |
| mbed_official | 5:ca9bf0d65cc6 | 12 | printf("Mbed OS Version: %ld \n", stats.os_version); |
| mbed_official | 0:db1600a88ae1 | 13 | |
| mbed_official | 0:db1600a88ae1 | 14 | /* CPUID Register information |
| mbed_official | 0:db1600a88ae1 | 15 | [31:24]Implementer 0x41 = ARM |
| mbed_official | 0:db1600a88ae1 | 16 | [23:20]Variant Major revision 0x0 = Revision 0 |
| mbed_official | 0:db1600a88ae1 | 17 | [19:16]Architecture 0xC = Baseline Architecture |
| mbed_official | 0:db1600a88ae1 | 18 | 0xF = Constant (Mainline Architecture?) |
| mbed_official | 0:db1600a88ae1 | 19 | [15:4]PartNO 0xC20 = Cortex-M0 |
| mbed_official | 0:db1600a88ae1 | 20 | 0xC60 = Cortex-M0+ |
| mbed_official | 0:db1600a88ae1 | 21 | 0xC23 = Cortex-M3 |
| mbed_official | 0:db1600a88ae1 | 22 | 0xC24 = Cortex-M4 |
| mbed_official | 0:db1600a88ae1 | 23 | 0xC27 = Cortex-M7 |
| mbed_official | 0:db1600a88ae1 | 24 | 0xD20 = Cortex-M23 |
| mbed_official | 0:db1600a88ae1 | 25 | 0xD21 = Cortex-M33 |
| mbed_official | 0:db1600a88ae1 | 26 | [3:0]Revision Minor revision: 0x1 = Patch 1. |
| mbed_official | 0:db1600a88ae1 | 27 | */ |
| mbed_official | 0:db1600a88ae1 | 28 | printf("CPU ID: 0x%x \n", stats.cpu_id); |
| mbed_official | 0:db1600a88ae1 | 29 | |
| mbed_official | 0:db1600a88ae1 | 30 | printf("Compiler ID: %d \n", stats.compiler_id); |
| mbed_official | 0:db1600a88ae1 | 31 | |
| mbed_official | 0:db1600a88ae1 | 32 | /* Compiler versions: |
| mbed_official | 0:db1600a88ae1 | 33 | ARM: PVVbbbb (P = Major; VV = Minor; bbbb = build number) |
| mbed_official | 0:db1600a88ae1 | 34 | GCC: VVRRPP (VV = Version; RR = Revision; PP = Patch) |
| mbed_official | 0:db1600a88ae1 | 35 | IAR: VRRRPPP (V = Version; RRR = Revision; PPP = Patch) |
| mbed_official | 0:db1600a88ae1 | 36 | */ |
| mbed_official | 0:db1600a88ae1 | 37 | printf("Compiler Version: %d \n", stats.compiler_version); |
| mbed_official | 0:db1600a88ae1 | 38 | |
| mbed_official | 0:db1600a88ae1 | 39 | return 0; |
| mbed_official | 0:db1600a88ae1 | 40 | } |