Skip to content

Commit f5cf45d

Browse files
authored
[Fixed the Issue] Fixed the Issue#1102 of RL78 of the Context switch issue. #1102 (#1157)
1 parent e81ad46 commit f5cf45d

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

portable/GCC/RL78/portmacro.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,18 @@ typedef unsigned short UBaseType_t;
106106

107107
/* Task utilities. */
108108
#define portYIELD() __asm volatile ( "BRK" )
109-
#define portYIELD_FROM_ISR( xHigherPriorityTaskWoken ) do { if( xHigherPriorityTaskWoken ) vTaskSwitchContext( ); } while( 0 )
109+
#ifndef configREQUIRE_ASM_ISR_WRAPPER
110+
#define configREQUIRE_ASM_ISR_WRAPPER 1
111+
#endif
112+
#if( configREQUIRE_ASM_ISR_WRAPPER == 1 )
113+
/* You must implement an assembly ISR wrapper (see the below for details) if you need an ISR to cause a context switch.
114+
* https://www.freertos.org/Documentation/02-Kernel/03-Supported-devices/04-Demos/Renesas/RTOS_RL78_IAR_Demos#writing-interrupt-service-routines */
115+
#define portYIELD_FROM_ISR( xHigherPriorityTaskWoken ) do { if( xHigherPriorityTaskWoken != pdFALSE ) vTaskSwitchContext(); } while( 0 )
116+
#else
117+
/* You must not implement an assembly ISR wrapper even if you need an ISR to cause a context switch.
118+
* The portYIELD, which is similar to role of an assembly ISR wrapper, runs only when a context switch is required. */
119+
#define portYIELD_FROM_ISR( xHigherPriorityTaskWoken ) do { if( xHigherPriorityTaskWoken != pdFALSE ) portYIELD(); } while( 0 )
120+
#endif
110121
#define portNOP() __asm volatile ( "NOP" )
111122
/*-----------------------------------------------------------*/
112123

portable/IAR/RL78/portmacro.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,18 @@
130130
/* Task utilities. */
131131
#define portNOP() __asm( "NOP" )
132132
#define portYIELD() __asm( "BRK" )
133-
#define portYIELD_FROM_ISR( xHigherPriorityTaskWoken ) do { if( xHigherPriorityTaskWoken ) vTaskSwitchContext( ); } while( 0 )
133+
#ifndef configREQUIRE_ASM_ISR_WRAPPER
134+
#define configREQUIRE_ASM_ISR_WRAPPER 1
135+
#endif
136+
#if( configREQUIRE_ASM_ISR_WRAPPER == 1 )
137+
/* You must implement an assembly ISR wrapper (see the below for details) if you need an ISR to cause a context switch.
138+
* https://www.freertos.org/Documentation/02-Kernel/03-Supported-devices/04-Demos/Renesas/RTOS_RL78_IAR_Demos#writing-interrupt-service-routines */
139+
#define portYIELD_FROM_ISR( xHigherPriorityTaskWoken ) do { if( xHigherPriorityTaskWoken != pdFALSE ) vTaskSwitchContext(); } while( 0 )
140+
#else
141+
/* You must not implement an assembly ISR wrapper even if you need an ISR to cause a context switch.
142+
* The portYIELD, which is similar to role of an assembly ISR wrapper, runs only when a context switch is required. */
143+
#define portYIELD_FROM_ISR( xHigherPriorityTaskWoken ) do { if( xHigherPriorityTaskWoken != pdFALSE ) portYIELD(); } while( 0 )
144+
#endif
134145
/*-----------------------------------------------------------*/
135146

136147
/* Hardware specifics. */

0 commit comments

Comments
 (0)