arm/tlsr82: replace incompatible instruction sets to internal implement

1. some arm instructions are not compatible with arch tlsr:

{standard input}: Assembler messages:
{standard input}:53: Error: bad instruction `svc #0'

2. remove unsupport compile option

cc1: error: unrecognized command line option "-mlittle-endian"
Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
chao an 2022-09-23 16:03:05 +08:00 committed by Xiang Xiao
parent 0c33a93dde
commit b134995d92
5 changed files with 33 additions and 19 deletions

View File

@ -142,11 +142,20 @@
/* Context switching */ /* Context switching */
#define arm_fullcontextrestore(restoreregs) \ #ifndef arm_fullcontextrestore
sys_call1(SYS_restore_context, (uintptr_t)restoreregs); # 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) \ #ifndef arm_switchcontext
sys_call2(SYS_switch_context, (uintptr_t)saveregs, (uintptr_t)restoreregs); # 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 */ /* Redefine the linker symbols as armlink style */

View File

@ -64,3 +64,6 @@ ifeq ($(CONFIG_TLSR82_SOFT_FPU),y)
EXTRA_LIBPATHS += -L$(TOPDIR)/$(CONFIG_TLSR82_SOFT_FPU_LIB_PATH) EXTRA_LIBPATHS += -L$(TOPDIR)/$(CONFIG_TLSR82_SOFT_FPU_LIB_PATH)
EXTRA_LIBS += -l$(CONFIG_TLSR82_SOFT_FPU_LIB_NAME) EXTRA_LIBS += -l$(CONFIG_TLSR82_SOFT_FPU_LIB_NAME)
endif endif
CFLAGS += -Darm_fullcontextrestore=tc32_fullcontextrestore
CFLAGS += -Darm_switchcontext=tc32_switchcontext

View File

@ -44,12 +44,12 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: arm_fullcontextrestore * Name: tc32_fullcontextrestore
* *
* Description: * Description:
* Restore the current thread context. Full prototype is: * 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: * Returned Value:
* None * None
@ -60,9 +60,9 @@
.code 16 .code 16
.thumb_func .thumb_func
.section .ram_code,"ax" .section .ram_code,"ax"
.global arm_fullcontextrestore .global tc32_fullcontextrestore
.type arm_fullcontextrestore, function .type tc32_fullcontextrestore, function
arm_fullcontextrestore: tc32_fullcontextrestore:
/* Move saved register to register R1 ~ R7 /* Move saved register to register R1 ~ R7
* R8 --> R1 * R8 --> R1
@ -152,5 +152,5 @@ _REG_IRQ_EN2:
.word 0x00800643 .word 0x00800643
.word 0x00000092 .word 0x00000092
.word 0xfffffffe .word 0xfffffffe
.size arm_fullcontextrestore, .-arm_fullcontextrestore .size tc32_fullcontextrestore, .-tc32_fullcontextrestore
.end .end

View File

@ -43,12 +43,12 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: arm_switchcontext * Name: tc32_switchcontext
* *
* Description: * Description:
* Restore the current thread context. Full prototype is: * 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 * R0 = saveregs , pointer to the current task tcb->regs, the sp after
current task context save should be saved in it. current task context save should be saved in it.
@ -63,10 +63,10 @@
.code 16 .code 16
.thumb_func .thumb_func
.section .ram_code,"ax" .section .ram_code,"ax"
.extern arm_fullcontextrestore .extern tc32_fullcontextrestore
.global arm_switchcontext .global tc32_switchcontext
.type arm_switchcontext, function .type tc32_switchcontext, function
arm_switchcontext: tc32_switchcontext:
/* Save LR, R0 ~ R7 into current task stack */ /* Save LR, R0 ~ R7 into current task stack */
@ -127,12 +127,12 @@ arm_switchcontext:
tmov r0, r1 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 .align 2
_REG_IRQ_EN3: _REG_IRQ_EN3:
.word 0x00800643 .word 0x00800643
.size arm_switchcontext, .-arm_switchcontext .size tc32_switchcontext, .-tc32_switchcontext
.end .end

View File

@ -31,6 +31,8 @@ endif
ARCHCFLAGS += -DMCU_CORE_B87=1 -fms-extensions -std=gnu99 ARCHCFLAGS += -DMCU_CORE_B87=1 -fms-extensions -std=gnu99
ARCHPICFLAGS += -fpic ARCHPICFLAGS += -fpic
ARCHCPUFLAGS := $(filter-out -mlittle-endian,$(ARCHCPUFLAGS))
CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe