Skip to content

Commit d7da45b

Browse files
author
wayne ren
committed
os: use trap exception to make task context switch request in FreeRTOS port for SecureShield
TRAP exception is used by FreeRTOS kernel port, so applicaiton should not use trap exception.
1 parent d0faa31 commit d7da45b

File tree

3 files changed

+10
-27
lines changed

3 files changed

+10
-27
lines changed

os/freertos/portable/Synopsys/ARC_EM_SECURESHIELD/arc_freertos_exceptions.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,22 @@
7979
#ifdef __GNU__
8080
extern void gnu_printf_setup(void);
8181
#endif
82+
83+
extern unsigned int context_switch_reqflg;
84+
85+
static void trap_task_switch_handler(void)
86+
{
87+
context_switch_reqflg = 1; // require a context switch
88+
}
89+
8290
/**
8391
* \brief freertos related cpu exception initialization, all the interrupts handled by freertos must be not
8492
* fast irqs. If fiq is needed, please install the default firq_exc_entry or your own fast irq entry into
8593
* the specific interrupt exception.
8694
*/
8795
void freertos_exc_init(void)
8896
{
89-
97+
exc_handler_install(EXC_NO_TRAP, (EXC_HANDLER)trap_task_switch_handler);
9098
#ifdef __GNU__
9199
gnu_printf_setup();
92100
#endif

os/freertos/portable/Synopsys/ARC_EM_SECURESHIELD/arc_support.s

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -82,27 +82,6 @@
8282
#include "arc.h"
8383
#include "arc_asm_common.h"
8484

85-
/*
86-
* task dispatcher
87-
*
88-
*/
89-
.text
90-
.align 4
91-
.global dispatch
92-
dispatch:
93-
/*
94-
* the pre-conditions of this routine are task context, CPU is
95-
* locked, dispatch is enabled.
96-
*/
97-
sr blink, [AUX_ERRET]
98-
lr blink, [AUX_STATUS32]
99-
sr blink, [AUX_ERSTATUS]
100-
EXCEPTION_PROLOGUE
101-
SAVE_CALLEE_REGS
102-
ld r0, [pxCurrentTCB]
103-
b dispatcher
104-
105-
10685
/*
10786
* start dispatch
10887
*/

os/freertos/portable/Synopsys/ARC_EM_SECURESHIELD/port.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,7 @@ void vPortYieldFromIsr(void)
286286
/* ----------------------------------------------------------------------------*/
287287
void vPortYield(void)
288288
{
289-
unsigned int status32;
290-
291-
status32 = cpu_lock_save();
292-
dispatch();
293-
cpu_unlock_restore(status32);
289+
Asm("trap_s 1");
294290
}
295291

296292
/* --------------------------------------------------------------------------*/

0 commit comments

Comments
 (0)