1 ##############################################################################
2 # crt0.S -- CRX default start-up routine #
4 # Copyright (c) 2004 National Semiconductor Corporation #
6 # The authors hereby grant permission to use, copy, modify, distribute, #
7 # and license this software and its documentation for any purpose, provided #
8 # that existing copyright notices are retained in all copies and that this #
9 # notice is included verbatim in any distributions. No written agreement, #
10 # license, or royalty fee is required for any of the authorized uses. #
11 # Modifications to this software may be copyrighted by their authors #
12 # and need not follow the licensing terms described here, provided that #
13 # the new terms are clearly indicated on the first page of each file where #
16 # This is the start routine of your CRX program. #
17 # It is linked with your application automatically. You can use #
18 # this routine as a template and modify it to your needs, yet this #
19 # file must be supplied for the compiler. #
20 # It is assumed that the following symbols are defined in your linker #
21 # script: __STACK_START, __ISTACK_START, __DATA_START, __DATA_END, #
22 # __DATA_IMAGE_START, __BSS_START, __BSS_END. #
23 ##############################################################################
31 .globl __dispatch_table
35 #----------------------------------------------------------------------------#
36 # Initialize the stack pointers. The constants __STACK_START and #
37 # __ISTACK_START should be defined in the linker script. #
39 movd $__STACK_START, sp
40 movd $__ISTACK_START, r0
43 #----------------------------------------------------------------------------#
44 # Initialize the default sections according to the linker script. #
47 subd $__DATA_START, r4
48 movd $__DATA_START, r2
49 movd $__DATA_IMAGE_START, r3
57 #----------------------------------------------------------------------------#
58 # Initialize the intbase (pointer to the dispatch table). #
60 movd $__dispatch_table, r0
63 #----------------------------------------------------------------------------#
64 # Handle global and static constructurs execution and setup #
65 # destructors to be called from exit. #
70 #----------------------------------------------------------------------------#
71 # Here you may add initializations that are specific to your #
72 # environment. For example: #
73 # 1. Configure wait states and other BIU parameters in order to get #
74 # the best performance out of your target (see the specification #
76 # 2. Enable maskable interrupts that should be enabled when your #
77 # program starts to execute. #
80 #----------------------------------------------------------------------------#
81 # Jump to the main function in your application. #
85 #----------------------------------------------------------------------------#
86 # Upon returning from the main function (if it isn't an infinite loop), #
87 # jump to the exit function. The exit function is located in the #
90 movd r0, r2 # _main return value is passed as a
92 br _exit # returns control to the debugger.