source: ssp_qb_r5f100le_cs/trunk/arch/rl78_ca78k0r/start.asm@ 93

Last change on this file since 93 was 93, checked in by nmir-saito, 8 years ago

add Combined package of SSP kernel for QB-R5F100LE-TB(RL78 processor)

File size: 4.6 KB
Line 
1;
2; TOPPERS/SSP Kernel
3; Smallest Set Profile Kernel
4;
5; Copyright (C) 2014 by Naoki Saito
6; Nagoya Municipal Industrial Research Institute, JAPAN
7;
8; ã‹L’˜ìŒ ŽÒ‚́CˆÈ‰º‚Ì (1)`(4) ‚ÌðŒ‚ð–ž‚½‚·ê‡‚ÉŒÀ‚èC–{ƒ\ƒtƒgƒEƒF
9; ƒAi–{ƒ\ƒtƒgƒEƒFƒA‚ð‰ü•Ï‚µ‚½‚à‚Ì‚ðŠÜ‚ށDˆÈ‰º“¯‚¶j‚ðŽg—pE•¡»E‰ü•ÏE
10; Ä”z•ziˆÈ‰ºC—˜—p‚ƌĂԁj‚·‚邱‚Ƃ𖳏ž‚Å‹–‘ø‚·‚éD
11; (1) –{ƒ\ƒtƒgƒEƒFƒA‚ðƒ\[ƒXƒR[ƒh‚ÌŒ`‚Å—˜—p‚·‚éê‡‚ɂ́Cã‹L‚Ì’˜ìŒ 
12; •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’肪C‚»‚Ì‚Ü‚Ü‚ÌŒ`‚Ń\[ƒX
13; ƒR[ƒh’†‚ÉŠÜ‚Ü‚ê‚Ä‚¢‚邱‚ƁD
14; (2) –{ƒ\ƒtƒgƒEƒFƒA‚ðCƒ‰ƒCƒuƒ‰ƒŠŒ`Ž®‚ȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg—p
15; ‚Å‚«‚éŒ`‚ōĔz•z‚·‚éê‡‚ɂ́CÄ”z•z‚É”º‚¤ƒhƒLƒ…
16ƒƒ“ƒgi—˜—pŽÒƒ}
17; ƒjƒ…
18ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•Û
19; Ø‹K’è‚ðŒfÚ‚·‚邱‚ƁD
20; (3) –{ƒ\ƒtƒgƒEƒFƒA‚ðC‹@Ší‚É‘g‚ݍž‚ނȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg—p
21; ‚Å‚«‚È‚¢Œ`‚ōĔz•z‚·‚éê‡‚ɂ́CŽŸ‚Ì‚¢‚¸‚ê‚©‚ÌðŒ‚ð–ž‚½‚·‚±‚ƁD
22; (a) Ä”z•z‚É”º‚¤ƒhƒLƒ…
23ƒƒ“ƒgi—˜—pŽÒƒ}ƒjƒ…
24ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜ì
25; Œ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
26; (b) Ä”z•z‚ÌŒ`‘Ô‚ðC•Ê‚É’è‚ß‚é•û–@‚É‚æ‚Á‚āCTOPPERSƒvƒƒWƒFƒNƒg‚É•ñ
27; ‚·‚邱‚ƁD
28; (4) –{ƒ\ƒtƒgƒEƒFƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚é‚¢‚©‚Ȃ鑹ŠQ
29; ‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð–Ɛӂ·‚邱‚ƁD‚Ü‚½C
30; –{ƒ\ƒtƒgƒEƒFƒA‚̃†[ƒU‚Ü‚½‚̓Gƒ“ƒhƒ†[ƒU‚©‚ç‚Ì‚¢‚©‚Ȃ闝—R‚ÉŠî‚Ã
31; ‚­¿‹‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð–Ɛӂ·‚邱‚ƁD
32;
33; –{ƒ\ƒtƒgƒEƒFƒA‚́C–³•ÛØ‚Å’ñ‹Ÿ‚³‚ê‚Ä‚¢‚é‚à‚Ì‚Å‚ ‚éDã‹L’˜ìŒ ŽÒ‚¨‚æ
34; ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚́C–{ƒ\ƒtƒgƒEƒFƒA‚ÉŠÖ‚µ‚āC“Á’è‚ÌŽg—p–Ú“I‚ɑ΂·
35; ‚é“K‡«‚àŠÜ‚߂āC‚¢‚©‚È‚é•ÛØ‚às‚í‚È‚¢D‚Ü‚½C–{ƒ\ƒtƒgƒEƒFƒA‚Ì—˜—p
36; ‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚½‚¢‚©‚Ȃ鑹ŠQ‚ÉŠÖ‚µ‚Ä‚àC‚»‚̐ӔC‚ð•‰
37; ‚í‚È‚¢D
38;
39;
40
41;
42; ƒXƒ^[ƒgƒAƒbƒvƒ‹[ƒ`ƒ“
43; ƒvƒƒZƒbƒT‚ÍS2ƒRƒACƒ~ƒfƒBƒAƒ€ƒ‚ƒfƒ‹‚ð‘ΏۂƂ·‚é
44;
45
46;
47; ƒOƒ[ƒoƒ‹ƒVƒ“ƒ{ƒ‹
48;
49 ; ƒZƒOƒƒ“ƒgæ“ªƒAƒhƒŒƒX(segment_s.asm)
50 extrn _@R_INIT, _@R_INIS, _@RLINIT
51 extrn _@INIT, _@DATA, _@INIS, _@DATS, _@INITL, _@DATAL
52
53 ; ƒZƒOƒƒ“ƒg––”öƒAƒhƒŒƒX(segment_e.asm)
54 extrn _?R_INIT, _?R_INIS, _?RLINIT
55 extrn _?INIT, _?DATA, _?INIS, _?DATS, _?INITL, _?DATAL
56
57 ; ƒXƒ^ƒbƒNƒ|ƒCƒ“ƒ^‚̏‰Šú’l(kernel_cfg.c)
58 extrn __kernel_istkpt
59
60 ; ƒJ[ƒlƒ‹ŠJŽnˆ—(kernel/startup.c)
61 extrn _sta_ker
62
63 ; saddr—̈æ‚̐擪ƒAƒhƒŒƒXCƒTƒCƒYiƒŠƒ“ƒJ‚Å’è‹`j
64 extrn _@SADBEG, _@SADSIZ
65
66 ; ƒGƒ“ƒgƒŠƒ|ƒCƒ“ƒg
67 public _start
68
69
70;
71; ’萔’è‹`
72;
73 ; MAA(PMC‚̃rƒbƒg0): 0 ‚Ü‚½‚Í 1
74 ; 0‚̏ꍇC00000H--0FFFFH ‚ð F0000H--FFFFFH‚Öƒ~ƒ‰[
75 ; 1‚̏ꍇC10000H--1FFFFH ‚ð F0000H--FFFFFH‚Öƒ~ƒ‰[
76INIT_MAA EQU 0
77
78;
79; ƒ}ƒNƒ’è‹`
80;
81 ; ƒZƒOƒƒ“ƒgŠÔ‚̃f[ƒ^ƒRƒs[(far‚ÌROM‚©‚çnear‚ÌRAM‚ցCsrc‚̃TƒCƒY•ª)
82copy_seg macro src, dst
83 local _1, _2
84 mov es, #highw _@&src
85 movw hl, #loww _@&src
86 movw de, #loww _@&dst
87 br $_2
88_1:
89 mov a, es:[hl]
90 mov [de], a
91 incw hl
92 incw de
93_2:
94 movw ax, hl
95 cmpw ax, #loww _?&src
96 bnz $_1
97 endm
98
99 ; ƒZƒOƒƒ“ƒgŠÔ‚̃f[ƒ^ƒRƒs[(far‚ÌROM‚©‚çfar‚ÌRAM‚ցCsrc‚̃TƒCƒY•ª)
100copy_fseg MACRO src, dst
101 local _1, _2
102 movw hl, #loww _@&src
103 movw de, #loww _@&dst
104 br $_2
105_1:
106 mov es, #highw _@&src
107 mov a, es:[hl]
108 mov es, #highw _@&dst
109 mov es:[de], a
110 incw hl
111 incw de
112_2:
113 movw ax, hl
114 cmpw ax, #loww _?&src
115 bnz $_1
116 endm
117
118 ; ƒZƒOƒƒ“ƒg‚̃f[ƒ^ƒNƒŠƒA(near RAM)
119clear_seg MACRO dst
120 local _1, _2
121 mov es, #0fh
122 movw hl, #loww _@&dst
123 movw ax, #loww _?&dst
124 br $_2
125_1:
126 mov [hl+0], #0
127 incw hl
128_2:
129 cmpw ax, hl
130 bnz $_1
131 endm
132
133 ; ƒZƒOƒƒ“ƒg‚̃f[ƒ^ƒNƒŠƒA(far RAM)
134clear_fseg MACRO dst
135 local _1, _2
136 mov es, #highw _@&dst
137 movw hl, #loww _@&dst
138 movw ax, #loww _?&dst
139 br $_2
140_1:
141 mov es:[hl+0], #0
142 incw hl
143_2:
144 cmpw ax, hl
145 bnz $_1
146 endm
147
148;
149; ƒVƒXƒeƒ€ŠJŽn
150;
151@@CODE CSEG BASE
152_start:
153
154 ;
155 ; PSW‚̐ݒè
156 ;
157 di ; Š„ž‚Ý‹ÖŽ~(Š„ž‚݃ƒbƒN‘Š“–‚ÌŠ„ž‚Ý‹ÖŽ~)
158 sel rb0 ; ƒŒƒWƒXƒ^ƒoƒ“ƒN(RB0)
159
160 ;
161 ; ƒ~ƒ‰[—̈æ‚̐ݒè
162 ;
163 mov a, #INIT_MAA
164 mov1 cy, a.0
165 mov1 maa, cy
166
167 ;
168 ; ƒXƒ^ƒbƒNƒ|ƒCƒ“ƒ^‚̐ݒè
169 ;
170 movw de, #__kernel_istkpt
171 mov es, #00H
172 movw ax, es:[de]
173 movw sp, ax
174
175 ;
176 ; _hardware_init_hook ‚̌Ăяo‚µ(‚à‚µ‚ ‚ê‚Î)
177 ;
178 ;call !!_hardware_init_hook
179
180 ;
181 ; ƒƒ‚ƒŠ‰Šú‰»
182 ;
183 copy_seg R_INIS, INIS
184 copy_seg R_INIT, INIT
185 copy_fseg RLINIT, INITL
186
187 clear_seg DATS
188 clear_seg DATA
189 clear_fseg DATAL
190
191 ; saddr—̈æ‚̏‰Šú‰»
192 mov b,#_@SADSIZ
193 clrw ax
194saddr_init_loop:
195 dec b
196 dec b
197 movw _@SADBEG[b], ax
198 bnz $saddr_init_loop
199
200 ;
201 ; _sofrware_init_hook ‚̌Ăяo‚µ(‚à‚µ‚ ‚ê‚Î)
202 ;
203 ;call !!_software_init_hook
204
205 ;
206 ; sta_ker (kernel/startup.c) ‚̌Ăяo‚µ
207 ;
208 br !!_sta_ker
209
210_loop:
211 br $_loop
212
213 END
Note: See TracBrowser for help on using the repository browser.