44 */
55
66#ifndef STATS_REPORT_H
7- #define STATS_REPORT
7+ #define STATS_REPORT_H
88
9+ #include < inttypes.h>
910#include " mbed.h"
1011
1112/* *
@@ -37,19 +38,19 @@ class SystemReport {
3738 mbed_stats_sys_get (&sys_stats);
3839
3940 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 );
4243 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 );
4445
4546 for (int i = 0 ; i < MBED_MAX_MEM_REGIONS; i++) {
4647 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]);
4849 }
4950 }
5051 for (int i = 0 ; i < MBED_MAX_MEM_REGIONS; i++) {
5152 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]);
5354 }
5455 }
5556 }
@@ -104,8 +105,8 @@ class SystemReport {
104105 // Collect and print heap stats
105106 mbed_stats_heap_get (&heap_stats);
106107
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 );
109110 }
110111
111112 /* *
@@ -119,12 +120,12 @@ class SystemReport {
119120 int count = mbed_stats_thread_get_each (thread_stats, max_thread_count);
120121
121122 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 );
128129 }
129130 }
130131};
0 commit comments