aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/fx2/common/_startup.a51.brittle
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-11-05 12:32:09 -0700
committerJosh Blum <josh@joshknows.com>2010-11-05 12:32:09 -0700
commitc473cc56fafcb47d6ba1f16e8c9fb89ff6c57bca (patch)
tree4760fc8fd3f409831dda97b81b65b379abfd61fc /firmware/fx2/common/_startup.a51.brittle
parent7a7e704fa3d79036da1f33013e761eb747b725f0 (diff)
downloaduhd-c473cc56fafcb47d6ba1f16e8c9fb89ff6c57bca.tar.gz
uhd-c473cc56fafcb47d6ba1f16e8c9fb89ff6c57bca.tar.bz2
uhd-c473cc56fafcb47d6ba1f16e8c9fb89ff6c57bca.zip
usrp1: pulled in cmake build system for usrp1 firmware
Diffstat (limited to 'firmware/fx2/common/_startup.a51.brittle')
-rw-r--r--firmware/fx2/common/_startup.a51.brittle78
1 files changed, 78 insertions, 0 deletions
diff --git a/firmware/fx2/common/_startup.a51.brittle b/firmware/fx2/common/_startup.a51.brittle
new file mode 100644
index 000000000..2996275cf
--- /dev/null
+++ b/firmware/fx2/common/_startup.a51.brittle
@@ -0,0 +1,78 @@
+;;; -*- asm -*-
+;;;
+;;; Copyright 2003 Free Software Foundation, Inc.
+;;;
+;;; This file is part of GNU Radio
+;;;
+;;; GNU Radio is free software; you can redistribute it and/or modify
+;;; it under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3, or (at your option)
+;;; any later version.
+;;;
+;;; GNU Radio is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Radio; see the file COPYING. If not, write to
+;;; the Free Software Foundation, Inc., 51 Franklin Street,
+;;; Boston, MA 02110-1301, USA.
+
+
+;;; The default external memory initialization provided by sdcc is not
+;;; appropriate to the FX2. This is derived from the sdcc code, but uses
+;;; the FX2 specific _MPAGE sfr.
+
+
+ .area XISEG (XDATA) ; the initialized external data area
+ .area XINIT (CODE) ; the code space consts to init XISEG
+ .area XSEG (XDATA) ; zero initialized xdata
+ .area USBDESCSEG (XDATA); usb descriptors
+
+
+ ;; BIG TIME KLUDGE!
+ ;; Look at usrp_main.rst and count the bytes from our
+ ;; "normal return location" to the first instruction following
+ ;; the comment: "_mcs51_getRAMCLEAR () start"
+
+ INSTRUCTION_BYTES_TO_SKIP = 0x29 ; valid for sdcc 2.4.0
+
+
+ .area CSEG (CODE)
+
+ ;; sfr that sets upper address byte of MOVX using @r0 or @r1
+ _MPAGE = 0x0092
+
+__sdcc_external_startup::
+; _mcs51_genXINIT() start
+ mov r1,#l_XINIT
+ mov a,r1
+ orl a,#(l_XINIT >> 8)
+ jz 00003$
+ mov r2,#((l_XINIT+255) >> 8)
+ mov dptr,#s_XINIT
+ mov r0,#s_XISEG
+ mov _MPAGE,#(s_XISEG >> 8)
+00001$: clr a
+ movc a,@a+dptr
+ movx @r0,a
+ inc dptr
+ inc r0
+ cjne r0,#0,00002$
+ inc _MPAGE
+00002$: djnz r1,00001$
+ djnz r2,00001$
+ mov _MPAGE,#0xFF
+00003$:
+
+ ;; Danger! Total KLUDGE!
+ ;; We pop the return address, add a magic number to it
+ ;; then jump to that address. Believe it or not, this
+ ;; looks like the least kludgy way to handle this,
+ ;; short of patching the compiler...
+
+ pop dph
+ pop dpl
+ mov a,#INSTRUCTION_BYTES_TO_SKIP
+ jmp @a+dptr