Skip to content

Commit d43062b

Browse files
authored
Add trace hook macro for most ports (#794)
Add trace hook macro for most ports In pull request #659 we introduced better support for tracing tools like systemview. This patchset adds support for more ports as requested in the original pull request.
1 parent 83861f5 commit d43062b

File tree

103 files changed

+1007
-136
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+1007
-136
lines changed

portable/ARMv8M/non_secure/port.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -977,13 +977,19 @@ void SysTick_Handler( void ) /* PRIVILEGED_FUNCTION */
977977
uint32_t ulPreviousMask;
978978

979979
ulPreviousMask = portSET_INTERRUPT_MASK_FROM_ISR();
980+
traceISR_ENTER();
980981
{
981982
/* Increment the RTOS tick. */
982983
if( xTaskIncrementTick() != pdFALSE )
983984
{
985+
traceISR_EXIT_TO_SCHEDULER();
984986
/* Pend a context switch. */
985987
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
986988
}
989+
else
990+
{
991+
traceISR_EXIT();
992+
}
987993
}
988994
portCLEAR_INTERRUPT_MASK_FROM_ISR( ulPreviousMask );
989995
}

portable/ARMv8M/non_secure/portmacrocommon.h

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,19 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
338338
#define portYIELD() vPortYield()
339339
#define portNVIC_INT_CTRL_REG ( *( ( volatile uint32_t * ) 0xe000ed04 ) )
340340
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
341-
#define portEND_SWITCHING_ISR( xSwitchRequired ) \
342-
do { if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; } \
343-
while( 0 )
341+
#define portEND_SWITCHING_ISR( xSwitchRequired ) \
342+
do \
343+
{ \
344+
if( xSwitchRequired ) \
345+
{ \
346+
traceISR_EXIT_TO_SCHEDULER(); \
347+
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; \
348+
} \
349+
else \
350+
{ \
351+
traceISR_EXIT(); \
352+
} \
353+
} while( 0 )
344354
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
345355
/*-----------------------------------------------------------*/
346356

portable/CCS/ARM_CM3/port.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,14 +363,21 @@ void xPortSysTickHandler( void )
363363
* save and then restore the interrupt mask value as its value is already
364364
* known. */
365365
( void ) portSET_INTERRUPT_MASK_FROM_ISR();
366+
traceISR_ENTER();
366367
{
367368
/* Increment the RTOS tick. */
368369
if( xTaskIncrementTick() != pdFALSE )
369370
{
371+
traceISR_EXIT_TO_SCHEDULER();
372+
370373
/* A context switch is required. Context switching is performed in
371374
* the PendSV interrupt. Pend the PendSV interrupt. */
372375
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
373376
}
377+
else
378+
{
379+
traceISR_EXIT();
380+
}
374381
}
375382
portCLEAR_INTERRUPT_MASK_FROM_ISR( 0 );
376383
}

portable/CCS/ARM_CM3/portmacro.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,20 @@ typedef unsigned long UBaseType_t;
9797

9898
#define portNVIC_INT_CTRL_REG ( *( ( volatile uint32_t * ) 0xe000ed04 ) )
9999
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
100-
#define portEND_SWITCHING_ISR( xSwitchRequired ) do { if( xSwitchRequired != pdFALSE ) portYIELD( ); } while( 0 )
101-
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
100+
#define portEND_SWITCHING_ISR( xSwitchRequired ) \
101+
do \
102+
{ \
103+
if( xSwitchRequired != pdFALSE ) \
104+
{ \
105+
traceISR_EXIT_TO_SCHEDULER(); \
106+
portYIELD(); \
107+
} \
108+
else \
109+
{ \
110+
traceISR_EXIT(); \
111+
} \
112+
} while( 0 )
113+
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
102114

103115
/*-----------------------------------------------------------*/
104116

portable/CCS/ARM_CM4F/port.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,14 +388,21 @@ void xPortSysTickHandler( void )
388388
* save and then restore the interrupt mask value as its value is already
389389
* known. */
390390
( void ) portSET_INTERRUPT_MASK_FROM_ISR();
391+
traceISR_ENTER();
391392
{
392393
/* Increment the RTOS tick. */
393394
if( xTaskIncrementTick() != pdFALSE )
394395
{
396+
traceISR_EXIT_TO_SCHEDULER();
397+
395398
/* A context switch is required. Context switching is performed in
396399
* the PendSV interrupt. Pend the PendSV interrupt. */
397400
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
398401
}
402+
else
403+
{
404+
traceISR_EXIT();
405+
}
399406
}
400407
portCLEAR_INTERRUPT_MASK_FROM_ISR( 0 );
401408
}

