diff --git a/arch/arm/src/common/arm_internal.h b/arch/arm/src/common/arm_internal.h index b7e311f4429..32693cb6bb4 100644 --- a/arch/arm/src/common/arm_internal.h +++ b/arch/arm/src/common/arm_internal.h @@ -142,11 +142,20 @@ /* Context switching */ -#define arm_fullcontextrestore(restoreregs) \ - sys_call1(SYS_restore_context, (uintptr_t)restoreregs); +#ifndef arm_fullcontextrestore +# define arm_fullcontextrestore(restoreregs) \ + sys_call1(SYS_restore_context, (uintptr_t)restoreregs); +#else +extern void arm_fullcontextrestore(uint32_t *restoreregs); +#endif -#define arm_switchcontext(saveregs, restoreregs) \ - sys_call2(SYS_switch_context, (uintptr_t)saveregs, (uintptr_t)restoreregs); +#ifndef arm_switchcontext +# define arm_switchcontext(saveregs, restoreregs) \ + sys_call2(SYS_switch_context, (uintptr_t)saveregs, (uintptr_t)restoreregs); +#else +extern void arm_switchcontext(uint32_t **saveregs, + uint32_t *restoreregs); +#endif /* Redefine the linker symbols as armlink style */ diff --git a/arch/arm/src/tlsr82/Make.defs b/arch/arm/src/tlsr82/Make.defs index 9ae20870550..e5007f532a9 100644 --- a/arch/arm/src/tlsr82/Make.defs +++ b/arch/arm/src/tlsr82/Make.defs @@ -64,3 +64,6 @@ ifeq ($(CONFIG_TLSR82_SOFT_FPU),y) EXTRA_LIBPATHS += -L$(TOPDIR)/$(CONFIG_TLSR82_SOFT_FPU_LIB_PATH) EXTRA_LIBS += -l$(CONFIG_TLSR82_SOFT_FPU_LIB_NAME) endif + +CFLAGS += -Darm_fullcontextrestore=tc32_fullcontextrestore +CFLAGS += -Darm_switchcontext=tc32_switchcontext diff --git a/arch/arm/src/tlsr82/tc32/tc32_fullcontextrestore.S b/arch/arm/src/tlsr82/tc32/tc32_fullcontextrestore.S index b5000cbf265..cb938d91efd 100644 --- a/arch/arm/src/tlsr82/tc32/tc32_fullcontextrestore.S +++ b/arch/arm/src/tlsr82/tc32/tc32_fullcontextrestore.S @@ -44,12 +44,12 @@ ****************************************************************************/ /**************************************************************************** - * Name: arm_fullcontextrestore + * Name: tc32_fullcontextrestore * * Description: * Restore the current thread context. Full prototype is: * - * void arm_fullcontextrestore(uint32_t *restoreregs) noreturn_function; + * void tc32_fullcontextrestore(uint32_t *restoreregs) noreturn_function; * * Returned Value: * None @@ -60,9 +60,9 @@ .code 16 .thumb_func .section .ram_code,"ax" - .global arm_fullcontextrestore - .type arm_fullcontextrestore, function -arm_fullcontextrestore: + .global tc32_fullcontextrestore + .type tc32_fullcontextrestore, function +tc32_fullcontextrestore: /* Move saved register to register R1 ~ R7 * R8 --> R1 @@ -152,5 +152,5 @@ _REG_IRQ_EN2: .word 0x00800643 .word 0x00000092 .word 0xfffffffe - .size arm_fullcontextrestore, .-arm_fullcontextrestore + .size tc32_fullcontextrestore, .-tc32_fullcontextrestore .end diff --git a/arch/arm/src/tlsr82/tc32/tc32_switchcontext.S b/arch/arm/src/tlsr82/tc32/tc32_switchcontext.S index 252e655f63f..742472bb80e 100644 --- a/arch/arm/src/tlsr82/tc32/tc32_switchcontext.S +++ b/arch/arm/src/tlsr82/tc32/tc32_switchcontext.S @@ -43,12 +43,12 @@ ****************************************************************************/ /**************************************************************************** - * Name: arm_switchcontext + * Name: tc32_switchcontext * * Description: * Restore the current thread context. Full prototype is: * - * void arm_switchcontext(uint32_t **saveregs, uint32_t *restoreregs); + * void tc32_switchcontext(uint32_t **saveregs, uint32_t *restoreregs); * * R0 = saveregs , pointer to the current task tcb->regs, the sp after current task context save should be saved in it. @@ -63,10 +63,10 @@ .code 16 .thumb_func .section .ram_code,"ax" - .extern arm_fullcontextrestore - .global arm_switchcontext - .type arm_switchcontext, function -arm_switchcontext: + .extern tc32_fullcontextrestore + .global tc32_switchcontext + .type tc32_switchcontext, function +tc32_switchcontext: /* Save LR, R0 ~ R7 into current task stack */ @@ -127,12 +127,12 @@ arm_switchcontext: tmov r0, r1 - /* Call arm_fullcontextrestore to restore the context */ + /* Call tc32_fullcontextrestore to restore the context */ - tjl arm_fullcontextrestore + tjl tc32_fullcontextrestore .align 2 _REG_IRQ_EN3: .word 0x00800643 - .size arm_switchcontext, .-arm_switchcontext + .size tc32_switchcontext, .-tc32_switchcontext .end diff --git a/boards/arm/tlsr82/tlsr8278adk80d/scripts/Make.defs b/boards/arm/tlsr82/tlsr8278adk80d/scripts/Make.defs index 0f98ab6f912..6f244c0c2f8 100644 --- a/boards/arm/tlsr82/tlsr8278adk80d/scripts/Make.defs +++ b/boards/arm/tlsr82/tlsr8278adk80d/scripts/Make.defs @@ -31,6 +31,8 @@ endif ARCHCFLAGS += -DMCU_CORE_B87=1 -fms-extensions -std=gnu99 ARCHPICFLAGS += -fpic +ARCHCPUFLAGS := $(filter-out -mlittle-endian,$(ARCHCPUFLAGS)) + CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe