xtensa: drop references to C library
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>
This commit is contained in:
parent
0538dc1a1c
commit
4b8419e420
3 changed files with 22 additions and 29 deletions
|
@ -18,11 +18,10 @@
|
||||||
|
|
||||||
/* Exports */
|
/* Exports */
|
||||||
.global _start
|
.global _start
|
||||||
|
.global exit
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Imports
|
* Imports
|
||||||
* __clibrary_init from C library (eg. newlib or uclibc)
|
|
||||||
* exit from C library
|
|
||||||
* main from user application
|
* main from user application
|
||||||
* board_init board-specific (uart/mingloss/tinygloss.c)
|
* board_init board-specific (uart/mingloss/tinygloss.c)
|
||||||
* xthal_dcache_all_writeback from HAL library
|
* xthal_dcache_all_writeback from HAL library
|
||||||
|
@ -214,28 +213,12 @@ _start:
|
||||||
#else /* !HALT */
|
#else /* !HALT */
|
||||||
|
|
||||||
.type board_init, @function
|
.type board_init, @function
|
||||||
.type __clibrary_init, @function
|
|
||||||
.type exit, @function
|
.type exit, @function
|
||||||
|
|
||||||
|
|
||||||
/* Initialize the board (eg. UART, etc). */
|
/* Initialize the board (eg. UART, etc). */
|
||||||
CALL board_init
|
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); */
|
/* Call: int main(int argc, char ** argv, char ** environ); */
|
||||||
movi ARG1, _start_argc /* argc address */
|
movi ARG1, _start_argc /* argc address */
|
||||||
movi ARG2, _start_argv /* argv = ["", 0] */
|
movi ARG2, _start_argv /* argv = ["", 0] */
|
||||||
|
@ -269,3 +252,12 @@ _start_argc:
|
||||||
|
|
||||||
.size _start, . - _start
|
.size _start, . - _start
|
||||||
|
|
||||||
|
.align 4
|
||||||
|
exit:
|
||||||
|
#if XCHAL_HAVE_INTERRUPTS
|
||||||
|
waiti 15
|
||||||
|
#endif
|
||||||
|
j exit
|
||||||
|
|
||||||
|
.size exit, . - exit
|
||||||
|
|
||||||
|
|
|
@ -17,16 +17,14 @@
|
||||||
/* Exports */
|
/* Exports */
|
||||||
.global _start
|
.global _start
|
||||||
.global __start
|
.global __start
|
||||||
|
.global exit
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Imports
|
* Imports
|
||||||
* __clibrary_init from C library (eg. newlib or uclibc)
|
|
||||||
* exit from C library
|
|
||||||
* main from user application
|
* main from user application
|
||||||
* __stack from linker script (see LSP Ref Manual)
|
* __stack from linker script (see LSP Ref Manual)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.type __clibrary_init, @function
|
|
||||||
.type _Cstart, @function
|
.type _Cstart, @function
|
||||||
.type exit, @function
|
.type exit, @function
|
||||||
|
|
||||||
|
@ -34,6 +32,7 @@
|
||||||
/* Macros to abstract away ABI differences */
|
/* Macros to abstract away ABI differences */
|
||||||
|
|
||||||
#if __XTENSA_CALL0_ABI__
|
#if __XTENSA_CALL0_ABI__
|
||||||
|
# define ENTRY
|
||||||
# define CALL call0
|
# define CALL call0
|
||||||
# define CALLX callx0
|
# define CALLX callx0
|
||||||
# define ARG1 a2 /* 1st outgoing call argument */
|
# define ARG1 a2 /* 1st outgoing call argument */
|
||||||
|
@ -42,6 +41,7 @@
|
||||||
# define ARG4 a5 /* 4th outgoing call argument */
|
# define ARG4 a5 /* 4th outgoing call argument */
|
||||||
# define ARG5 a6 /* 5th outgoing call argument */
|
# define ARG5 a6 /* 5th outgoing call argument */
|
||||||
#else
|
#else
|
||||||
|
# define ENTRY entry sp, 0x20
|
||||||
# define CALL call4
|
# define CALL call4
|
||||||
# define CALLX callx4
|
# define CALLX callx4
|
||||||
# define ARG1 a6 /* 1st outgoing call argument */
|
# define ARG1 a6 /* 1st outgoing call argument */
|
||||||
|
@ -210,13 +210,6 @@ __start:
|
||||||
#endif
|
#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 */
|
/* Get argv with the arguments from the ISS */
|
||||||
mov a3, sp /* tell simcall where to write argv[] */
|
mov a3, sp /* tell simcall where to write argv[] */
|
||||||
movi a2, SYS_iss_set_argv
|
movi a2, SYS_iss_set_argv
|
||||||
|
@ -236,6 +229,14 @@ __start:
|
||||||
|
|
||||||
.size _start, . - _start
|
.size _start, . - _start
|
||||||
|
|
||||||
|
.align 4
|
||||||
|
exit:
|
||||||
|
ENTRY
|
||||||
|
mov a3, a2
|
||||||
|
movi a2, SYS_exit
|
||||||
|
simcall
|
||||||
|
|
||||||
|
.size exit, . - exit
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Local Variables:
|
* Local Variables:
|
||||||
|
|
|
@ -53,7 +53,7 @@ XTSC_INC_FILE=$(notdir ${XTSC_INC})
|
||||||
|
|
||||||
# Include XCC standard libraries so that users used to Xplorer IDE can port
|
# Include XCC standard libraries so that users used to Xplorer IDE can port
|
||||||
# their code easily
|
# their code easily
|
||||||
TOOLCHAIN_LIBS += gcc c sim hal
|
TOOLCHAIN_LIBS += gcc hal
|
||||||
LIB_INCLUDE_DIR += -L${XTENSA_BUILD}/xtensa-elf/lib/xcc \
|
LIB_INCLUDE_DIR += -L${XTENSA_BUILD}/xtensa-elf/lib/xcc \
|
||||||
-L${XTENSA_BUILD}/xtensa-elf/lib \
|
-L${XTENSA_BUILD}/xtensa-elf/lib \
|
||||||
-L${XTENSA_BUILD}/xtensa-elf/arch/lib
|
-L${XTENSA_BUILD}/xtensa-elf/arch/lib
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue