summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2017-02-16 11:57:35 -0800
committerAndrew Boie <andrew.p.boie@intel.com>2017-04-13 13:33:58 -0700
commit9b8ae12bd1a4432077c1c8c8d2e6334e273344e3 (patch)
tree57f965c709aaa27268ce94c32f4a85200799151c
parentf187e3a2d9714310326118b1df2c0567ab4dd894 (diff)
xtensa: drop references to C librarycore
C library is not actually used by the xtensa port, we only need the 'exit' function. Implement 'exit' in crt1-* and drop remaining references to the C library. Change-Id: I8a562363956b4755a6b5baee7acf3726485e5ce3 Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
-rw-r--r--arch/xtensa/core/crt1-boards.S28
-rw-r--r--arch/xtensa/core/crt1-sim.S21
-rw-r--r--scripts/Makefile.toolchain.xcc2
3 files changed, 22 insertions, 29 deletions
diff --git a/arch/xtensa/core/crt1-boards.S b/arch/xtensa/core/crt1-boards.S
index 7b7d09b06..c24092c80 100644
--- a/arch/xtensa/core/crt1-boards.S
+++ b/arch/xtensa/core/crt1-boards.S
@@ -18,11 +18,10 @@
/* Exports */
.global _start
+.global exit
/*
* Imports
- * __clibrary_init from C library (eg. newlib or uclibc)
- * exit from C library
* main from user application
* board_init board-specific (uart/mingloss/tinygloss.c)
* xthal_dcache_all_writeback from HAL library
@@ -214,28 +213,12 @@ _start:
#else /* !HALT */
.type board_init, @function
- .type __clibrary_init, @function
.type exit, @function
/* Initialize the board (eg. UART, etc). */
CALL board_init
- /*
- * Call __clibrary_init to initialize the C library:
- *
- * void __clibrary_init(int argc, char ** argv, char ** environ,
- * void(*init_func)(void), void(*fini_func)(void));
- * Pass an empty argv array, with an empty string as the program name
- */
- movi ARG1, _start_argc /* argc address */
- movi ARG2, _start_argv /* argv = ["", 0] */
- movi ARG3, _start_envp /* envp = [0] */
- movi ARG4, _init /* function that calls constructors */
- movi ARG5, _fini /* function that calls destructors */
- l32i ARG1, ARG1, 0 /* argc = 1 */
- CALL __clibrary_init
-
/* Call: int main(int argc, char ** argv, char ** environ); */
movi ARG1, _start_argc /* argc address */
movi ARG2, _start_argv /* argv = ["", 0] */
@@ -269,3 +252,12 @@ _start_argc:
.size _start, . - _start
+ .align 4
+exit:
+#if XCHAL_HAVE_INTERRUPTS
+ waiti 15
+#endif
+ j exit
+
+ .size exit, . - exit
+
diff --git a/arch/xtensa/core/crt1-sim.S b/arch/xtensa/core/crt1-sim.S
index 665e24fee..22af3708f 100644
--- a/arch/xtensa/core/crt1-sim.S
+++ b/arch/xtensa/core/crt1-sim.S
@@ -17,16 +17,14 @@
/* Exports */
.global _start
.global __start
+.global exit
/*
* Imports
- * __clibrary_init from C library (eg. newlib or uclibc)
- * exit from C library
* main from user application
* __stack from linker script (see LSP Ref Manual)
*/
-.type __clibrary_init, @function
.type _Cstart, @function
.type exit, @function
@@ -34,6 +32,7 @@
/* Macros to abstract away ABI differences */
#if __XTENSA_CALL0_ABI__
+# define ENTRY
# define CALL call0
# define CALLX callx0
# define ARG1 a2 /* 1st outgoing call argument */
@@ -42,6 +41,7 @@
# define ARG4 a5 /* 4th outgoing call argument */
# define ARG5 a6 /* 5th outgoing call argument */
#else
+# define ENTRY entry sp, 0x20
# define CALL call4
# define CALLX callx4
# define ARG1 a6 /* 1st outgoing call argument */
@@ -210,13 +210,6 @@ __start:
#endif
- /*
- * Call __clibrary_init to initialize the C library:
- *
- * void __clibrary_init(int argc, char ** argv, char ** environ,
- * void(*init_func)(void), void(*fini_func)(void));
- */
-
/* Get argv with the arguments from the ISS */
mov a3, sp /* tell simcall where to write argv[] */
movi a2, SYS_iss_set_argv
@@ -236,6 +229,14 @@ __start:
.size _start, . - _start
+ .align 4
+exit:
+ ENTRY
+ mov a3, a2
+ movi a2, SYS_exit
+ simcall
+
+ .size exit, . - exit
/*
* Local Variables:
diff --git a/scripts/Makefile.toolchain.xcc b/scripts/Makefile.toolchain.xcc
index ec49be3aa..7846f4add 100644
--- a/scripts/Makefile.toolchain.xcc
+++ b/scripts/Makefile.toolchain.xcc
@@ -53,7 +53,7 @@ XTSC_INC_FILE=$(notdir ${XTSC_INC})
# Include XCC standard libraries so that users used to Xplorer IDE can port
# their code easily
-TOOLCHAIN_LIBS += gcc c sim hal
+TOOLCHAIN_LIBS += gcc hal
LIB_INCLUDE_DIR += -L${XTENSA_BUILD}/xtensa-elf/lib/xcc \
-L${XTENSA_BUILD}/xtensa-elf/lib \
-L${XTENSA_BUILD}/xtensa-elf/arch/lib