mirror of https://github.com/ARMmbed/mbed-os.git
OS version added + CPUID for cortex-M only
CPUID base register is available for Cortex-M processors only. Cortex-A devices have Main ID Register, which can be used in future to get processor info.pull/6821/head
parent
40021eb176
commit
1961428c1b
|
@ -32,7 +32,14 @@ void test_sys_info()
|
||||||
mbed_stats_sys_t stats;
|
mbed_stats_sys_t stats;
|
||||||
mbed_stats_sys_get(&stats);
|
mbed_stats_sys_get(&stats);
|
||||||
|
|
||||||
|
#if defined(MBED_VERSION)
|
||||||
|
TEST_ASSERT_NOT_EQUAL(0, stats.os_version);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__CORTEX_M)
|
||||||
TEST_ASSERT_NOT_EQUAL(0, stats.cpu_id);
|
TEST_ASSERT_NOT_EQUAL(0, stats.cpu_id);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__IAR_SYSTEMS_ICC__)
|
#if defined(__IAR_SYSTEMS_ICC__)
|
||||||
TEST_ASSERT_EQUAL(IAR, stats.compiler_id);
|
TEST_ASSERT_EQUAL(IAR, stats.compiler_id);
|
||||||
#elif defined(__CC_ARM)
|
#elif defined(__CC_ARM)
|
||||||
|
|
|
@ -106,9 +106,12 @@ void mbed_stats_sys_get(mbed_stats_sys_t *stats)
|
||||||
memset(stats, 0, sizeof(mbed_stats_sys_t));
|
memset(stats, 0, sizeof(mbed_stats_sys_t));
|
||||||
|
|
||||||
#if defined(MBED_SYS_STATS_ENABLED)
|
#if defined(MBED_SYS_STATS_ENABLED)
|
||||||
|
#if defined(MBED_VERSION)
|
||||||
|
stats->os_version = MBED_VERSION;
|
||||||
|
#endif
|
||||||
|
#if defined(__CORTEX_M)
|
||||||
stats->cpu_id = SCB->CPUID;
|
stats->cpu_id = SCB->CPUID;
|
||||||
|
#endif
|
||||||
#if defined(__IAR_SYSTEMS_ICC__)
|
#if defined(__IAR_SYSTEMS_ICC__)
|
||||||
stats->compiler_id = IAR;
|
stats->compiler_id = IAR;
|
||||||
stats->compiler_version = __VER__;
|
stats->compiler_version = __VER__;
|
||||||
|
|
|
@ -118,7 +118,8 @@ typedef enum {
|
||||||
* struct mbed_stats_sys_t definition
|
* struct mbed_stats_sys_t definition
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t cpu_id; /**< CPUID Register data */
|
uint32_t os_version; /**< Mbed OS Version (Release only) */
|
||||||
|
uint32_t cpu_id; /**< CPUID Register data (Cortex-M only supported) */
|
||||||
mbed_compiler_id_t compiler_id; /**< Compiler ID \ref mbed_compiler_id_t */
|
mbed_compiler_id_t compiler_id; /**< Compiler ID \ref mbed_compiler_id_t */
|
||||||
uint32_t compiler_version; /**< Compiler version */
|
uint32_t compiler_version; /**< Compiler version */
|
||||||
} mbed_stats_sys_t;
|
} mbed_stats_sys_t;
|
||||||
|
|
Loading…
Reference in New Issue