aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/xstormy16/below100.S
blob: 27faa2ef4cea3a6f1433b28feed2394a6ad346b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/******************************************************************
***                                                             ***
***     crt0 for __BELOW100__ attribute test with SID           ***
***                                                             ***
******************************************************************/

                                /*************************************/
                                /** Interrupt vectors at 0x8000     **/
                                /*************************************/
        .section .int_vec,"ax"
        .global _start
        .align 1
_start:
        jmpf _int_reset
        //jmpf _int_basetimer
        //jmpf _int_timer0
        //jmpf _int_timer1
        //jmpf _int_irq_4
        //jmpf _int_irq_5
        //jmpf _int_port0
        //jmpf _int_port1
        //jmpf _int_irq_8
        //jmpf _int_irq_9
        //jmpf _int_irq_a
        //jmpf _int_irq_b
        //jmpf _int_irq_c
        //jmpf _int_irq_d
        //jmpf _int_irq_e
        //jmpf _int_irq_f
                                /*************************************/
                                /** reset code                      **/
                                /*************************************/
        .text
_int_reset:
                                /*************************************/
                                /** setup stack pointer             **/
                                /*************************************/
        mov sp,#__stack
                                /*************************************/
                                /** zero .bss section               **/
                                /*************************************/
        mov r0,#__bss_start
        mov r1,#__bss_end
        mov r2,#0
1:      mov.w (r0++),r2
        blt r0,r1,1b
                                /*************************************/
                                /** copy inital value for .data     **/
                                /*************************************/
        mov r1,#__data_start
        mov r3,#__data_end
        mov r0,#@lo(__rdata)
        mov r8,#@hi(__rdata)
2:      movf.w r2,(r0++)
        bnz r0,#0,3f
        add r8,#1
3:      mov.w (r1++),r2
        blt r1,r3,2b
                                /*************************************/
                                /** call hardware init routine      **/
                                /*************************************/
        callf _hwinit
                                /*************************************/
                                /** call initializaton routines     **/
                                /*************************************/
        callf _init
                                /*************************************/
                                /** setup fini routines to be       **/
                                /**  called from exit               **/
                                /*************************************/
        mov r2,#@fptr(_fini)
        callf atexit
                                /*************************************/
                                /** call main() with empty          **/
                                /**  argc/argv/envp                 **/
                                /*************************************/
        mov r2,#0
        mov r3,#0
        mov r4,#0
        callf main
                                /*************************************/
                                /** return from main()              **/
                                /*************************************/
        callf exit
                                /*************************************/
                                /** should never reach this code    **/
                                /*************************************/
        jmpf _start
                                /*************************************/
                                /** default h/w initialize routine  **/
                                /** and default _init/_finit for    **/
                                /**  -nostartfiles option           **/
                                /*************************************/
        .globl _hwinit
        .weak _hwinit
_hwinit:
        .globl _init
        .weak _init
_init:
        .globl _fini
        .weak _fini
_fini:
        ret

/******************************************************************
*******************************************************************
***                                                             ***
***       Chip information data for LC59_32K                    ***
***                 Written by T.Matsukawa                      ***
***                                                             ***
*******************************************************************
******************************************************************/

                                /*************************************/
                                /** Define convenient macros        **/
                                /*************************************/
#define BCD(x)  (((x)/10)%10)*0x10+((x)%10)
#define BCD4(x) BCD((x)/100),BCD(x)
#define BCD6(x) BCD((x)/10000),BCD((x)/100),BCD(x)
                                /*************************************/
                                /** Define memory sizes             **/
                                /*************************************/
#define RAM_SIZE 0x7E00
#define ROM_SIZE 0x78000
#define VRAM_SIZE 0x0000
#define VRAM_ROW 0
#define VRAM_COLUMN 0
#define CGROM_SIZE 0x0000
#define PROTECT_SIZE 0x0000

                                /*************************************/
                                /** section ".chip_info"            **/
                                /*************************************/
        .section .chip_info,"a"
        .space  0xb8,0x00
                                /*************************************/
                                /** B8-BB : User option address     **/
                                /*************************************/
        .word   0x00000
        .global __reset_vector
#if 0x00000==0
        .equ    __reset_vector,0x08000
#else
        .equ    __reset_vector,0x00000
#endif
                                /*************************************/
                                /** BC-BF : Flash Protect address   **/
                                /*************************************/
#if PROTECT_SIZE==0
        .word   0x00000000
#else
        .word   0x08000+ROM_SIZE-PROTECT_SIZE
#endif
                                /*************************************/
                                /** C0-CF : Fixed string            **/
                                /*************************************/
1:	.ascii  "CHIPINFORMATION"
2:	.space  (0x10-(2b-1b)),0x00
                                /*************************************/
                                /** D0-DF : Chipname                **/
                                /*************************************/
1:	.ascii  "LC59_32K"
2:	.space  (0x10-(2b-1b)),0x00
                                /*************************************/
                                /** E0-E1 : Format version(BCD4)    **/
                                /*************************************/
        .byte   0x10, 0x00
        .space  6, 0x00
                                /*************************************/
                                /** E8-F5 : Memory sizes            **/
                                /*************************************/
        .byte   BCD4(ROM_SIZE/1024)
        .byte   BCD6(RAM_SIZE)
        .byte   BCD6(VRAM_SIZE)
        .byte   BCD4(VRAM_ROW)
        .byte   BCD4(VRAM_COLUMN)
        .byte   BCD4(CGROM_SIZE/1024)
        .space  3, 0x00
                                /*************************************/
                                /** F9 : Package type               **/
                                /*************************************/
        .byte   0xff
        .space  6, 0x00

                                /*************************************/
                                /** In order to link BIOS in library**/
                                /*************************************/
        .equ    dummy,__bios_entry