portable/CCS/ARM_CM4F/portmacro.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,20 @@ typedef unsigned long UBaseType_t;
9191

9292
#define portNVIC_INT_CTRL_REG ( *( ( volatile uint32_t * ) 0xe000ed04 ) )
9393
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
94-
#define portEND_SWITCHING_ISR( xSwitchRequired ) do { if( xSwitchRequired != pdFALSE ) portYIELD( ); } while( 0 )
95-
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
94+
#define portEND_SWITCHING_ISR( xSwitchRequired ) \
95+
do \
96+
{ \
97+
if( xSwitchRequired != pdFALSE ) \
98+
{ \
99+
traceISR_EXIT_TO_SCHEDULER(); \
100+
portYIELD(); \
101+
} \
102+
else \
103+
{ \
104+
traceISR_EXIT(); \
105+
} \
106+
} while( 0 )
107+
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
96108

97109
/*-----------------------------------------------------------*/
98110

portable/CodeWarrior/ColdFire_V1/portmacro.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,19 @@ extern void vPortClearInterruptMaskFromISR( UBaseType_t );
106106
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters )
107107
/*-----------------------------------------------------------*/
108108

109-
#define portEND_SWITCHING_ISR( xSwitchRequired ) do { if( xSwitchRequired != pdFALSE ) { portYIELD(); } } while( 0 )
110-
109+
#define portEND_SWITCHING_ISR( xSwitchRequired ) \
110+
do \
111+
{ \
112+
if( xSwitchRequired != pdFALSE ) \
113+
{ \
114+
traceISR_EXIT_TO_SCHEDULER(); \
115+
portYIELD(); \
116+
} \
117+
else \
118+
{ \
119+
traceISR_EXIT(); \
120+
} \
121+
} while( 0 )
111122

112123
/* *INDENT-OFF* */
113124
#ifdef __cplusplus

portable/CodeWarrior/ColdFire_V2/portmacro.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,19 @@ extern void vPortClearInterruptMaskFromISR( UBaseType_t );
105105
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters )
106106
/*-----------------------------------------------------------*/
107107

108-
#define portEND_SWITCHING_ISR( xSwitchRequired ) do { if( xSwitchRequired != pdFALSE ) { portYIELD(); } } while( 0 )
109-
108+
#define portEND_SWITCHING_ISR( xSwitchRequired ) \
109+
do \
110+
{ \
111+
if( xSwitchRequired != pdFALSE ) \
112+
{ \
113+
traceISR_EXIT_TO_SCHEDULER(); \
114+
portYIELD(); \
115+
} \
116+
else \
117+
{ \
118+
traceISR_EXIT(); \
119+
} \
120+
} while( 0 )
110121

111122
/* *INDENT-OFF* */
112123
#ifdef __cplusplus

portable/GCC/ARM_CM0/port.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,13 +375,19 @@ void xPortSysTickHandler( void )
375375
uint32_t ulPreviousMask;
376376

377377
ulPreviousMask = portSET_INTERRUPT_MASK_FROM_ISR();
378+
traceISR_ENTER();
378379
{
379380
/* Increment the RTOS tick. */
380381
if( xTaskIncrementTick() != pdFALSE )
381382
{
383+
traceISR_EXIT_TO_SCHEDULER();
382384
/* Pend a context switch. */
383385
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
384386
}
387+
else
388+
{
389+
traceISR_EXIT();
390+
}
385391
}
386392
portCLEAR_INTERRUPT_MASK_FROM_ISR( ulPreviousMask );
387393
}

portable/GCC/ARM_CM0/portmacro.h

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,19 @@ extern void vPortYield( void );
8787
#define portNVIC_INT_CTRL_REG ( *( ( volatile uint32_t * ) 0xe000ed04 ) )
8888
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
8989
#define portYIELD() vPortYield()
90-
#define portEND_SWITCHING_ISR( xSwitchRequired ) \
91-
do { if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; } \
92-
while( 0 )
90+
#define portEND_SWITCHING_ISR( xSwitchRequired ) \
91+
do \
92+
{ \
93+
if( xSwitchRequired ) \
94+
{ \
95+
traceISR_EXIT_TO_SCHEDULER(); \
96+
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; \
97+
} \
98+
else \
99+
{ \
100+
traceISR_EXIT(); \
101+
} \
102+
} while( 0 )
93103
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
94104
/*-----------------------------------------------------------*/
95105

0 commit comments

Comments
 (0)