-
Notifications
You must be signed in to change notification settings - Fork 2
/
sect30.inc
335 lines (276 loc) · 9.01 KB
/
sect30.inc
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
;***************************************************************************
; C Compiler for R8C/Tiny, M16C/60,30,20,10
; Copyright(C) 1999(2000-2006). Renesas Technology Corp.
; and Renesas Solutions Corp., All rights reserved.
;
; sect30.inc : section definition for M16C family
;
; $Date: 2007/01/09 04:38:46 $
; $Revision: 1.1.4.1 $
;***************************************************************************
;=====================================================================
;
; Arrangement of section
;
;---------------------------------------------------------------------
; Near RAM data area
;---------------------------------------------------------------------
; SBDATA area
.section data_SE,DATA
.org 480H
data_SE_top:
.section bss_SE,DATA,ALIGN
bss_SE_top:
.section data_SO,DATA
data_SO_top:
.section bss_SO,DATA
bss_SO_top:
; SBDATA area definition
.glb __SB__
__SB__ .equ data_SE_top
; near RAM area
.section data_NE,DATA,ALIGN
data_NE_top:
.section bss_NE,DATA,ALIGN
bss_NE_top:
.section data_NO,DATA
data_NO_top:
.section bss_NO,DATA
bss_NO_top:
;---------------------------------------------------------------------
; Stack area
;---------------------------------------------------------------------
.section stack,DATA,ALIGN
.blkb __ISTACKSIZE__
istack_top:
.if __STACKSIZE__ != 0
.blkb __STACKSIZE__
stack_top:
.endif
;---------------------------------------------------------------------
; heap section
;---------------------------------------------------------------------
.if __HEAPSIZE__ != 0
.section heap,DATA
heap_top:
.blkb __HEAPSIZE__
.endif
;---------------------------------------------------------------------
; Near ROM data area
;---------------------------------------------------------------------
.if __NEAR_ROM_FLG__ != 0
.section rom_NE,ROMDATA
.org 0F000H
rom_NE_top:
.section rom_NO,ROMDATA
rom_NO_top:
.endif
;---------------------------------------------------------------------
; Far RAM data area
;---------------------------------------------------------------------
.if __FAR_RAM_FLG__ != 0
.section data_FE,DATA
.org 10000H
data_FE_top:
.section bss_FE,DATA,ALIGN
bss_FE_top:
.section data_FO,DATA
data_FO_top:
.section bss_FO,DATA
bss_FO_top:
.endif
;---------------------------------------------------------------------
; Far ROM data area
;---------------------------------------------------------------------
.section rom_FE,ROMDATA
.org __ROM_TOPADR__
rom_FE_top:
.section rom_FO,ROMDATA
rom_FO_top:
;---------------------------------------------------------------------
; Initial data of 'data' section
;---------------------------------------------------------------------
.section data_SEI,ROMDATA,ALIGN
data_SEI_top:
.section data_SOI,ROMDATA
data_SOI_top:
.section data_NEI,ROMDATA,ALIGN
data_NEI_top:
.section data_NOI,ROMDATA
data_NOI_top:
.if __FAR_RAM_FLG__ != 0
.section data_FEI,ROMDATA,ALIGN
data_FEI_top:
.section data_FOI,ROMDATA
data_FOI_top:
.endif
;---------------------------------------------------------------------
; Switch Table Section
;---------------------------------------------------------------------
; .section switch_table,ROMDATA
;switch_table_top:
;---------------------------------------------------------------------
; code area
;---------------------------------------------------------------------
.section program,CODE,ALIGN
.section interrupt,CODE,ALIGN
.section program_S,CODE,ALIGN
;---------------------------------------------------------------------
; variable vector section
;---------------------------------------------------------------------
.section vector,ROMDATA
.org __VECTOR_ADR__
.if 1
.lword dummy_int ; vector 0 BRK
.lword dummy_int ; vector 1
.lword dummy_int ; vector 2
.lword dummy_int ; vector 3
.lword dummy_int ; vector 4 (for user) int3
.lword dummy_int ; vector 5 (for user) timerB5
.lword dummy_int ; vector 6 (for user) timerB4
.lword dummy_int ; vector 7 (for user) timerB3
.lword dummy_int ; vector 8 (for user) si/o4/int5
.lword dummy_int ; vector 9 (for user) si/o3/int4
.lword dummy_int ; vector 10 (for user) Bus collision detection
.glb _DMA0Interrupt
.lword _DMA0Interrupt ; vector 11 (for user) DMA0
.lword dummy_int ; vector 12 (for user) DMA1
.glb _KeyBoardInterrupt
.lword _KeyBoardInterrupt ; vector 13 (for user) Key input interrupt
.glb _A2DInterrupt
.lword _A2DInterrupt
.lword dummy_int ; vector 15 (for user) uart2 transmit
.glb _UART2ReceiveInterrupt ; vector 16 (for user) uart2 receive
.lword _UART2ReceiveInterrupt
.glb _UART0TransmitInterrupt
.lword _UART0TransmitInterrupt
.glb _UART0ReceiveInterrupt
.lword _UART0ReceiveInterrupt
.lword dummy_int ; vector 19 (for user) uart1 transmit
.lword dummy_int ; vector 20 (for user) uart1 receive
.glb _TimerA0Interrupt ;
.lword _TimerA0Interrupt ; vector 21 (for user) timer A0
.glb _TimerA1Interrupt ; vector 22 (for user) timer A1
.lword _TimerA1Interrupt
.glb _TimerA2Interrupt
.lword _TimerA2Interrupt
.lword dummy_int ; vector 24 (for user) timer A3
.glb _MiddleBtnInterrupt ; vector 25 (for user) timer A4 aka Middle Switch
.lword _MiddleBtnInterrupt
.glb _TimerB0Interrupt ; (vector 26)
.lword _TimerB0Interrupt
.glb _RTCInterrupt
.lword _RTCInterrupt ; Timer B1 (vector 27)
.lword dummy_int ; vector 28 (for user) timer B2
.glb _RightBtnInterrupt ; vector 29 (for user) int0 aka Right Switch
.lword _RightBtnInterrupt ;
.glb _LeftBtnInterrupt
.lword _LeftBtnInterrupt ; (vector 30)INT1 aka Left Switch
.lword dummy_int ; vector 31 (for user) int2
.lword dummy_int ; vector 32 (for user or MR30)
.lword dummy_int ; vector 33 (for user or MR30)
.lword dummy_int ; vector 34 (for user or MR30)
.lword dummy_int ; vector 35 (for user or MR30)
.lword dummy_int ; vector 36 (for user or MR30)
.lword dummy_int ; vector 37 (for user or MR30)
.lword dummy_int ; vector 38 (for user or MR30)
.lword dummy_int ; vector 39 (for user or MR30)
.lword dummy_int ; vector 40 (for user or MR30)
.lword dummy_int ; vector 41 (for user or MR30)
.lword dummy_int ; vector 42 (for user or MR30)
.lword dummy_int ; vector 43 (for user or MR30)
.lword dummy_int ; vector 44 (for user or MR30)
.lword dummy_int ; vector 45 (for user or MR30)
.lword dummy_int ; vector 46 (for user or MR30)
.lword dummy_int ; vector 47 (for user or MR30)
.lword dummy_int ; vector 48
.lword dummy_int ; vector 49
.lword dummy_int ; vector 50
.lword dummy_int ; vector 51
.lword dummy_int ; vector 52
.lword dummy_int ; vector 53
.lword dummy_int ; vector 54
.lword dummy_int ; vector 55
.lword dummy_int ; vector 56
.lword dummy_int ; vector 57
.lword dummy_int ; vector 58
.lword dummy_int ; vector 59
.lword dummy_int ; vector 60
.lword dummy_int ; vector 61
.lword dummy_int ; vector 62
.lword dummy_int ; vector 63
.endif
;---------------------------------------------------------------------
; fixed vector section
;---------------------------------------------------------------------
.section fvector,ROMDATA
.org 0fffdcH
UDI:
.lword dummy_int
OVER_FLOW:
.lword dummy_int
BRKI:
.lword dummy_int
ADDRESS_MATCH:
.lword dummy_int
SINGLE_STEP:
.lword dummy_int
WDT:
.glb _WatchDogInterrupt
.lword _WatchDogInterrupt
DBC:
.lword dummy_int
NMI:
.lword dummy_int
RESET:
.lword start
;=====================================================================
; ID code & ROM code protect
;---------------------------------------------------------------------
; ID code check function
.id "#FFFFFFFFFFFFFF"
; ROM code protect control address
; .protect 00H
;=====================================================================
; Initialize Macro declaration
;---------------------------------------------------------------------
N_BZERO .macro TOP_,SECT_
mov.b #00H,R0L
mov.w #(TOP_ & 0FFFFH),A1
mov.w #sizeof SECT_,R3
sstr.b
.endm
N_BCOPY .macro FROM_,TO_,SECT_
mov.w #(FROM_ & 0FFFFH),A0
mov.b #(FROM_ >> 16),R1H
mov.w #TO_,A1
mov.w #sizeof SECT_,R3
smovf.b
.endm
BZERO .macro TOP_,SECT_
push.w #sizeof SECT_ >> 16
push.w #sizeof SECT_ & 0ffffh
pusha TOP_ >> 16
pusha TOP_ & 0ffffh
.stk 8
.glb _bzero
.call _bzero,G
jsr.a _bzero
.endm
BCOPY .macro FROM_ ,TO_ ,SECT_
push.w #sizeof SECT_ >> 16
push.w #sizeof SECT_ & 0ffffh
pusha TO_ >> 16
pusha TO_ & 0ffffh
pusha FROM_ >> 16
pusha FROM_ & 0ffffh
.stk 12
.glb _bcopy
.call _bcopy,G
jsr.a _bcopy
.endm
;***************************************************************************
; C Compiler for R8C/Tiny, M16C/60,30,20,10
; Copyright(C) 1999(2000-2006). Renesas Technology Corp.
; and Renesas Solutions Corp., All rights reserved.
;***************************************************************************