2002-04-24 21:46:01 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 by Linus Nielsen Feltzing
|
|
|
|
*
|
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2006-09-01 09:54:08 +00:00
|
|
|
|
|
|
|
/* Most of the code from this file has now been moved into the target trees */
|
|
|
|
|
2005-06-22 20:43:39 +00:00
|
|
|
#include "config.h"
|
|
|
|
#include "cpu.h"
|
2004-12-20 01:36:58 +00:00
|
|
|
|
2005-10-18 20:51:18 +00:00
|
|
|
.section .init.text,"ax",@progbits
|
2005-12-12 13:21:08 +00:00
|
|
|
|
2005-06-22 20:43:39 +00:00
|
|
|
.global start
|
2005-01-22 15:14:24 +00:00
|
|
|
start:
|
2005-11-07 23:07:19 +00:00
|
|
|
|
2006-09-01 09:54:08 +00:00
|
|
|
#if CONFIG_CPU == TCC730
|
2005-06-22 20:43:39 +00:00
|
|
|
/* Platform: Gmini 120/SP */
|
|
|
|
;; disable all interrupts
|
2006-09-01 09:54:08 +00:00
|
|
|
clrsr fe
|
2005-06-22 20:43:39 +00:00
|
|
|
clrsr ie
|
|
|
|
clrsr te
|
|
|
|
ld a14, #0x3F0000
|
|
|
|
|
|
|
|
ld r5, 0xA5
|
|
|
|
ldb @[a14 + 6], r5 ; disable watchdog
|
|
|
|
|
|
|
|
ld a11, #(_datacopy) ; where the data section is in the flash
|
|
|
|
ld a8, #(_datastart) ; destination
|
|
|
|
|
|
|
|
;; copy data section from flash to ram.
|
|
|
|
ld a9, #_datasize
|
|
|
|
ld r6, e9
|
|
|
|
cmp eq, r6, #0
|
|
|
|
brf .data_copy_loop
|
|
|
|
cmp eq, r9, #0
|
|
|
|
brt .data_copy_end
|
|
|
|
.data_copy_loop:
|
|
|
|
ldc r2, @a11
|
|
|
|
ldw @[a8 + 0], r2
|
|
|
|
add a11, #0x2
|
|
|
|
add a8, #0x2
|
|
|
|
sub r9, #0x2
|
|
|
|
sbc r6, #0
|
|
|
|
cmp ugt, r6, #0
|
|
|
|
brt .data_copy_loop
|
|
|
|
cmp ugt, r9, #0
|
|
|
|
brt .data_copy_loop
|
2005-01-10 21:33:54 +00:00
|
|
|
.data_copy_end:
|
|
|
|
|
2005-06-22 20:43:39 +00:00
|
|
|
;; zero out bss
|
|
|
|
ld r2, #0
|
|
|
|
ld a8, #(_bssstart) ; destination
|
|
|
|
ld a9, #_bsssize
|
|
|
|
ld r6, e9
|
|
|
|
|
|
|
|
cmp eq, r6, #0
|
|
|
|
brf .bss_init_loop
|
|
|
|
cmp eq, r9, #0
|
|
|
|
brt .bss_init_end
|
|
|
|
.bss_init_loop:
|
|
|
|
ldw @[a8 + 0], r2
|
|
|
|
add a8, #0x2
|
|
|
|
sub r9, #0x2
|
|
|
|
sbc r6, #0
|
|
|
|
cmp ugt, r6, #0
|
|
|
|
brt .bss_init_loop
|
|
|
|
cmp ugt, r9, #0
|
|
|
|
brt .bss_init_loop
|
2005-01-10 21:33:54 +00:00
|
|
|
.bss_init_end:
|
2005-01-27 14:16:11 +00:00
|
|
|
|
2005-06-22 20:43:39 +00:00
|
|
|
;; set stack pointer
|
|
|
|
ld a15, _stackend
|
2005-01-10 21:33:54 +00:00
|
|
|
|
2005-06-22 20:43:39 +00:00
|
|
|
;; go!
|
|
|
|
jsr _main
|
2005-01-10 21:33:54 +00:00
|
|
|
|
2005-06-22 20:43:39 +00:00
|
|
|
;; soft reset
|
|
|
|
ld a10, #0
|
|
|
|
ldc r10, @a10
|
|
|
|
jmp a10
|
|
|
|
|
|
|
|
|
|
|
|
.section .vectors, "ax"
|
2005-01-10 21:33:54 +00:00
|
|
|
irq_handler:
|
|
|
|
|
2005-06-22 20:43:39 +00:00
|
|
|
push r0, r1
|
|
|
|
push r2, r3
|
|
|
|
push r4, r5
|
|
|
|
push r6, r7
|
|
|
|
push a8, a9
|
|
|
|
push a10, a11
|
|
|
|
push a12, a13
|
|
|
|
push a14
|
|
|
|
ld a13, #0x3f0000
|
|
|
|
ldb r0, @[a13 + 0x26]
|
|
|
|
add r0, r0
|
|
|
|
ld a10, #_interrupt_vector
|
|
|
|
ldw a13, @[a10 + r0]
|
|
|
|
jsr a13
|
|
|
|
pop a14
|
|
|
|
pop a13, a12
|
|
|
|
pop a11, a10
|
|
|
|
pop a9, a8
|
|
|
|
pop r7, r6
|
|
|
|
pop r5, r4
|
|
|
|
pop r3, r2
|
|
|
|
pop r1, r0
|
|
|
|
ret_irq
|
2004-10-07 11:31:28 +00:00
|
|
|
#endif
|