4
4
*/
5
5
6
6
#ifndef STATS_REPORT_H
7
- #define STATS_REPORT
7
+ #define STATS_REPORT_H
8
8
9
+ #include < inttypes.h>
9
10
#include " mbed.h"
10
11
11
12
/* *
@@ -37,19 +38,19 @@ class SystemReport {
37
38
mbed_stats_sys_get (&sys_stats);
38
39
39
40
printf (" =============================== SYSTEM INFO ================================\r\n " );
40
- printf (" Mbed OS Version: %ld \r\n " , sys_stats.os_version );
41
- printf (" CPU ID: 0x%lx \r\n " , sys_stats.cpu_id );
41
+ printf (" Mbed OS Version: %" PRIu32 " \r\n " , sys_stats.os_version );
42
+ printf (" CPU ID: 0x%" PRIx32 " \r\n " , sys_stats.cpu_id );
42
43
printf (" Compiler ID: %d \r\n " , sys_stats.compiler_id );
43
- printf (" Compiler Version: %ld \r\n " , sys_stats.compiler_version );
44
+ printf (" Compiler Version: %" PRIu32 " \r\n " , sys_stats.compiler_version );
44
45
45
46
for (int i = 0 ; i < MBED_MAX_MEM_REGIONS; i++) {
46
47
if (sys_stats.ram_size [i] != 0 ) {
47
- printf (" RAM%d: Start 0x%lx Size: 0x%lx \r\n " , i, sys_stats.ram_start [i], sys_stats.ram_size [i]);
48
+ printf (" RAM%d: Start 0x%" PRIx32 " Size: 0x%" PRIx32 " \r\n " , i, sys_stats.ram_start [i], sys_stats.ram_size [i]);
48
49
}
49
50
}
50
51
for (int i = 0 ; i < MBED_MAX_MEM_REGIONS; i++) {
51
52
if (sys_stats.rom_size [i] != 0 ) {
52
- printf (" ROM%d: Start 0x%lx Size: 0x%lx \r\n " , i, sys_stats.rom_start [i], sys_stats.rom_size [i]);
53
+ printf (" ROM%d: Start 0x%" PRIx32 " Size: 0x%" PRIx32 " \r\n " , i, sys_stats.rom_start [i], sys_stats.rom_size [i]);
53
54
}
54
55
}
55
56
}
@@ -104,8 +105,8 @@ class SystemReport {
104
105
// Collect and print heap stats
105
106
mbed_stats_heap_get (&heap_stats);
106
107
107
- printf (" Current heap: %lu \r\n " , heap_stats.current_size );
108
- printf (" Max heap size: %lu \r\n " , heap_stats.max_size );
108
+ printf (" Current heap: %" PRIu32 " \r\n " , heap_stats.current_size );
109
+ printf (" Max heap size: %" PRIu32 " \r\n " , heap_stats.max_size );
109
110
}
110
111
111
112
/* *
@@ -119,12 +120,12 @@ class SystemReport {
119
120
int count = mbed_stats_thread_get_each (thread_stats, max_thread_count);
120
121
121
122
for (int i = 0 ; i < count; i++) {
122
- printf (" ID: 0x%lx \r\n " , thread_stats[i].id );
123
- printf (" Name: %s \r\n " , thread_stats[i].name );
124
- printf (" State: %ld \r\n " , thread_stats[i].state );
125
- printf (" Priority: %ld \r\n " , thread_stats[i].priority );
126
- printf (" Stack Size: %ld \r\n " , thread_stats[i].stack_size );
127
- printf (" Stack Space: %ld \r\n " , thread_stats[i].stack_space );
123
+ printf (" ID: 0x%" PRIx32 " \r\n " , thread_stats[i].id );
124
+ printf (" Name: %s \r\n " , thread_stats[i].name );
125
+ printf (" State: %" PRIu32 " \r\n " , thread_stats[i].state );
126
+ printf (" Priority: %" PRIu32 " \r\n " , thread_stats[i].priority );
127
+ printf (" Stack Size: %" PRIu32 " \r\n " , thread_stats[i].stack_size );
128
+ printf (" Stack Space: %" PRIu32 " \r\n " , thread_stats[i].stack_space );
128
129
}
129
130
}
130
131
};
0 commit comments