mirror of https://github.com/ARMmbed/mbed-os.git
Add RAM/ROM memory statistics to system stats structure
Internal RAM / ROM memory size and start address of target can be fetched using `mbed_stats_sys_get()` API.pull/8607/head
parent
1627968bcb
commit
ad736e9894
|
@ -131,6 +131,35 @@ void mbed_stats_sys_get(mbed_stats_sys_t *stats)
|
|||
|
||||
#if defined(MBED_SYS_STATS_ENABLED)
|
||||
stats->os_version = MBED_VERSION;
|
||||
stats->ram_start[0] = MBED_RAM_START;
|
||||
stats->ram_size[0] = MBED_RAM_SIZE;
|
||||
stats->rom_start[0] = MBED_ROM_START;
|
||||
stats->rom_size[0] = MBED_ROM_SIZE;
|
||||
#if defined(MBED_RAM1_START) && defined(MBED_RAM1_SIZE)
|
||||
stats->ram_start[1] = MBED_RAM1_START;
|
||||
stats->ram_size[1] = MBED_RAM1_SIZE;
|
||||
#endif
|
||||
#if defined(MBED_RAM2_START) && defined(MBED_RAM2_SIZE)
|
||||
stats->ram_start[2] = MBED_RAM2_START;
|
||||
stats->ram_size[2] = MBED_RAM2_SIZE;
|
||||
#endif
|
||||
#if defined(MBED_RAM3_START) && defined(MBED_RAM3_SIZE)
|
||||
stats->ram_start[3] = MBED_RAM3_START;
|
||||
stats->ram_size[3] = MBED_RAM3_SIZE;
|
||||
#endif
|
||||
#if defined(MBED_ROM1_START) && defined(MBED_ROM1_SIZE)
|
||||
stats->rom_start[1] = MBED_ROM1_START;
|
||||
stats->rom_size[1] = MBED_ROM1_SIZE;
|
||||
#endif
|
||||
#if defined(MBED_ROM2_START) && defined(MBED_ROM2_SIZE)
|
||||
stats->rom_start[2] = MBED_ROM2_START;
|
||||
stats->rom_size[2] = MBED_ROM2_SIZE;
|
||||
#endif
|
||||
#if defined(MBED_ROM3_START) && defined(MBED_ROM3_SIZE)
|
||||
stats->rom_start[3] = MBED_ROM3_START;
|
||||
stats->rom_size[3] = MBED_ROM3_SIZE;
|
||||
#endif
|
||||
|
||||
#if defined(__CORTEX_M)
|
||||
stats->cpu_id = SCB->CPUID;
|
||||
#endif
|
||||
|
|
|
@ -38,6 +38,9 @@ extern "C" {
|
|||
#define MBED_THREAD_STATS_ENABLED 1
|
||||
#endif
|
||||
|
||||
/** Maximum memory regions reported by mbed-os memory statistics */
|
||||
#define MBED_MAX_MEM_REGIONS 4
|
||||
|
||||
/**
|
||||
* struct mbed_stats_heap_t definition
|
||||
*/
|
||||
|
@ -144,6 +147,10 @@ typedef struct {
|
|||
uint32_t cpu_id; /**< CPUID register data (Cortex-M only supported) */
|
||||
mbed_compiler_id_t compiler_id; /**< Compiler ID \ref mbed_compiler_id_t */
|
||||
uint32_t compiler_version; /**< Compiler version */
|
||||
uint32_t ram_start[MBED_MAX_MEM_REGIONS];/**< Start addresses of all internal RAM memories */
|
||||
uint32_t ram_size[MBED_MAX_MEM_REGIONS];/**< Size of all internal RAM memories in target */
|
||||
uint32_t rom_start[MBED_MAX_MEM_REGIONS];/**< Start addresses of all internal ROM memories */
|
||||
uint32_t rom_size[MBED_MAX_MEM_REGIONS];/**< Size of all internal ROM memories in target */
|
||||
} mbed_stats_sys_t;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue