@ -378,6 +378,28 @@ void Util::dma_info(ExpandingString &str)
@@ -378,6 +378,28 @@ void Util::dma_info(ExpandingString &str)
}
# endif
# if CH_CFG_USE_HEAP == TRUE
/*
return information on heap usage
*/
void Util : : mem_info ( ExpandingString & str )
{
memory_heap_t * heaps ;
const struct memory_region * regions ;
uint8_t num_heaps = malloc_get_heaps ( & heaps , & regions ) ;
str . printf ( " MemInfoV1 \n " ) ;
for ( uint8_t i = 0 ; i < num_heaps ; i + + ) {
size_t totalp = 0 , largest = 0 ;
// get memory available on main heap
chHeapStatus ( i = = 0 ? nullptr : & heaps [ i ] , & totalp , & largest ) ;
str . printf ( " START=0x%08x LEN=%3uk FREE=%6u LRG=%6u TYPE=%1u \n " ,
unsigned ( regions [ i ] . address ) , unsigned ( regions [ i ] . size / 1024 ) ,
unsigned ( totalp ) , unsigned ( largest ) , unsigned ( regions [ i ] . flags ) ) ;
}
}
# endif
# if HAL_ENABLE_SAVE_PERSISTENT_PARAMS
static const char * persistent_header = " {{PERSISTENT_START_V1}} \n " ;
@ -485,6 +507,4 @@ void Util::apply_persistent_params(void) const
@@ -485,6 +507,4 @@ void Util::apply_persistent_params(void) const
unsigned ( count ) , unsigned ( errors ) ) ;
}
}
# endif // HAL_ENABLE_SAVE_PERSISTENT_PARAMS