1 |
786 |
skrzyp |
##=============================================================================
|
2 |
|
|
##
|
3 |
|
|
## platform.S
|
4 |
|
|
##
|
5 |
|
|
## Fujitsu Starterkit MB91302 platform code
|
6 |
|
|
##
|
7 |
|
|
##=============================================================================
|
8 |
|
|
## ####ECOSGPLCOPYRIGHTBEGIN####
|
9 |
|
|
## -------------------------------------------
|
10 |
|
|
## This file is part of eCos, the Embedded Configurable Operating System.
|
11 |
|
|
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
12 |
|
|
##
|
13 |
|
|
## eCos is free software; you can redistribute it and/or modify it under
|
14 |
|
|
## the terms of the GNU General Public License as published by the Free
|
15 |
|
|
## Software Foundation; either version 2 or (at your option) any later
|
16 |
|
|
## version.
|
17 |
|
|
##
|
18 |
|
|
## eCos is distributed in the hope that it will be useful, but WITHOUT
|
19 |
|
|
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
20 |
|
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
21 |
|
|
## for more details.
|
22 |
|
|
##
|
23 |
|
|
## You should have received a copy of the GNU General Public License
|
24 |
|
|
## along with eCos; if not, write to the Free Software Foundation, Inc.,
|
25 |
|
|
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
26 |
|
|
##
|
27 |
|
|
## As a special exception, if other files instantiate templates or use
|
28 |
|
|
## macros or inline functions from this file, or you compile this file
|
29 |
|
|
## and link it with other works to produce a work based on this file,
|
30 |
|
|
## this file does not by itself cause the resulting work to be covered by
|
31 |
|
|
## the GNU General Public License. However the source code for this file
|
32 |
|
|
## must still be made available in accordance with section (3) of the GNU
|
33 |
|
|
## General Public License v2.
|
34 |
|
|
##
|
35 |
|
|
## This exception does not invalidate any other reasons why a work based
|
36 |
|
|
## on this file might be covered by the GNU General Public License.
|
37 |
|
|
## -------------------------------------------
|
38 |
|
|
## ####ECOSGPLCOPYRIGHTEND####
|
39 |
|
|
##=============================================================================
|
40 |
|
|
#######DESCRIPTIONBEGIN####
|
41 |
|
|
##
|
42 |
|
|
## Author(s): larsi
|
43 |
|
|
## Contributors:
|
44 |
|
|
## Date: 2007-07-09
|
45 |
|
|
## Purpose: Fujitsu Starterkit MB91302 platform code
|
46 |
|
|
## Description: Platform specific code for Fujitsu Starterkit MB91302 board.
|
47 |
|
|
##
|
48 |
|
|
##
|
49 |
|
|
##
|
50 |
|
|
##
|
51 |
|
|
######DESCRIPTIONEND####
|
52 |
|
|
##
|
53 |
|
|
##=============================================================================
|
54 |
|
|
|
55 |
|
|
#include
|
56 |
|
|
#include
|
57 |
|
|
|
58 |
|
|
#ifdef CYGPKG_KERNEL
|
59 |
|
|
# include
|
60 |
|
|
#endif
|
61 |
|
|
|
62 |
|
|
#include
|
63 |
|
|
|
64 |
|
|
##-----------------------------------------------------------------------------
|
65 |
|
|
## platforms special entry point.
|
66 |
|
|
## it copies the code from hal_fr30_ram_startup_trampoline until
|
67 |
|
|
## hal_fr30_ram_startup_trampoline_end to ram and jumps there. The code there
|
68 |
|
|
## is for mapping the flash to 0x1000000 and then jumping to real entry
|
69 |
|
|
## (_start).
|
70 |
|
|
|
71 |
|
|
#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM)
|
72 |
|
|
|
73 |
|
|
.section ".rom_startup_trampoline","ax"
|
74 |
|
|
|
75 |
|
|
.balign 4
|
76 |
|
|
.global hal_fr30_rom_startup_trampoline
|
77 |
|
|
hal_fr30_rom_startup_trampoline:
|
78 |
|
|
# disable interrupts and set priority to lowest (=disable)
|
79 |
|
|
andccr #0xef
|
80 |
|
|
stilm #0x0
|
81 |
|
|
|
82 |
|
|
ldi:32 #__rom_trampoline_start - 4, r11
|
83 |
|
|
ldi:32 #__ram_trampoline_start - 4, r13
|
84 |
|
|
ldi:32 #__rom_trampoline_end - 8, r12
|
85 |
|
|
1:
|
86 |
|
|
add #0x4, r11
|
87 |
|
|
add #0x4, r13
|
88 |
|
|
ld @r11, r0
|
89 |
|
|
cmp r12, r11
|
90 |
|
|
ble:d 1b
|
91 |
|
|
st r0, @r13
|
92 |
|
|
|
93 |
|
|
## jump to the code in ram
|
94 |
|
|
ldi:32 #hal_fr30_ram_startup_trampoline, r0
|
95 |
|
|
jmp @r0
|
96 |
|
|
|
97 |
|
|
#endif
|
98 |
|
|
|
99 |
|
|
##-----------------------------------------------------------------------------
|
100 |
|
|
# Platform Initialization.
|
101 |
|
|
# This code is copied to a location in RAM on startup and is executed there.
|
102 |
|
|
# It maps the the FLASH chip to 0x1000000 and sets the TBR to the new location
|
103 |
|
|
# of the hardware vector table (hal_fr30_vector_table). So we can reach the full
|
104 |
|
|
# range of the FLASH and it can be used for flashfilesystem. After that it jumps
|
105 |
|
|
# to the real application.
|
106 |
|
|
|
107 |
|
|
#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM)
|
108 |
|
|
|
109 |
|
|
.section ".ram_startup_trampoline","ax"
|
110 |
|
|
|
111 |
|
|
.balign 4
|
112 |
|
|
.global hal_fr30_ram_startup_trampoline
|
113 |
|
|
hal_fr30_ram_startup_trampoline:
|
114 |
|
|
hal_flash_init_from_ram
|
115 |
|
|
|
116 |
|
|
## map TBR to the new location (for vector tables)
|
117 |
|
|
ldi:32 #0x10ffc00, r0
|
118 |
|
|
mov r0, tbr
|
119 |
|
|
|
120 |
|
|
## jump to real startup
|
121 |
|
|
ldi:32 #_start, r0
|
122 |
|
|
jmp @r0
|
123 |
|
|
|
124 |
|
|
#endif
|
125 |
|
|
|
126 |
|
|
|
127 |
|
|
#==============================================================================
|
128 |
|
|
# Vector table for storage in flash, version for skmb91302 platform.
|
129 |
|
|
# it differs from variants/archs version in that uses a different reset vector
|
130 |
|
|
# that points to the special startup procedure that jumps to the normal entry
|
131 |
|
|
# (_start) later.
|
132 |
|
|
# base address is 0x000FFC00 and 0x10ffc00 after remapping the flash.
|
133 |
|
|
# This address stores the vector address for number 255
|
134 |
|
|
# address 0x000FFFFC (0x10ffffc) is the last vector, the reset vector, which
|
135 |
|
|
# is not alterable. Vectors 255 to 80 are used by the INT instruction and set
|
136 |
|
|
# to 0 here for now ...
|
137 |
|
|
|
138 |
|
|
|
139 |
|
|
#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM)
|
140 |
|
|
|
141 |
|
|
.section ".rom_vectors","ax"
|
142 |
|
|
|
143 |
|
|
.balign 4
|
144 |
|
|
.global hal_fr30_vector_table
|
145 |
|
|
hal_fr30_vector_table:
|
146 |
|
|
.rept 255-80 + 1
|
147 |
|
|
.long 0x0
|
148 |
|
|
.endr
|
149 |
|
|
.rept 79-67 + 1
|
150 |
|
|
.long 0x0
|
151 |
|
|
.endr
|
152 |
|
|
|
153 |
|
|
.long 0x0
|
154 |
|
|
.long 0x0
|
155 |
|
|
.long 0x0
|
156 |
|
|
# number 63 first interrupt source
|
157 |
|
|
.long hal_fr30_irq_63
|
158 |
|
|
.long hal_fr30_irq_62
|
159 |
|
|
.long hal_fr30_irq_61
|
160 |
|
|
.long hal_fr30_irq_60
|
161 |
|
|
.long hal_fr30_irq_59
|
162 |
|
|
.long hal_fr30_irq_58
|
163 |
|
|
.long hal_fr30_irq_57
|
164 |
|
|
.long hal_fr30_irq_56
|
165 |
|
|
.long hal_fr30_irq_55
|
166 |
|
|
.long hal_fr30_irq_54
|
167 |
|
|
.long hal_fr30_irq_53
|
168 |
|
|
.long hal_fr30_irq_52
|
169 |
|
|
.long hal_fr30_irq_51
|
170 |
|
|
.long hal_fr30_irq_50
|
171 |
|
|
.long hal_fr30_irq_49
|
172 |
|
|
.long hal_fr30_irq_48
|
173 |
|
|
.long hal_fr30_irq_47
|
174 |
|
|
.long hal_fr30_irq_46
|
175 |
|
|
.long hal_fr30_irq_45
|
176 |
|
|
.long hal_fr30_irq_44
|
177 |
|
|
.long hal_fr30_irq_43
|
178 |
|
|
.long hal_fr30_irq_42
|
179 |
|
|
.long hal_fr30_irq_41
|
180 |
|
|
.long hal_fr30_irq_40
|
181 |
|
|
.long hal_fr30_irq_39
|
182 |
|
|
.long hal_fr30_irq_38
|
183 |
|
|
.long hal_fr30_irq_37
|
184 |
|
|
.long hal_fr30_irq_36
|
185 |
|
|
.long hal_fr30_irq_35
|
186 |
|
|
.long hal_fr30_irq_34
|
187 |
|
|
.long hal_fr30_irq_33
|
188 |
|
|
.long hal_fr30_irq_32
|
189 |
|
|
.long hal_fr30_irq_31
|
190 |
|
|
.long hal_fr30_irq_30
|
191 |
|
|
.long hal_fr30_irq_29
|
192 |
|
|
.long hal_fr30_irq_28
|
193 |
|
|
.long hal_fr30_irq_27
|
194 |
|
|
.long hal_fr30_irq_26
|
195 |
|
|
.long hal_fr30_irq_25
|
196 |
|
|
.long hal_fr30_irq_24
|
197 |
|
|
.long hal_fr30_irq_23
|
198 |
|
|
.long hal_fr30_irq_22
|
199 |
|
|
.long hal_fr30_irq_21
|
200 |
|
|
.long hal_fr30_irq_20
|
201 |
|
|
.long hal_fr30_irq_19
|
202 |
|
|
.long hal_fr30_irq_18
|
203 |
|
|
.long hal_fr30_irq_17
|
204 |
|
|
.long hal_fr30_irq_16
|
205 |
|
|
.long hal_fr30_irq_15
|
206 |
|
|
.long hal_fr30_exception_noerr_14
|
207 |
|
|
.long hal_fr30_exception_noerr_13
|
208 |
|
|
.long hal_fr30_exception_noerr_12
|
209 |
|
|
.long hal_fr30_exception_noerr_11
|
210 |
|
|
.long hal_fr30_exception_noerr_10
|
211 |
|
|
.long hal_fr30_exception_noerr_9
|
212 |
|
|
.long hal_fr30_exception_noerr_8
|
213 |
|
|
.long hal_fr30_exception_noerr_7
|
214 |
|
|
.long hal_fr30_exception_noerr_6
|
215 |
|
|
.long hal_fr30_exception_noerr_5
|
216 |
|
|
.long hal_fr30_exception_noerr_4
|
217 |
|
|
.long hal_fr30_exception_noerr_3
|
218 |
|
|
.long hal_fr30_exception_noerr_2
|
219 |
|
|
|
220 |
|
|
# mode vector (only the first of the four byte is relevant)
|
221 |
|
|
.byte 0x1
|
222 |
|
|
.byte 0
|
223 |
|
|
.byte 0
|
224 |
|
|
.byte 0
|
225 |
|
|
|
226 |
|
|
# reset vector
|
227 |
|
|
.long hal_fr30_rom_startup_trampoline
|
228 |
|
|
|
229 |
|
|
#endif /*CYG_HAL_STARTUP_ROM || CYG_HAL_STARTUP_ROMRAM*/
|
230 |
|
|
|
231 |
|
|
|
232 |
|
|
##-----------------------------------------------------------------------------
|
233 |
|
|
## end of platform.S
|