You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/09/23 15:54:31 UTC
[incubator-nuttx] branch master updated: arm/tlsr82: replace incompatible instruction sets to internal implement
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new b134995d92 arm/tlsr82: replace incompatible instruction sets to internal implement
b134995d92 is described below
commit b134995d929a3977ff77d64a7fd9c0b6ea759936
Author: chao an <an...@xiaomi.com>
AuthorDate: Fri Sep 23 16:03:05 2022 +0800
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 <an...@xiaomi.com>
---
arch/arm/src/common/arm_internal.h | 17 +++++++++++++----
arch/arm/src/tlsr82/Make.defs | 3 +++
arch/arm/src/tlsr82/tc32/tc32_fullcontextrestore.S | 12 ++++++------
arch/arm/src/tlsr82/tc32/tc32_switchcontext.S | 18 +++++++++---------
boards/arm/tlsr82/tlsr8278adk80d/scripts/Make.defs | 2 ++
5 files changed, 33 insertions(+), 19 deletions(-)
diff --git a/arch/arm/src/common/arm_internal.h b/arch/arm/src/common/arm_internal.h
index b7e311f442..32693cb6bb 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 9ae2087055..e5007f532a 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 b5000cbf26..cb938d91ef 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 252e655f63..742472bb80 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 0f98ab6f91..6f244c0c2f 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