Orbcode Trace functions library
Classes | Macros | Enumerations | Functions
Instrumentation Trace Macrocell

Configure ITM for passthrough of DWT messages and user-defined output through stimulus ports. More...

Classes

struct  ITMOptions
 ITM configuration options. More...
 

Macros

#define ITM_ENABLE_STIMULUS_PORTS_ALL   0xFFFFFFFF
 Enable all ITM stimuls ports. More...
 

Enumerations

enum  ITMGlobalTimestampFrequency { ITMGlobalTimestampFrequencyDisabled = 0 , ITMGlobalTimestampFrequencyPosition7 = 1 , ITMGlobalTimestampFrequencyPosition13 = 2 , ITMGlobalTimestampFrequencyIfOutputFIFOEmpty = 3 }
 Global timestamp frequency. More...
 
enum  ITMLocalTimestampPrescaler { ITMLocalTimestampPrescalerNoPrescaling = 0 , ITMLocalTimestampPrescalerDivideBy4 = 1 , ITMLocalTimestampPrescalerDivideBy10 = 2 , ITMLocalTimestampPrescalerDivideBy64 = 3 }
 Local timestamp frequency. More...
 

Functions

static void ITMSetup (const ITMOptions *options)
 Configures ITM as requested. More...
 
static bool ITMIsPortEnabled (uint8_t port)
 Checks if stimulus port is enabled. More...
 
static void ITMWrite8 (uint8_t port, uint8_t c)
 Writes 8-bit value to stimulus port. More...
 
static void ITMWrite16 (uint8_t port, uint16_t value)
 Writes 16-bit value to stimulus port. More...
 
static void ITMWrite32 (uint8_t port, uint32_t value)
 Writes 32-bit value to stimulus port. More...
 
static void ITMWriteBuffer (uint8_t port, const void *buffer, size_t size)
 Writes buffer to stimulus port. More...
 

Detailed Description

Configure ITM for passthrough of DWT messages and user-defined output through stimulus ports.

Instrumentation Trace Macrocell provides following capabilites:

Reference: ARMv7-M Architecture Reference Manual, chapter C1.7 The Instrumentation Trace Macrocell

Macro Definition Documentation

◆ ITM_ENABLE_STIMULUS_PORTS_ALL

#define ITM_ENABLE_STIMULUS_PORTS_ALL   0xFFFFFFFF

Enable all ITM stimuls ports.

Set as value of ITMOptions::EnabledStimulusPorts to enable all available stimulus ports.

Enumeration Type Documentation

◆ ITMGlobalTimestampFrequency

Global timestamp frequency.

See ITMOptions::GlobalTimestampFrequency for more details

◆ ITMLocalTimestampPrescaler

Local timestamp frequency.

See ITMOptions::LocalTimestampPrescaler for more details

Function Documentation

◆ ITMSetup()

void ITMSetup ( const ITMOptions options)
inlinestatic

Configures ITM as requested.

Note that there is no validation if specified configuration is valid (e.g. timestamp prescaler values) and there are no checks to verify MCU capabilities (enabling timestamp when it is not implemented).

Parameters
optionsITM configuration

◆ ITMIsPortEnabled()

bool ITMIsPortEnabled ( uint8_t  port)
inlinestatic

Checks if stimulus port is enabled.

Parameters
portPort to check
Returns
true Port is enabled
false Port is disabled (or not available)

◆ ITMWrite8()

void ITMWrite8 ( uint8_t  port,
uint8_t  c 
)
inlinestatic

Writes 8-bit value to stimulus port.

Parameters
portPort
cValue to be written

◆ ITMWrite16()

void ITMWrite16 ( uint8_t  port,
uint16_t  value 
)
inlinestatic

Writes 16-bit value to stimulus port.

Parameters
portPort
valueValue to be written

◆ ITMWrite32()

void ITMWrite32 ( uint8_t  port,
uint32_t  value 
)
inlinestatic

Writes 32-bit value to stimulus port.

Parameters
portPort
valueValue to be written

◆ ITMWriteBuffer()

void ITMWriteBuffer ( uint8_t  port,
const void *  buffer,
size_t  size 
)
inlinestatic

Writes buffer to stimulus port.

Writes buffer to stimulus port using largest packet size possible - starts with 32-bit writes, followed by 16-bit writes and 8-bit write.

Data from buffer are memcpy'ied which is subject to compiler optimization and might result in unaligned memory access if compiler decides it is valid (e.g. on ARMv7-M platform).

Parameters
portPort
bufferBuffer to be written (must not be NULL)
sizeSize of buffer to be written