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 */
#define arm_fullcontextrestore(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) \
#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 */

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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