OpenCores
URL https://opencores.org/ocsvn/w11/w11/trunk

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.61/] [tools/] [fx2/] [src/] [startup.a51] - Blame information for rev 26

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 17 wfjm
;;; -*- asm -*-
2
;;; $Id: startup.a51 395 2011-07-17 22:02:55Z mueller $
3
;;;
4
;;;-----------------------------------------------------------------------------
5
;;; Startup code
6
;;;-----------------------------------------------------------------------------
7
;;; Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2,
8
;;; Copyright 2003 Free Software Foundation, Inc.
9
;;;-----------------------------------------------------------------------------
10
;;; This code is part of usbjtag. usbjtag is free software; you can redistribute
11
;;; it and/or modify it under the terms of the GNU General Public License as
12
;;; published by the Free Software Foundation; either version 2 of the License,
13
;;; or (at your option) any later version. usbjtag is distributed in the hope
14
;;; that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
15
;;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
;;; GNU General Public License for more details.  You should have received a
17
;;; copy of the GNU General Public License along with this program in the file
18
;;; COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin
19
;;; St, Fifth Floor, Boston, MA  02110-1301  USA
20
;;;-----------------------------------------------------------------------------
21
 
22
;;; The default external memory initialization provided by sdcc is not
23
;;; appropriate to the FX2.  This is derived from the sdcc code, but uses
24
;;; the FX2 specific _MPAGE sfr.
25
 
26
 
27
        ;; .area XISEG   (XDATA)  ; the initialized external data area
28
        ;; .area XINIT   (CODE)          ; the code space consts to init XISEG
29
        .area XSEG    (XDATA)          ; zero initialized xdata
30
        .area USBDESCSEG (XDATA)  ; usb descriptors
31
 
32
 
33
        .area CSEG    (CODE)
34
 
35
        ;; sfr that sets upper address byte of MOVX using @r0 or @r1
36
        _MPAGE        =        0x0092
37
 
38
__sdcc_external_startup::
39
        ;; This system is now compiled with the --no-xinit-opt
40
        ;; which means that any initialized XDATA is handled
41
        ;; inline by code in the GSINIT segs emitted for each file.
42
        ;;
43
        ;; We zero XSEG and all of the internal ram to ensure
44
        ;; a known good state for uninitialized variables.
45
 
46
;        _mcs51_genRAMCLEAR() start
47
        mov        r0,#l_XSEG
48
        mov        a,r0
49
        orl        a,#(l_XSEG >> 8)
50
        jz        00002$
51
        mov        r1,#((l_XSEG + 255) >> 8)
52
        mov        dptr,#s_XSEG
53
        clr     a
54
 
55
00001$:        movx        @dptr,a
56
        inc        dptr
57
        djnz        r0,00001$
58
        djnz        r1,00001$
59
 
60
        ;; We're about to clear internal memory.  This will overwrite
61
        ;; the stack which contains our return address.
62
        ;; Pop our return address into DPH, DPL
63
00002$:        pop        dph
64
        pop        dpl
65
 
66
        ;; R0 and A contain 0.  This loop will execute 256 times.
67
        ;;
68
        ;; FWIW the first iteration writes direct address 0x00,
69
        ;; which is the location of r0.  We get lucky, we're
70
        ;; writing the correct value (0)
71
 
72
00003$:        mov        @r0,a
73
        djnz        r0,00003$
74
 
75
        push        dpl                ; restore our return address
76
        push        dph
77
 
78
        mov        dpl,#0                ; indicate that data init is still required
79
        ret

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.