Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Debug macros and functions

Debug macros and functions for tracing memory usage for the malloc() and free() functions.

Can also be used to get information about both size and placement of the heap memory.

Macros

#define Insert_label(name)   __asm__ __volatile__ (STRINGZ(name)":");
 This macro is used to insert labels into assembly output. More...
 
#define Uc3_trace(debug_addr, x)
 
#define Uc3_trace_init(debug_addr)   *(U32*)(debug_addr)=debug_addr+4
 These macros are used to add traces memory. More...
 

Functions

U32 get_heap_curr_used_size (void)
 Returns the number of bytes currently used from the HEAP. More...
 
U32 get_heap_free_size (void)
 Returns the number of free bytes in the HEAP. More...
 
U32 get_heap_total_used_size (void)
 Returns the number of total of used bytes allocated from the HEAP. More...
 

Traces function using a round buffer

void uc3_round_trace_init (void *buf, U32 size)
 Initialize the trace using a round buffer. More...
 
void uc3_round_trace (U32 val)
 Trace a data in the round buffer. More...
 

#define Insert_label (   name)    __asm__ __volatile__ (STRINGZ(name)":");

This macro is used to insert labels into assembly output.

#define Uc3_trace (   debug_addr,
 
)
Value:
*(U32*)(*(U32*)(debug_addr) ) = (U32)(x) ;\
*(U32*)(*(U32*)(debug_addr)+4) = 0xdeadbeef ;\
*(U32*)(debug_addr ) = *(U32*)(debug_addr)+4
uint32_t U32
32-bit unsigned integer.
Definition: compiler.h:218
#define Uc3_trace_init (   debug_addr)    *(U32*)(debug_addr)=debug_addr+4

These macros are used to add traces memory.

First, initialize the trace with Uc3_trace_init(pointer), giving the start address of the memory location where will be stored the trace. Use Uc3_trace(something) to store "something" into the memory. The end of the trace is signalled by the "0xdeadbeef" pattern.

U32 get_heap_curr_used_size ( void  )

Returns the number of bytes currently used from the HEAP.

Return values
totalnumber of used bytes.

Referenced by mmi_activity_display().

U32 get_heap_free_size ( void  )

Returns the number of free bytes in the HEAP.

This function tries to allocate the maximum number of bytes by dichotomical method.

Return values
numberof free bytes.

Referenced by mmi_activity_display().

U32 get_heap_total_used_size ( void  )

Returns the number of total of used bytes allocated from the HEAP.

Return values
totalnumber of used bytes.

Referenced by mmi_activity_display().

void uc3_round_trace ( U32  val)

Trace a data in the round buffer.

The end of the trace is signalled by the "0xdeadbeef" pattern.

Parameters
valData to trace;

References round_trace_pbuf.

void uc3_round_trace_init ( void *  buf,
U32  size 
)

Initialize the trace using a round buffer.

Parameters
bufBase address of the buffer used for the trace.
sizeSize of the round buffer. Must be a power of 2.