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