From 482d4974b86d43ede7a24aeb5f3dd0d251901319 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Sat, 23 Jan 2016 16:47:35 -0600 Subject: Obsolete and remove m68k/ods68302 BSP closes #2544. --- c/ACKNOWLEDGEMENTS | 5 - c/src/lib/libbsp/m68k/acinclude.m4 | 2 - c/src/lib/libbsp/m68k/ods68302/Makefile.am | 65 -- c/src/lib/libbsp/m68k/ods68302/README | 77 -- c/src/lib/libbsp/m68k/ods68302/bsp_specs | 13 - c/src/lib/libbsp/m68k/ods68302/clock/ckinit.c | 102 -- c/src/lib/libbsp/m68k/ods68302/configure.ac | 36 - c/src/lib/libbsp/m68k/ods68302/console/console.c | 183 ---- c/src/lib/libbsp/m68k/ods68302/include/bare.h | 244 ----- c/src/lib/libbsp/m68k/ods68302/include/bsp.h | 100 -- c/src/lib/libbsp/m68k/ods68302/include/coverhd.h | 117 --- c/src/lib/libbsp/m68k/ods68302/include/crc.h | 24 - c/src/lib/libbsp/m68k/ods68302/include/debugport.h | 40 - c/src/lib/libbsp/m68k/ods68302/include/m68302scc.h | 32 - .../ods68302/make/custom/ods68302-testsuite.tcfg | 10 - .../libbsp/m68k/ods68302/make/custom/ods68302.cfg | 31 - c/src/lib/libbsp/m68k/ods68302/preinstall.am | 91 -- c/src/lib/libbsp/m68k/ods68302/start/debugreset.S | 88 -- c/src/lib/libbsp/m68k/ods68302/start/reset.S | 882 ---------------- c/src/lib/libbsp/m68k/ods68302/startup/cpuboot.c | 140 --- c/src/lib/libbsp/m68k/ods68302/startup/crc.c | 86 -- c/src/lib/libbsp/m68k/ods68302/startup/debugger | 76 -- c/src/lib/libbsp/m68k/ods68302/startup/debugport.c | 160 --- c/src/lib/libbsp/m68k/ods68302/startup/gdb-hooks.c | 79 -- c/src/lib/libbsp/m68k/ods68302/startup/linkcmds | 223 ---- c/src/lib/libbsp/m68k/ods68302/startup/m68302scc.c | 146 --- c/src/lib/libbsp/m68k/ods68302/startup/m68k-stub.c | 1087 -------------------- c/src/lib/libbsp/m68k/ods68302/startup/rom | 77 -- c/src/lib/libbsp/m68k/ods68302/startup/trace.c | 171 --- c/src/lib/libbsp/m68k/ods68302/timer/timer.c | 108 -- c/src/lib/libbsp/m68k/ods68302/timer/timerisr.S | 26 - 31 files changed, 4521 deletions(-) delete mode 100644 c/src/lib/libbsp/m68k/ods68302/Makefile.am delete mode 100644 c/src/lib/libbsp/m68k/ods68302/README delete mode 100644 c/src/lib/libbsp/m68k/ods68302/bsp_specs delete mode 100644 c/src/lib/libbsp/m68k/ods68302/clock/ckinit.c delete mode 100644 c/src/lib/libbsp/m68k/ods68302/configure.ac delete mode 100644 c/src/lib/libbsp/m68k/ods68302/console/console.c delete mode 100644 c/src/lib/libbsp/m68k/ods68302/include/bare.h delete mode 100644 c/src/lib/libbsp/m68k/ods68302/include/bsp.h delete mode 100644 c/src/lib/libbsp/m68k/ods68302/include/coverhd.h delete mode 100644 c/src/lib/libbsp/m68k/ods68302/include/crc.h delete mode 100644 c/src/lib/libbsp/m68k/ods68302/include/debugport.h delete mode 100644 c/src/lib/libbsp/m68k/ods68302/include/m68302scc.h delete mode 100644 c/src/lib/libbsp/m68k/ods68302/make/custom/ods68302-testsuite.tcfg delete mode 100644 c/src/lib/libbsp/m68k/ods68302/make/custom/ods68302.cfg delete mode 100644 c/src/lib/libbsp/m68k/ods68302/preinstall.am delete mode 100644 c/src/lib/libbsp/m68k/ods68302/start/debugreset.S delete mode 100644 c/src/lib/libbsp/m68k/ods68302/start/reset.S delete mode 100644 c/src/lib/libbsp/m68k/ods68302/startup/cpuboot.c delete mode 100644 c/src/lib/libbsp/m68k/ods68302/startup/crc.c delete mode 100644 c/src/lib/libbsp/m68k/ods68302/startup/debugger delete mode 100644 c/src/lib/libbsp/m68k/ods68302/startup/debugport.c delete mode 100644 c/src/lib/libbsp/m68k/ods68302/startup/gdb-hooks.c delete mode 100644 c/src/lib/libbsp/m68k/ods68302/startup/linkcmds delete mode 100644 c/src/lib/libbsp/m68k/ods68302/startup/m68302scc.c delete mode 100644 c/src/lib/libbsp/m68k/ods68302/startup/m68k-stub.c delete mode 100644 c/src/lib/libbsp/m68k/ods68302/startup/rom delete mode 100644 c/src/lib/libbsp/m68k/ods68302/startup/trace.c delete mode 100644 c/src/lib/libbsp/m68k/ods68302/timer/timer.c delete mode 100644 c/src/lib/libbsp/m68k/ods68302/timer/timerisr.S diff --git a/c/ACKNOWLEDGEMENTS b/c/ACKNOWLEDGEMENTS index 7590f6caf9..bfa5c7d7f0 100644 --- a/c/ACKNOWLEDGEMENTS +++ b/c/ACKNOWLEDGEMENTS @@ -81,11 +81,6 @@ The following persons/organizations have made contributions: performance issues and licensing concerns, Eric followed this up by replacing the KA9Q TCP/IP stack with a port of the FreeBSD stack. -+ Chris Johns (cjohns@plessey.com.au) submitted the ods68302 BSP which - offers easier configuration than its counterpart gen68302. Chris - also submitted the RTEMS++ C++ class library and test code for - that library. - + Katsutoshi Shibuya (shibuya@mxb.meshnet.or.jp) of BU-Denken Co., Ltd. (Sapporo, Japan) submitted the extended console driver for the MVME162LX BSP and the POSIX tcsetattr() and tcgetattr() routines. diff --git a/c/src/lib/libbsp/m68k/acinclude.m4 b/c/src/lib/libbsp/m68k/acinclude.m4 index 13dc717c1e..750746bb6c 100644 --- a/c/src/lib/libbsp/m68k/acinclude.m4 +++ b/c/src/lib/libbsp/m68k/acinclude.m4 @@ -34,8 +34,6 @@ AC_DEFUN([RTEMS_CHECK_BSPDIR], AC_CONFIG_SUBDIRS([mvme162]);; mvme167 ) AC_CONFIG_SUBDIRS([mvme167]);; - ods68302 ) - AC_CONFIG_SUBDIRS([ods68302]);; uC5282 ) AC_CONFIG_SUBDIRS([uC5282]);; *) diff --git a/c/src/lib/libbsp/m68k/ods68302/Makefile.am b/c/src/lib/libbsp/m68k/ods68302/Makefile.am deleted file mode 100644 index 97a1feaea8..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/Makefile.am +++ /dev/null @@ -1,65 +0,0 @@ -ACLOCAL_AMFLAGS = -I ../../../../aclocal - -include $(top_srcdir)/../../../../automake/compile.am -include $(top_srcdir)/../../bsp.am - -include_bspdir = $(includedir)/bsp - -dist_project_lib_DATA = bsp_specs - -include_HEADERS = include/bsp.h -include_HEADERS += ../../shared/include/tm27.h - -nodist_include_HEADERS = include/bspopts.h -nodist_include_bsp_HEADERS = ../../shared/include/bootcard.h -DISTCLEANFILES = include/bspopts.h -noinst_PROGRAMS = - -EXTRA_DIST = - -include_HEADERS += include/bare.h -include_HEADERS += include/crc.h -include_HEADERS += include/debugport.h -include_HEADERS += include/m68302scc.h -include_HEADERS += include/coverhd.h - -# FIXME: Better merge both files into one and use #ifdef GDB_MONITOR_ACTIVE -if ODS68302_DEBUG -EXTRA_DIST += start/debugreset.S -start.$(OBJEXT): start/debugreset.S - $(CPPASCOMPILE) -o $@ -c $< -else -EXTRA_DIST += start/reset.S -start.$(OBJEXT): start/reset.S - $(CPPASCOMPILE) -o $@ -c $< -endif - -project_lib_DATA = start.$(OBJEXT) - -dist_project_lib_DATA += startup/linkcmds startup/rom startup/debugger - -noinst_LIBRARIES = libbsp.a -libbsp_a_SOURCES = - -# startup -libbsp_a_SOURCES += startup/cpuboot.c startup/crc.c startup/debugport.c \ - startup/gdb-hooks.c ../../shared/bootcard.c \ - startup/m68302scc.c startup/m68k-stub.c \ - ../../shared/bspgetworkarea.c \ - startup/trace.c ../../shared/gnatinstallhandler.c ../../shared/bsplibc.c \ - ../../shared/bsppredriverhook.c ../../shared/bsppost.c \ - ../../shared/bspstart.c ../../shared/bspclean.c ../../shared/sbrk.c \ - ../../shared/setvec.c -# clock -libbsp_a_SOURCES += clock/ckinit.c -# console -libbsp_a_SOURCES += console/console.c ../../shared/dummy_printk_support.c -# timer -libbsp_a_SOURCES += timer/timer.c timer/timerisr.S - -libbsp_a_LIBADD = \ - ../../../libcpu/@RTEMS_CPU@/shared/cache.rel \ - ../../../libcpu/@RTEMS_CPU@/shared/misc.rel - -include $(srcdir)/preinstall.am -include $(top_srcdir)/../../../../automake/local.am diff --git a/c/src/lib/libbsp/m68k/ods68302/README b/c/src/lib/libbsp/m68k/ods68302/README deleted file mode 100644 index 3c6a4c8108..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/README +++ /dev/null @@ -1,77 +0,0 @@ -BSP NAME: ods68302 -BOARD: proprietary (see below for relevant information) -BUS: none -CPU FAMILY: MC68000 -COPROCESSORS: 68302 communications co-processor -MODE: not applicable - -DEBUG MONITOR: gdb - -PERIPHERALS -=========== -TIMERS: two 68302 timers, one 68302 watchdog timer - RESOLUTION: ? -SERIAL PORTS: three 68302 SCCs -REAL-TIME CLOCK: -DMA: built-in 68302, not used -VIDEO: none -SCSI: none -NETWORKING: none - -DRIVER INFORMATION -================== -CLOCK DRIVER: 68302 (TIMER1) -IOSUPP DRIVER: 68302 SCC2 -SHMSUPP: none -TIMER DRIVER: 68302 TIMER2 - -STDIO -===== -PORT: SCC3 for ROM build, SCC1 for DEGUB build -ELECTRICAL: EIA-232 -BAUD: 9600 -BITS PER CHARACTER: 8 -PARITY: None -STOP BITS: 1 - -DEBUG MONITOR -============= -PORT: SCC3 -ELECTRICAL: EIA-232 -BAUD: 57600 -BITS PER CHARACTER: 8 -PARITY: None -STOP BITS: 1 - -NOTES -===== - -This BSP is based on the gen68302. The main differences are C code for -boot parameters, the gdb monitor, and variant support. - -The boot code which changes is written in C and the parameters used to -control the configuration of the chip select registers and parallel -ports are held in variant specific header files. These file also -control the other hardware specific definitions such the processor -freqency. - -The gdb monitor currently uses two serial ports. One for the debugger -and one for stdio. This is costly in terms of the 68302 processor. - -The build configuration contains the memory map. The bsp code does not -contain any memory map parameters. That is the ods68302.cfg contains -the link addresses. - -To build a version to download via gdb use the command line parameters -to make or "RTEMS_DEBUGGER=yes". This will change the memory map to -place the code, and data above the RAM used by the gdb stub. - -TODO -==== - -1) Lower the set size of the gdb monitor. This can be made to be about -10K or RAM. The code is about 14K. - -2) Add the production memory test code. This will be C and asm -code. The asm will be a faster version of the C. - diff --git a/c/src/lib/libbsp/m68k/ods68302/bsp_specs b/c/src/lib/libbsp/m68k/ods68302/bsp_specs deleted file mode 100644 index 5154de8c55..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/bsp_specs +++ /dev/null @@ -1,13 +0,0 @@ -%rename endfile old_endfile -%rename startfile old_startfile -%rename link old_link - -*startfile: -%{!qrtems: %(old_startfile)} \ -%{!nostdlib: %{qrtems: start.o%s crti.o%s crtbegin.o%s -e start}} - -*link: -%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N} - -*endfile: -%{!qrtems: %(old_endfile)} %{qrtems: crtend.o%s crtn.o%s} diff --git a/c/src/lib/libbsp/m68k/ods68302/clock/ckinit.c b/c/src/lib/libbsp/m68k/ods68302/clock/ckinit.c deleted file mode 100644 index e0a807480d..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/clock/ckinit.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * This routine initializes Timer 1 for an MC68302. - * The tick frequency is 1 millisecond. - */ - -/* - * COPYRIGHT (c) 1989-2014. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#include /* for atexit() */ - -#include -#include - -#define CLOCK_VECTOR 137 - -#define TMR1_VAL ( RBIT_TMR_RST /* software reset the timer */\ - | RBIT_TMR_ICLK_MASTER16 /* master clock divided by 16 */\ - | RBIT_TMR_FRR /* restart timer after ref reached */\ - | RBIT_TMR_ORI) /* enable interrupt when ref reached */ -#define TRR1_VAL 1000 /* 1000 ticks @ 16MHz/16 - * = 1 millisecond tick. - */ - -/* - * Clock_driver_ticks is a monotonically increasing counter of the - * number of clock ticks since the driver was initialized. - */ -volatile uint32_t Clock_driver_ticks; - -/* - * Clock_isrs is the number of clock ISRs until the next invocation of - * the RTEMS clock tick routine. The clock tick device driver - * gets an interrupt once a millisecond and counts down until the - * length of time between the user configured microseconds per tick - * has passed. - */ -uint32_t Clock_isrs; - -void Clock_exit( void ); - -/* - * ISR Handler - */ -static rtems_isr Clock_isr( - rtems_vector_number vector -) -{ - Clock_driver_ticks += 1; - - m302.reg.isr = RBIT_ISR_TIMER1; /* clear in-service bit */ - m302.reg.ter1 = (RBIT_TER_REF | RBIT_TER_CAP); /* clear timer intr request */ - - if ( Clock_isrs == 1 ) { - rtems_clock_tick(); - Clock_isrs = rtems_configuration_get_microseconds_per_tick() / 1000; - } - else - Clock_isrs -= 1; -} - -static void Install_clock( - rtems_isr_entry clock_isr -) -{ - - Clock_driver_ticks = 0; - Clock_isrs = rtems_configuration_get_microseconds_per_tick() / 1000; - - set_vector( clock_isr, CLOCK_VECTOR, 1 ); - - m302.reg.trr1 = TRR1_VAL; /* set timer reference register */ - m302.reg.tmr1 = TMR1_VAL; /* set timer mode register & enable */ - /* - * Enable TIMER1 interrupts only. - */ - m302.reg.imr |= RBIT_IMR_TIMER1; /* set 68302 int-mask to allow ints */ - - atexit( Clock_exit ); -} - -void Clock_exit( void ) -{ - /* TODO: figure out what to do here */ - /* do not restore old vector */ -} - -rtems_device_driver Clock_initialize( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *pargp -) -{ - Install_clock( Clock_isr ); - - return RTEMS_SUCCESSFUL; -} diff --git a/c/src/lib/libbsp/m68k/ods68302/configure.ac b/c/src/lib/libbsp/m68k/ods68302/configure.ac deleted file mode 100644 index d06dbe3d86..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/configure.ac +++ /dev/null @@ -1,36 +0,0 @@ -## Process this file with autoconf to produce a configure script. - -AC_PREREQ([2.69]) -AC_INIT([rtems-c-src-lib-libbsp-m68k-ods68302],[_RTEMS_VERSION],[https://devel.rtems.org/newticket]) -AC_CONFIG_SRCDIR([bsp_specs]) -RTEMS_TOP(../../../../../..) - -RTEMS_CANONICAL_TARGET_CPU -AM_INIT_AUTOMAKE([no-define nostdinc foreign 1.12.2]) -RTEMS_BSP_CONFIGURE - -RTEMS_PROG_CC_FOR_TARGET -RTEMS_CANONICALIZE_TOOLS -RTEMS_PROG_CCAS - -AC_ARG_ENABLE(ods68302-debug, -[AS_HELP_STRING(--enable-ods68302-debug,whether to support bsp debugging)], -[case $enable_ods68302_debug in - yes ) ODS68302_DEBUG=yes;; - * ) ODS68302_DEBUG=no;; - esac], -[ODS68302_DEBUG=no]) - -AM_CONDITIONAL(ODS68302_DEBUG,[test "$ODS68302_DEBUG" = "yes"]) - -# FIXME: Something seem to be very broken inside of this BSP -# It plays tricks with VARIANT -# For now, deactivate it. -# BSP_VARIANT=${BSP_VARIANT-bare} -# AC_DEFINE_UNQUOTED([VARIANT],[${BSP_VARIANT}],[missing explanation]) - -RTEMS_BSP_CLEANUP_OPTIONS(0, 0) - -# Explicitly list all Makefiles here -AC_CONFIG_FILES([Makefile]) -AC_OUTPUT diff --git a/c/src/lib/libbsp/m68k/ods68302/console/console.c b/c/src/lib/libbsp/m68k/ods68302/console/console.c deleted file mode 100644 index 4077904754..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/console/console.c +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Initialize the MC68302 SCC2 for console IO board support package. - */ - -/* - * COPYRIGHT (c) 1989-2014. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#define GEN68302_INIT - -#include -#include -#include - -/* console_initialize - * - * This routine initializes the console IO driver. - */ -rtems_device_driver console_initialize( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg -) -{ - rtems_status_code status; - -/* debug_port_initialise(); */ - - status = rtems_io_register_name( - "/dev/console", - major, - (rtems_device_minor_number) 0 - ); - - if (status != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred(status); - - return RTEMS_SUCCESSFUL; -} - -/* is_character_ready - * - * Check to see if a character is available on the MC68302's SCC2. If so, - * then return a TRUE (along with the character). Otherwise return FALSE. - */ -static bool is_character_ready( - char *ch /* -> character */ -) -{ - if (debug_port_status(0)) - { - *ch = debug_port_in(); - return true; - } - return false; -} - -/* inbyte - * - * Receive a character from the MC68302's SCC2. - */ -static char inbyte( void ) -{ - char ch; - - while (!is_character_ready(&ch)); - - return ch; -} - -/* outbyte - * - * Transmit a character out on the MC68302's SCC2. - * It may support XON/XOFF flow control. - */ -static void outbyte( - char ch -) -{ - debug_port_out(ch); -} - -/* - * Open entry point - */ -rtems_device_driver console_open( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg -) -{ - return RTEMS_SUCCESSFUL; -} - -/* - * Close entry point - */ -rtems_device_driver console_close( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg -) -{ - return RTEMS_SUCCESSFUL; -} - -/* - * read bytes from the serial port. We only have stdin. - */ -rtems_device_driver console_read( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg -) -{ - rtems_libio_rw_args_t *rw_args; - char *buffer; - int maximum; - int count = 0; - - rw_args = (rtems_libio_rw_args_t *) arg; - - buffer = rw_args->buffer; - maximum = rw_args->count; - - for (count = 0; count < maximum; count++) { - buffer[ count ] = inbyte(); - if (buffer[ count ] == '\n' || buffer[ count ] == '\r') { - buffer[ count++ ] = '\n'; - break; - } - } - - rw_args->bytes_moved = count; - return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED; -} - -/* - * write bytes to the serial port. Stdout and stderr are the same. - */ -rtems_device_driver console_write( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg -) -{ - int count; - int maximum; - rtems_libio_rw_args_t *rw_args; - char *buffer; - - rw_args = (rtems_libio_rw_args_t *) arg; - - buffer = rw_args->buffer; - maximum = rw_args->count; - - for (count = 0; count < maximum; count++) { - if ( buffer[ count ] == '\n') { - outbyte('\r'); - } - outbyte( buffer[ count ] ); - } - - rw_args->bytes_moved = maximum; - return 0; -} - -/* - * IO Control entry point - */ -rtems_device_driver console_control( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg -) -{ - return RTEMS_SUCCESSFUL; -} diff --git a/c/src/lib/libbsp/m68k/ods68302/include/bare.h b/c/src/lib/libbsp/m68k/ods68302/include/bare.h deleted file mode 100644 index 825acafc0a..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/include/bare.h +++ /dev/null @@ -1,244 +0,0 @@ -/*****************************************************************************/ -/* - Card Definition for a bare board. - - This is an example file which actually builds a BSP for a 68302 card - called an MVF (Multi-Voice-Frequency). The card is one of a range - which run in a 100Mbit voice/video/data switch used for high end - applications such as Air Traffic Control. The transport is - FDDI-2. Yes it alive and well and working in real systems. - - Chip selects are programmed as required. Three are controlled in the - boot code. They are RAM, ROM, and peripherals. You can optionally - configure the other two chip selects. - - SYSTEM_CLOCK - You must defined this. It is used for setting the - baud rate. - - CSEL_ROM, CSEL_RAM - Must be defined, and made to be a single number - with brackets. - - ROM_WAIT_STATES, RAM_WAIT_STATES - Must be defined. This sets the - speed for the ROM and RAM. - - ROM and RAM size is passed on the command line. The makefile holds - them. This allows a single place to defined it. The makefile allows - them to be passed to the linker. - - CSEL_1, CSEL_2 - If defined the other macros needed to define the - chip select must be defined. If not defined they are not programmed - and registers are left in the reset state. - - Card Specific Devices - The MVF card uses a chip select to address a - range of peripherials (CSEL_2). These include front panel leds, and - 4 digit diagnostic display device. Put what ever you need. - - LED_CONTROL - If defined the boot code will set leds as it goes. - - UPDATE_DISPLAY - A four digit display device will also be updated to - show the boot state. - - CARD_PA, CARD_PB - The default configuration, data direction and - data must be specified. - - This file allows a range of common parameters which vary from one - variant of card to another to placed in a central file. - -*/ -/*****************************************************************************/ - -#ifndef _BARE_H_ -#define _BARE_H_ - -#if __cplusplus -extern "C" -{ -#endif - -/* name of the card */ -#define CARD_ID "m68302-odsbare" - -/* speed of the processor */ -#define SYSTEM_CLOCK (15360000) - -#define SCR_DEFAULT (RBIT_SCR_IPA | RBIT_SCR_HWT | RBIT_SCR_WPV | RBIT_SCR_ADC | \ - RBIT_SCR_HWDEN | RBIT_SCR_HWDCN1 | RBIT_SCR_EMWS) - -/* define the chip selects */ -#define CSEL_ROM 0 /* token pasted so no brackets */ -#define ROM_WAIT_STATES (OR_DTACK_1) /* 100nsec at 16MHz */ -#define CSEL_RAM 3 -#define RAM_WAIT_STATES (OR_DTACK_0) /* 70nsec at 16MHz */ - -/* The remaining chip selects are called 1 and 2 */ -/* -#define CSEL_1 1 -#define CSEL_1_BASE (0x00?00000) -#define CSEL_1_SIZE (0x00?00000) -#define CSEL_1_WAIT_STATES (OR_DTACK_1) -*/ -#define CSEL_2 2 -#define CSEL_2_BASE (0x00800000) -#define CSEL_2_SIZE (0x00040000) -#define CSEL_2_WAIT_STATES (OR_DTACK_EXT) - -/* - * Need to define a watchdog period - */ -#define WATCHDOG_TIMEOUT_PERIOD (3000 * 2) - -/* - * Console and debug port allocation, 0=SCC1, 2=SCC3 - */ - -#define CONSOLE_PORT 1 -#define CONSOLE_BAUD SCC_9600 -#define DEBUG_PORT 2 -#define DEBUG_BAUD SCC_57600 - -/* ---- - Parallel Port Configuration, and default data directions - - PORT BITS - NAME , WHO , DEFAULT WHAT - ------------------------------------------------------------ - PPA:: 1: 0 - Serial , PERIPHERAL, - - PPA:: 7: 2 - MVF_PPA:7:2 , IO , INPUTS - PPA:: 9: 8 - Serial , PERIPHERAL, - - PPA::15:10 - MVF_PPB:15:10 , IO , INPUTS - - PPB:: 1: 0 - Setup , IO , INPUTS - PPB:: 3: 2 - SYNC_HIGHWAY_1:2 , IO , INPUTS - - SYNC_HIGHWAY_2:3 , IO , INPUTS - PPB:: 4: 4 - HARDWARE_RESET:4 , IO , OUTPUT - PPB:: 6: 5 - SOFTWARE_OVERRIDE_1:6, IO , OUTPUT - - SOFTWARE_OVERRIDE_2:5, IO , OUTPUT - PPB:: 7: 7 - Watchdog , PERIPHERAL, - - PPB::11: 8 - Interrupt , PERIPHERAL, - - PPB::15:12 - Not implemented on the 68302 - - 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 - ------------------------------------------------------ - PACNT 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 1 = 0x0303 - PBCNT - - - - - - - - 1 0 0 0 0 0 0 0 = 0x0080 - - PADDR 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 = 0x0000 - PBDDR 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 = 0x0070 - - PADAT 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 = 0x0000 - - */ -#define CARD_PA_CONFIGURATION 0x0303 -#define CARD_PB_CONFIGURATION 0x0080 - -#define CARD_PA_DEFAULT_DIRECTIONS 0x0000 -#define CARD_PB_DEFAULT_DIRECTIONS 0x0070 - -#define CARD_PA_DEFAULT_DATA 0x0000 -#define CARD_PB_DEFAULT_DATA (HARDWARE_RESET_DISABLE | \ - SOFTWARE_OVERRIDE_1_DISABLE | \ - SOFTWARE_OVERRIDE_2_DISABLE) - -/* these are specific to the card and are not required */ -#define HARDWARE_RESET_ENABLE 0x0000 -#define HARDWARE_RESET_DISABLE 0x0010 - -#define SOFTWARE_OVERRIDE_1_ENABLE 0x0000 -#define SOFTWARE_OVERRIDE_1_DISABLE 0x0040 -#define SOFTWARE_OVERRIDE_2_ENABLE 0x0000 -#define SOFTWARE_OVERRIDE_2_DISABLE 0x0020 - -/* - * Card Specific Devices, these are not required. Add what ever you - * like here. - */ - -/* Write */ -#define WRITE_REGISTER_8(address, data) \ - *((uint8_t*) (address)) = ((uint8_t) (data)) -#define WRITE_REGISTER_16(address, data) \ - *((uint16_t*) (address)) = ((uint16_t) (data)) -#define WRITE_REGISTER_32(address, data) \ - *((uint32_t*) (address)) = ((uint32_t) (data)) -/* Read */ -#define READ_REGISTER_8(address, data) data = *((uint8_t*) (address)) -#define READ_REGISTER_16(address, data) data = *((uint16_t*) (address)) -#define READ_REGISTER_32(address, data) data = *((uint32_t*) (address)) - -/* CS2 : Peripherials */ -#define PERIPHERIALS_BASE (CSEL_2_BASE) - -#define STATUS_REGISTER_BASE (PERIPHERIALS_BASE + 0x00000000) - -#define PERIPHERIALS_SIZE (0x00040000) - -#define LEDS_BASE (PERIPHERIALS_BASE + 0x00004000) -#define MSC_BASE (PERIPHERIALS_BASE + 0x00008000) -#define SPARE_1_BASE (PERIPHERIALS_BASE + 0x0000C000) -#define DISPLAY_BASE (PERIPHERIALS_BASE + 0x00010000) -#define PIO_INT_BASE (PERIPHERIALS_BASE + 0x00014000) -#define UART_BASE (PERIPHERIALS_BASE + 0x00018000) -#define PIA_BASE (PERIPHERIALS_BASE + 0x0001C000) - -#define LED_1 0x0002 -#define LED_1_GREEN 0xFFFD -#define LED_1_RED 0xFFFF -#define LED_1_OFF 0xFFFC - -#define LED_2 0x0001 -#define LED_2_GREEN 0xFFFE -#define LED_2_RED 0xFFFF -#define LED_2_OFF 0xFFFC - -#define LED_3 0x0000 -#define LED_3_GREEN 0xFFFC -#define LED_3_RED 0xFFFC -#define LED_3_OFF 0xFFFC - -#define LED_4 0x0000 -#define LED_4_GREEN 0xFFFC -#define LED_4_RED 0xFFFC -#define LED_4_OFF 0xFFFC - -#define LED_5 0x0000 -#define LED_5_GREEN 0xFFFC -#define LED_5_RED 0xFFFC -#define LED_5_OFF 0xFFFC - -#define LED_6 0x0000 -#define LED_6_GREEN 0xFFFC -#define LED_6_RED 0xFFFC -#define LED_6_OFF 0xFFFC - -#define LED_7 0x0000 -#define LED_7_GREEN 0xFFFC -#define LED_7_RED 0xFFFC -#define LED_7_OFF 0xFFFC - -#define LED_8 0x0000 -#define LED_8_GREEN 0xFFFC -#define LED_8_RED 0xFFFC -#define LED_8_OFF 0xFFFC - -#define MAKE_LED(L1, L2, L3, L4) ((L1 & LED_1) | (L2 & LED_2) | (L3 & LED_3) | (L4 & LED_4)) - -#define LED_CONTROL(L1, L2, L3, L4, L5, L6, L7, L8) \ - WRITE_REGISTER_16(LEDS_BASE, MAKE_LED(L1, L2, L3, L4)) - - /* update the display, needs a long word */ -#define UPDATE_DISPLAY(LongWordPtr) \ - ( WRITE_REGISTER_16(DISPLAY_BASE, *(((uint8_t*) LongWordPtr) + 3)), \ - WRITE_REGISTER_16(DISPLAY_BASE + 2, *(((uint8_t*) LongWordPtr) + 2)), \ - WRITE_REGISTER_16(DISPLAY_BASE + 4, *(((uint8_t*) LongWordPtr) + 1)), \ - WRITE_REGISTER_16(DISPLAY_BASE + 6, *((uint8_t*) LongWordPtr)) ) - -/* make a better test, say switches */ -#if defined(GDB_MONITOR_ACTIVE) -#define GDB_RUN_MONITOR() (1 == 1) -#else -#define GDB_RUN_MONITOR() (1 == 0) -#endif - -#if __cplusplus -} -#endif -#endif diff --git a/c/src/lib/libbsp/m68k/ods68302/include/bsp.h b/c/src/lib/libbsp/m68k/ods68302/include/bsp.h deleted file mode 100644 index 357963c09c..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/include/bsp.h +++ /dev/null @@ -1,100 +0,0 @@ -/* bsp.h - * - * This include file contains all board IO definitions. - */ - -/* - * COPYRIGHT (c) 1989-2010. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef LIBBSP_M68K_ODS68302_BSP_H -#define LIBBSP_M68K_ODS68302_BSP_H - -#ifndef ASM - -#include -#include - -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef VARIANT -#define VARIANT bare -#endif -#if defined(VARIANT) -#define HQUOTE(a) -#include HQUOTE(VARIANT) -#undef HQUOTE -#endif - -/* Constants */ - -#define RAM_START RAM_BASE -#define RAM_END (RAM_BASE + RAM_SIZE) - -/* Structures */ - -#ifdef GEN68302_INIT -#undef EXTERN -#define EXTERN -#else -#undef EXTERN -#define EXTERN extern -#endif - -extern rtems_isr_entry M68Kvec[]; /* vector table address */ - -/* functions */ - -rtems_isr_entry set_vector( - rtems_isr_entry handler, - rtems_vector_number vector, - int type -); - -/* - * Prototypes for methods called only from .S files - */ -void boot_phase_1(void); -void boot_phase_2(void); -void boot_phase_3(void); -void trace_exception( - unsigned long d0, - unsigned long d1, - unsigned long d2, - unsigned long d3, - unsigned long d4, - unsigned long d5, - unsigned long d6, - unsigned long d7, - unsigned long a0, - unsigned long a1, - unsigned long a2, - unsigned long a3, - unsigned long a4, - unsigned long a5, - unsigned long a6, - unsigned long a7, - unsigned long sr_pch, - unsigned long pcl_format -); - -#ifdef __cplusplus -} -#endif - -#endif - -#endif diff --git a/c/src/lib/libbsp/m68k/ods68302/include/coverhd.h b/c/src/lib/libbsp/m68k/ods68302/include/coverhd.h deleted file mode 100644 index 84ca3a8f03..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/include/coverhd.h +++ /dev/null @@ -1,117 +0,0 @@ -/** - * @file - * @ingroup m68k_ods68302 - * @brief C Overhead definitions - */ - -/* - * - * This include file has defines to represent the overhead associated - * with calling a particular directive from C. These are used in the - * Timing Test Suite to ignore the overhead required to pass arguments - * to directives. On some CPUs and/or target boards, this overhead - * is significant and makes it difficult to distinguish internal - * RTEMS execution time from that used to call the directive. - * This file should be updated after running the C overhead timing - * test. Once this update has been performed, the RTEMS Time Test - * Suite should be rebuilt to account for these overhead times in the - * timing results. - * - * NOTE: If these are all zero, then the times reported include all - * all calling overhead including passing of arguments. - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef __COVERHD_h -#define __COVERHD_h - -#ifdef __cplusplus -extern "C" { -#endif - -#define CALLING_OVERHEAD_INITIALIZE_EXECUTIVE 14 -#define CALLING_OVERHEAD_SHUTDOWN_EXECUTIVE 11 -#define CALLING_OVERHEAD_TASK_CREATE 22 -#define CALLING_OVERHEAD_TASK_IDENT 17 -#define CALLING_OVERHEAD_TASK_START 18 -#define CALLING_OVERHEAD_TASK_RESTART 15 -#define CALLING_OVERHEAD_TASK_DELETE 12 -#define CALLING_OVERHEAD_TASK_SUSPEND 12 -#define CALLING_OVERHEAD_TASK_RESUME 12 -#define CALLING_OVERHEAD_TASK_SET_PRIORITY 16 -#define CALLING_OVERHEAD_TASK_MODE 15 -#define CALLING_OVERHEAD_TASK_GET_NOTE 16 -#define CALLING_OVERHEAD_TASK_SET_NOTE 16 -#define CALLING_OVERHEAD_TASK_WAKE_WHEN 31 -#define CALLING_OVERHEAD_TASK_WAKE_AFTER 11 -#define CALLING_OVERHEAD_INTERRUPT_CATCH 17 -#define CALLING_OVERHEAD_CLOCK_GET 32 -#define CALLING_OVERHEAD_CLOCK_SET 31 -#define CALLING_OVERHEAD_CLOCK_TICK 8 - -#define CALLING_OVERHEAD_TIMER_CREATE 13 -#define CALLING_OVERHEAD_TIMER_IDENT 12 -#define CALLING_OVERHEAD_TIMER_DELETE 14 -#define CALLING_OVERHEAD_TIMER_FIRE_AFTER 19 -#define CALLING_OVERHEAD_TIMER_FIRE_WHEN 39 -#define CALLING_OVERHEAD_TIMER_RESET 12 -#define CALLING_OVERHEAD_TIMER_CANCEL 12 -#define CALLING_OVERHEAD_SEMAPHORE_CREATE 18 -#define CALLING_OVERHEAD_SEMAPHORE_IDENT 12 -#define CALLING_OVERHEAD_SEMAPHORE_DELETE 17 -#define CALLING_OVERHEAD_SEMAPHORE_OBTAIN 17 -#define CALLING_OVERHEAD_SEMAPHORE_RELEASE 12 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE 18 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT 17 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE 12 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_SEND 14 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT 14 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST 17 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE 19 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH 14 - -#define CALLING_OVERHEAD_EVENT_SEND 15 -#define CALLING_OVERHEAD_EVENT_RECEIVE 18 -#define CALLING_OVERHEAD_SIGNAL_CATCH 14 -#define CALLING_OVERHEAD_SIGNAL_SEND 14 -#define CALLING_OVERHEAD_PARTITION_CREATE 23 -#define CALLING_OVERHEAD_PARTITION_IDENT 17 -#define CALLING_OVERHEAD_PARTITION_DELETE 12 -#define CALLING_OVERHEAD_PARTITION_GET_BUFFER 15 -#define CALLING_OVERHEAD_PARTITION_RETURN_BUFFER 15 -#define CALLING_OVERHEAD_REGION_CREATE 23 -#define CALLING_OVERHEAD_REGION_IDENT 14 -#define CALLING_OVERHEAD_REGION_DELETE 12 -#define CALLING_OVERHEAD_REGION_GET_SEGMENT 21 -#define CALLING_OVERHEAD_REGION_RETURN_SEGMENT 15 -#define CALLING_OVERHEAD_PORT_CREATE 20 -#define CALLING_OVERHEAD_PORT_IDENT 14 -#define CALLING_OVERHEAD_PORT_DELETE 12 -#define CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL 18 -#define CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL 18 - -#define CALLING_OVERHEAD_IO_INITIALIZE 18 -#define CALLING_OVERHEAD_IO_OPEN 18 -#define CALLING_OVERHEAD_IO_CLOSE 18 -#define CALLING_OVERHEAD_IO_READ 18 -#define CALLING_OVERHEAD_IO_WRITE 18 -#define CALLING_OVERHEAD_IO_CONTROL 18 -#define CALLING_OVERHEAD_FATAL_ERROR_OCCURRED 11 -#define CALLING_OVERHEAD_RATE_MONOTONIC_CREATE 13 -#define CALLING_OVERHEAD_RATE_MONOTONIC_IDENT 14 -#define CALLING_OVERHEAD_RATE_MONOTONIC_DELETE 12 -#define CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL 12 -#define CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD 14 -#define CALLING_OVERHEAD_MULTIPROCESSING_ANNOUNCE 8 - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/c/src/lib/libbsp/m68k/ods68302/include/crc.h b/c/src/lib/libbsp/m68k/ods68302/include/crc.h deleted file mode 100644 index ac0ffa5ba8..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/include/crc.h +++ /dev/null @@ -1,24 +0,0 @@ -/*****************************************************************************/ -/* - CRC 16 Calculate Interface - -*/ -/*****************************************************************************/ - -#ifndef _CRC_H_ -#define _CRC_H_ - - /* ---- - F U N C T I O N S - */ -#if __cplusplus -extern "C" -{ -#endif - -uint16_t calc_crc(void *data, uint32_t count); - -#if __cplusplus -} -#endif -#endif diff --git a/c/src/lib/libbsp/m68k/ods68302/include/debugport.h b/c/src/lib/libbsp/m68k/ods68302/include/debugport.h deleted file mode 100644 index c79f4aa2e4..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/include/debugport.h +++ /dev/null @@ -1,40 +0,0 @@ -/*****************************************************************************/ -/* - Debug Port Support - -*/ -/*****************************************************************************/ - -#if !defined(_DEBUGPORT_H_) - #define _DEBUGPORT_H_ - -#if __cplusplus -extern "C" -{ -#endif - - /* normall automatic, only need when re-initialising */ - void debug_port_initialise(void); - - unsigned char debug_port_status(const unsigned char status); - unsigned char debug_port_in(void); - void debug_port_out(const unsigned char character); - - void debug_port_write(const char *buffer); - void debug_port_write_buffer(const char *buffer, unsigned int size); - - void debug_port_write_hex_uint(const unsigned int value); - void debug_port_write_hex_ulong(const unsigned long value); - - /* - * special banner message for CPU specific boot code, - * initialises the debug port - */ - void debug_port_banner(void); - void debug_port_printf(const char *format, ...); - -#if __cplusplus -} -#endif - -#endif diff --git a/c/src/lib/libbsp/m68k/ods68302/include/m68302scc.h b/c/src/lib/libbsp/m68k/ods68302/include/m68302scc.h deleted file mode 100644 index bd0b13d5c4..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/include/m68302scc.h +++ /dev/null @@ -1,32 +0,0 @@ -/*****************************************************************************/ -/* - M68302 Scc Polled Uart Support - - */ -/*****************************************************************************/ - -#if !defined(_M68302SCC_H_) -#define _M68302SCC_H_ - -#if __cplusplus -extern "C" -{ -#endif - -#define SCC_4800 (0) -#define SCC_9600 (1) -#define SCC_19200 (2) -#define SCC_38400 (3) -#define SCC_57600 (4) -#define SCC_115700 (5) - -void scc_initialise(int channel, int baud_rate, int lf_translate); -unsigned char scc_status(int channel, const unsigned char status); -unsigned char scc_in(int channel); -void scc_out(int channel, const unsigned char character); - -#if __cplusplus -} -#endif - -#endif diff --git a/c/src/lib/libbsp/m68k/ods68302/make/custom/ods68302-testsuite.tcfg b/c/src/lib/libbsp/m68k/ods68302/make/custom/ods68302-testsuite.tcfg deleted file mode 100644 index 5bed6037c3..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/make/custom/ods68302-testsuite.tcfg +++ /dev/null @@ -1,10 +0,0 @@ -# -# ods68302 RTEMS Test Database. -# -# Format is one line per test that is _NOT_ built. -# - -fileio -fsdosfsname01 -iostream -utf8proc01 diff --git a/c/src/lib/libbsp/m68k/ods68302/make/custom/ods68302.cfg b/c/src/lib/libbsp/m68k/ods68302/make/custom/ods68302.cfg deleted file mode 100644 index b23ea1cff0..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/make/custom/ods68302.cfg +++ /dev/null @@ -1,31 +0,0 @@ -# -# Config file for a "ODS 68302" BSP -# -# Differs from the gen68302 by providing most of the boot code as C -# code. This allows separate board definitions to be based on C -# header files. The file is based on the VARIANT defined. - -include $(RTEMS_ROOT)/make/custom/default.cfg - -RTEMS_CPU=m68k -RTEMS_CPU_MODEL=m68302 - -# This contains the compiler options necessary to select the CPU model -# and (hopefully) optimize for it. -# -# 68000+softfloat results in gcc 2.95.2 giving default libraries. -# CPU_CFLAGS = -m68302 -msoft-float -CPU_CFLAGS = -mcpu=68302 - -# optimize flag: typically -O2 -CFLAGS_OPTIMIZE_V = -O2 -g -fomit-frame-pointer -CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections - -LDFLAGS = -Wl,--gc-sections - -ifeq ($(RTEMS_DEBUGGER),yes) -LINKCMDS=$(PROJECT_RELEASE)/lib/debugrom -else -LINKCMDS=$(PROJECT_RELEASE)/lib/rom -endif - diff --git a/c/src/lib/libbsp/m68k/ods68302/preinstall.am b/c/src/lib/libbsp/m68k/ods68302/preinstall.am deleted file mode 100644 index 7640e08547..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/preinstall.am +++ /dev/null @@ -1,91 +0,0 @@ -## Automatically generated by ampolish3 - Do not edit - -if AMPOLISH3 -$(srcdir)/preinstall.am: Makefile.am - $(AMPOLISH3) $(srcdir)/Makefile.am > $(srcdir)/preinstall.am -endif - -PREINSTALL_DIRS = -DISTCLEANFILES += $(PREINSTALL_DIRS) - -all-am: $(PREINSTALL_FILES) - -PREINSTALL_FILES = -CLEANFILES = $(PREINSTALL_FILES) - -all-local: $(TMPINSTALL_FILES) - -TMPINSTALL_FILES = -CLEANFILES += $(TMPINSTALL_FILES) - -$(PROJECT_LIB)/$(dirstamp): - @$(MKDIR_P) $(PROJECT_LIB) - @: > $(PROJECT_LIB)/$(dirstamp) -PREINSTALL_DIRS += $(PROJECT_LIB)/$(dirstamp) - -$(PROJECT_INCLUDE)/$(dirstamp): - @$(MKDIR_P) $(PROJECT_INCLUDE) - @: > $(PROJECT_INCLUDE)/$(dirstamp) -PREINSTALL_DIRS += $(PROJECT_INCLUDE)/$(dirstamp) - -$(PROJECT_INCLUDE)/bsp/$(dirstamp): - @$(MKDIR_P) $(PROJECT_INCLUDE)/bsp - @: > $(PROJECT_INCLUDE)/bsp/$(dirstamp) -PREINSTALL_DIRS += $(PROJECT_INCLUDE)/bsp/$(dirstamp) - -$(PROJECT_LIB)/bsp_specs: bsp_specs $(PROJECT_LIB)/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_LIB)/bsp_specs -PREINSTALL_FILES += $(PROJECT_LIB)/bsp_specs - -$(PROJECT_INCLUDE)/bsp.h: include/bsp.h $(PROJECT_INCLUDE)/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp.h - -$(PROJECT_INCLUDE)/tm27.h: ../../shared/include/tm27.h $(PROJECT_INCLUDE)/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/tm27.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/tm27.h - -$(PROJECT_INCLUDE)/bspopts.h: include/bspopts.h $(PROJECT_INCLUDE)/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bspopts.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/bspopts.h - -$(PROJECT_INCLUDE)/bsp/bootcard.h: ../../shared/include/bootcard.h $(PROJECT_INCLUDE)/bsp/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/bootcard.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/bootcard.h - -$(PROJECT_INCLUDE)/bare.h: include/bare.h $(PROJECT_INCLUDE)/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bare.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/bare.h - -$(PROJECT_INCLUDE)/crc.h: include/crc.h $(PROJECT_INCLUDE)/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/crc.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/crc.h - -$(PROJECT_INCLUDE)/debugport.h: include/debugport.h $(PROJECT_INCLUDE)/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/debugport.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/debugport.h - -$(PROJECT_INCLUDE)/m68302scc.h: include/m68302scc.h $(PROJECT_INCLUDE)/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/m68302scc.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/m68302scc.h - -$(PROJECT_INCLUDE)/coverhd.h: include/coverhd.h $(PROJECT_INCLUDE)/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/coverhd.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/coverhd.h - -$(PROJECT_LIB)/start.$(OBJEXT): start.$(OBJEXT) $(PROJECT_LIB)/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_LIB)/start.$(OBJEXT) -TMPINSTALL_FILES += $(PROJECT_LIB)/start.$(OBJEXT) - -$(PROJECT_LIB)/linkcmds: startup/linkcmds $(PROJECT_LIB)/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds -PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds - -$(PROJECT_LIB)/rom: startup/rom $(PROJECT_LIB)/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_LIB)/rom -PREINSTALL_FILES += $(PROJECT_LIB)/rom - -$(PROJECT_LIB)/debugger: startup/debugger $(PROJECT_LIB)/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_LIB)/debugger -PREINSTALL_FILES += $(PROJECT_LIB)/debugger - diff --git a/c/src/lib/libbsp/m68k/ods68302/start/debugreset.S b/c/src/lib/libbsp/m68k/ods68302/start/debugreset.S deleted file mode 100644 index 6090dd2cb2..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/start/debugreset.S +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Re-written the gen68302 start-up code. - * - * Uses gas syntax only, removed the OAR asm.h. - * - * Supplies a complete vector table in ROM. - * - * Manages all vectors with seperate handlers to trap unhandled - * execptions. - * - * Uses the target specific header file to get the runtime - * configuration - * - * COPYRIGHT (c) 1996 - * Objective Design Systems Pty Ltd (ODS) - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * - */ - -| -| Entry from debugger -| - .sect .text - -| -| Start -| -| Entered from a hardware reset. -| - - .global start | Default entry point for GNU -start: - - move.w #0x2700,%sr | Disable all interrupts - - | - | zero out uninitialized data area - | - -zerobss: - moveal #_clear_end,%a0 | find end of .bss - moveal #_clear_start,%a1 | find beginning of .bss - moveq #0,%d0 - -zerobss_loop: - - movel %d0,%a1@+ | to zero out uninitialized - cmpal %a0,%a1 - jlt zerobss_loop | loop until end reached - - movel %d0,_stack_init | load stack top - - movw #0x3700,%sr | SUPV MODE,INTERRUPTS OFF!!! - movel %d0,%a7 | set master stack pointer - movel %d0,%a6 | set base pointer - - jsr boot_phase_3 - -| -| Initialised data -| - - .sect .data - - .global start_frame - -start_frame: - .space 4,0 - -| -| Uninitialised data -| - - .sect .bss - - .global environ - .align 2 - -environ: - .long 0 - - .global heap_size - .set heap_size,0x2000 - - .global stack_size - .set stack_size,0x1000 diff --git a/c/src/lib/libbsp/m68k/ods68302/start/reset.S b/c/src/lib/libbsp/m68k/ods68302/start/reset.S deleted file mode 100644 index 22f5d827eb..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/start/reset.S +++ /dev/null @@ -1,882 +0,0 @@ -/* - * Manages all vectors with seperate handlers to trap unhandled - * execptions. - * - * Re-written the gen68302 start-up code. - * - * Uses gas syntax only, removed the OAR asm.h. - * - * Supplies a complete vector table in ROM. - * - * Uses the target specific header file to get the runtime - * configuration - */ - -/* - * COPYRIGHT (c) 1996 - * Objective Design Systems Pty Ltd (ODS) - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * - */ - -#include /* just to indicate the dependency */ - -| -| some basic defined, this is that is required -| -#define MC68302_BAR 0x000000F2 -#define MC68302_BAR_FC_CFC 0x0000 -#define MC68302_SYS_RAM_SIZE 0x240 - -| -| Boot boot code in a special section, ld postions -| -| Initial stack pointer is in the dual ported RAM -| - .sect .resettext - - .global M68Kvec | Vector Table - -M68Kvec: | standard location for vectors - -| -| Make relative, can have the code positioned any where -| - -V___ISSP: .long MC68302_BASE + MC68302_SYS_RAM_SIZE -V____IPC: .long start - V___ISSP - -| -| Create the rest of the vector table to point to the unhandled expection -| handler -| -| Lots of macros, how-ever it creates a simple ROM vector table -| - -exception_handler = unhandled_exception - V___ISSP -#define MAKE_EXCEPTION_VECTOR(n) V___##n: .long (exception_handler + (n * 8)) - -MAKE_EXCEPTION_VECTOR(2) -MAKE_EXCEPTION_VECTOR(3) -MAKE_EXCEPTION_VECTOR(4) -MAKE_EXCEPTION_VECTOR(5) -MAKE_EXCEPTION_VECTOR(6) -MAKE_EXCEPTION_VECTOR(7) -MAKE_EXCEPTION_VECTOR(8) -MAKE_EXCEPTION_VECTOR(9) - -MAKE_EXCEPTION_VECTOR(10) -MAKE_EXCEPTION_VECTOR(11) -MAKE_EXCEPTION_VECTOR(12) -MAKE_EXCEPTION_VECTOR(13) -MAKE_EXCEPTION_VECTOR(14) -MAKE_EXCEPTION_VECTOR(15) -MAKE_EXCEPTION_VECTOR(16) -MAKE_EXCEPTION_VECTOR(17) -MAKE_EXCEPTION_VECTOR(18) -MAKE_EXCEPTION_VECTOR(19) - -MAKE_EXCEPTION_VECTOR(20) -MAKE_EXCEPTION_VECTOR(21) -MAKE_EXCEPTION_VECTOR(22) -MAKE_EXCEPTION_VECTOR(23) -MAKE_EXCEPTION_VECTOR(24) -MAKE_EXCEPTION_VECTOR(25) -MAKE_EXCEPTION_VECTOR(26) -MAKE_EXCEPTION_VECTOR(27) -MAKE_EXCEPTION_VECTOR(28) -MAKE_EXCEPTION_VECTOR(29) - -MAKE_EXCEPTION_VECTOR(30) -MAKE_EXCEPTION_VECTOR(31) -MAKE_EXCEPTION_VECTOR(32) -MAKE_EXCEPTION_VECTOR(33) -MAKE_EXCEPTION_VECTOR(34) -MAKE_EXCEPTION_VECTOR(35) -MAKE_EXCEPTION_VECTOR(36) -MAKE_EXCEPTION_VECTOR(37) -MAKE_EXCEPTION_VECTOR(38) -MAKE_EXCEPTION_VECTOR(39) - -MAKE_EXCEPTION_VECTOR(40) -MAKE_EXCEPTION_VECTOR(41) -MAKE_EXCEPTION_VECTOR(42) -MAKE_EXCEPTION_VECTOR(43) -MAKE_EXCEPTION_VECTOR(44) -MAKE_EXCEPTION_VECTOR(45) -MAKE_EXCEPTION_VECTOR(46) -MAKE_EXCEPTION_VECTOR(47) -MAKE_EXCEPTION_VECTOR(48) -MAKE_EXCEPTION_VECTOR(49) - -MAKE_EXCEPTION_VECTOR(50) -MAKE_EXCEPTION_VECTOR(51) -MAKE_EXCEPTION_VECTOR(52) -MAKE_EXCEPTION_VECTOR(53) -MAKE_EXCEPTION_VECTOR(54) -MAKE_EXCEPTION_VECTOR(55) -MAKE_EXCEPTION_VECTOR(56) -MAKE_EXCEPTION_VECTOR(57) -MAKE_EXCEPTION_VECTOR(58) -MAKE_EXCEPTION_VECTOR(59) - -MAKE_EXCEPTION_VECTOR(60) -MAKE_EXCEPTION_VECTOR(61) -MAKE_EXCEPTION_VECTOR(62) -MAKE_EXCEPTION_VECTOR(63) -MAKE_EXCEPTION_VECTOR(64) -MAKE_EXCEPTION_VECTOR(65) -MAKE_EXCEPTION_VECTOR(66) -MAKE_EXCEPTION_VECTOR(67) -MAKE_EXCEPTION_VECTOR(68) -MAKE_EXCEPTION_VECTOR(69) - -MAKE_EXCEPTION_VECTOR(70) -MAKE_EXCEPTION_VECTOR(71) -MAKE_EXCEPTION_VECTOR(72) -MAKE_EXCEPTION_VECTOR(73) -MAKE_EXCEPTION_VECTOR(74) -MAKE_EXCEPTION_VECTOR(75) -MAKE_EXCEPTION_VECTOR(76) -MAKE_EXCEPTION_VECTOR(77) -MAKE_EXCEPTION_VECTOR(78) -MAKE_EXCEPTION_VECTOR(79) - -MAKE_EXCEPTION_VECTOR(80) -MAKE_EXCEPTION_VECTOR(81) -MAKE_EXCEPTION_VECTOR(82) -MAKE_EXCEPTION_VECTOR(83) -MAKE_EXCEPTION_VECTOR(84) -MAKE_EXCEPTION_VECTOR(85) -MAKE_EXCEPTION_VECTOR(86) -MAKE_EXCEPTION_VECTOR(87) -MAKE_EXCEPTION_VECTOR(88) -MAKE_EXCEPTION_VECTOR(89) - -MAKE_EXCEPTION_VECTOR(90) -MAKE_EXCEPTION_VECTOR(91) -MAKE_EXCEPTION_VECTOR(92) -MAKE_EXCEPTION_VECTOR(93) -MAKE_EXCEPTION_VECTOR(94) -MAKE_EXCEPTION_VECTOR(95) -MAKE_EXCEPTION_VECTOR(96) -MAKE_EXCEPTION_VECTOR(97) -MAKE_EXCEPTION_VECTOR(98) -MAKE_EXCEPTION_VECTOR(99) - -MAKE_EXCEPTION_VECTOR(100) -MAKE_EXCEPTION_VECTOR(101) -MAKE_EXCEPTION_VECTOR(102) -MAKE_EXCEPTION_VECTOR(103) -MAKE_EXCEPTION_VECTOR(104) -MAKE_EXCEPTION_VECTOR(105) -MAKE_EXCEPTION_VECTOR(106) -MAKE_EXCEPTION_VECTOR(107) -MAKE_EXCEPTION_VECTOR(108) -MAKE_EXCEPTION_VECTOR(109) - -MAKE_EXCEPTION_VECTOR(110) -MAKE_EXCEPTION_VECTOR(111) -MAKE_EXCEPTION_VECTOR(112) -MAKE_EXCEPTION_VECTOR(113) -MAKE_EXCEPTION_VECTOR(114) -MAKE_EXCEPTION_VECTOR(115) -MAKE_EXCEPTION_VECTOR(116) -MAKE_EXCEPTION_VECTOR(117) -MAKE_EXCEPTION_VECTOR(118) -MAKE_EXCEPTION_VECTOR(119) - -MAKE_EXCEPTION_VECTOR(120) -MAKE_EXCEPTION_VECTOR(121) -MAKE_EXCEPTION_VECTOR(122) -MAKE_EXCEPTION_VECTOR(123) -MAKE_EXCEPTION_VECTOR(124) -MAKE_EXCEPTION_VECTOR(125) -MAKE_EXCEPTION_VECTOR(126) -MAKE_EXCEPTION_VECTOR(127) -MAKE_EXCEPTION_VECTOR(128) -MAKE_EXCEPTION_VECTOR(129) - -MAKE_EXCEPTION_VECTOR(130) -MAKE_EXCEPTION_VECTOR(131) -MAKE_EXCEPTION_VECTOR(132) -MAKE_EXCEPTION_VECTOR(133) -MAKE_EXCEPTION_VECTOR(134) -MAKE_EXCEPTION_VECTOR(135) -MAKE_EXCEPTION_VECTOR(136) -MAKE_EXCEPTION_VECTOR(137) -MAKE_EXCEPTION_VECTOR(138) -MAKE_EXCEPTION_VECTOR(139) - -MAKE_EXCEPTION_VECTOR(140) -MAKE_EXCEPTION_VECTOR(141) -MAKE_EXCEPTION_VECTOR(142) -MAKE_EXCEPTION_VECTOR(143) -MAKE_EXCEPTION_VECTOR(144) -MAKE_EXCEPTION_VECTOR(145) -MAKE_EXCEPTION_VECTOR(146) -MAKE_EXCEPTION_VECTOR(147) -MAKE_EXCEPTION_VECTOR(148) -MAKE_EXCEPTION_VECTOR(149) - -MAKE_EXCEPTION_VECTOR(150) -MAKE_EXCEPTION_VECTOR(151) -MAKE_EXCEPTION_VECTOR(152) -MAKE_EXCEPTION_VECTOR(153) -MAKE_EXCEPTION_VECTOR(154) -MAKE_EXCEPTION_VECTOR(155) -MAKE_EXCEPTION_VECTOR(156) -MAKE_EXCEPTION_VECTOR(157) -MAKE_EXCEPTION_VECTOR(158) -MAKE_EXCEPTION_VECTOR(159) - -MAKE_EXCEPTION_VECTOR(160) -MAKE_EXCEPTION_VECTOR(161) -MAKE_EXCEPTION_VECTOR(162) -MAKE_EXCEPTION_VECTOR(163) -MAKE_EXCEPTION_VECTOR(164) -MAKE_EXCEPTION_VECTOR(165) -MAKE_EXCEPTION_VECTOR(166) -MAKE_EXCEPTION_VECTOR(167) -MAKE_EXCEPTION_VECTOR(168) -MAKE_EXCEPTION_VECTOR(169) - -MAKE_EXCEPTION_VECTOR(170) -MAKE_EXCEPTION_VECTOR(171) -MAKE_EXCEPTION_VECTOR(172) -MAKE_EXCEPTION_VECTOR(173) -MAKE_EXCEPTION_VECTOR(174) -MAKE_EXCEPTION_VECTOR(175) -MAKE_EXCEPTION_VECTOR(176) -MAKE_EXCEPTION_VECTOR(177) -MAKE_EXCEPTION_VECTOR(178) -MAKE_EXCEPTION_VECTOR(179) - -MAKE_EXCEPTION_VECTOR(180) -MAKE_EXCEPTION_VECTOR(181) -MAKE_EXCEPTION_VECTOR(182) -MAKE_EXCEPTION_VECTOR(183) -MAKE_EXCEPTION_VECTOR(184) -MAKE_EXCEPTION_VECTOR(185) -MAKE_EXCEPTION_VECTOR(186) -MAKE_EXCEPTION_VECTOR(187) -MAKE_EXCEPTION_VECTOR(188) -MAKE_EXCEPTION_VECTOR(189) - -MAKE_EXCEPTION_VECTOR(190) -MAKE_EXCEPTION_VECTOR(191) -MAKE_EXCEPTION_VECTOR(192) -MAKE_EXCEPTION_VECTOR(193) -MAKE_EXCEPTION_VECTOR(194) -MAKE_EXCEPTION_VECTOR(195) -MAKE_EXCEPTION_VECTOR(196) -MAKE_EXCEPTION_VECTOR(197) -MAKE_EXCEPTION_VECTOR(198) -MAKE_EXCEPTION_VECTOR(199) - -MAKE_EXCEPTION_VECTOR(200) -MAKE_EXCEPTION_VECTOR(201) -MAKE_EXCEPTION_VECTOR(202) -MAKE_EXCEPTION_VECTOR(203) -MAKE_EXCEPTION_VECTOR(204) -MAKE_EXCEPTION_VECTOR(205) -MAKE_EXCEPTION_VECTOR(206) -MAKE_EXCEPTION_VECTOR(207) -MAKE_EXCEPTION_VECTOR(208) -MAKE_EXCEPTION_VECTOR(209) - -MAKE_EXCEPTION_VECTOR(210) -MAKE_EXCEPTION_VECTOR(211) -MAKE_EXCEPTION_VECTOR(212) -MAKE_EXCEPTION_VECTOR(213) -MAKE_EXCEPTION_VECTOR(214) -MAKE_EXCEPTION_VECTOR(215) -MAKE_EXCEPTION_VECTOR(216) -MAKE_EXCEPTION_VECTOR(217) -MAKE_EXCEPTION_VECTOR(218) -MAKE_EXCEPTION_VECTOR(219) - -MAKE_EXCEPTION_VECTOR(220) -MAKE_EXCEPTION_VECTOR(221) -MAKE_EXCEPTION_VECTOR(222) -MAKE_EXCEPTION_VECTOR(223) -MAKE_EXCEPTION_VECTOR(224) -MAKE_EXCEPTION_VECTOR(225) -MAKE_EXCEPTION_VECTOR(226) -MAKE_EXCEPTION_VECTOR(227) -MAKE_EXCEPTION_VECTOR(228) -MAKE_EXCEPTION_VECTOR(229) - -MAKE_EXCEPTION_VECTOR(230) -MAKE_EXCEPTION_VECTOR(231) -MAKE_EXCEPTION_VECTOR(232) -MAKE_EXCEPTION_VECTOR(233) -MAKE_EXCEPTION_VECTOR(234) -MAKE_EXCEPTION_VECTOR(235) -MAKE_EXCEPTION_VECTOR(236) -MAKE_EXCEPTION_VECTOR(237) -MAKE_EXCEPTION_VECTOR(238) -MAKE_EXCEPTION_VECTOR(239) - -MAKE_EXCEPTION_VECTOR(240) -MAKE_EXCEPTION_VECTOR(241) -MAKE_EXCEPTION_VECTOR(242) -MAKE_EXCEPTION_VECTOR(243) -MAKE_EXCEPTION_VECTOR(244) -MAKE_EXCEPTION_VECTOR(245) -MAKE_EXCEPTION_VECTOR(246) -MAKE_EXCEPTION_VECTOR(247) -MAKE_EXCEPTION_VECTOR(248) -MAKE_EXCEPTION_VECTOR(249) - -MAKE_EXCEPTION_VECTOR(250) -MAKE_EXCEPTION_VECTOR(251) -MAKE_EXCEPTION_VECTOR(252) -MAKE_EXCEPTION_VECTOR(253) -MAKE_EXCEPTION_VECTOR(254) -MAKE_EXCEPTION_VECTOR(255) - -| -| Start -| -| Entered from a hardware reset. -| - - .global start | Default entry point for GNU -start: - - move.w #0x2700,%sr | Disable all interrupts - - | - | Program the BAR, give us a stack !! - | - - moveq #0,%d0 - | Joel: With the change of MC68302_BASE from a #define to a linker - | symbol, the following 4 instructions replace this one: - | move.w #(MC68302_BASE >> 12),%d0 - move.l #MC68302_BASE,%d0 - moveq.l #12,%d1 - lsr.l %d1,%d0 - and.l #0xFFFF,%d0 - - or.w #(MC68302_BAR_FC_CFC << 12),%d0 - move.l #MC68302_BAR,%a0 - move.w %d0,%a0@(0) - - | - | watch for sign extended maths with the linker on (boot_phase_1-V___ISSP) - | manage the address with code, limited address of 2K at reset for CS0 - | - - move.l #boot_phase_1,%d0 - and.l #0x1FFF,%d0 - move.l %d0,%a0 - jsr %a0@(0) | programs all basic 302 registers - - | - | Map to the 68302 registers - | - - move.l #MC68302_BASE,%a5 - - | - | Make a vector table in RAM - | - - move.l #RAM_BASE,%a0 | a0 -> rom vector table - moveal #ROM_BASE,%a1 | d1 -> start of tmp SRAM - - move.l #255,%d0 - -copy_vec_table: - - move.l (%a0)+,%d1 - or.l #ROM_BASE,%d1 - move.l %d1,(%a1)+ - subq.l #1,%d0 - bne copy_vec_table - -#if defined(SYSTEM_TABLE_ANCHOR_OFFSET) - | - | Clear the system table - | - - move.l #SYSTEM_TABLE_ANCHOR_OFFSET,%a0 - move.l #0,(%a0) -#endif - - | - | Copy the chip select swap code to DPRAM and run it - | - - move.l #boot_phase_2,%d0 - and.l #(ROM_SIZE - 1),%d0 - move.l %d0,%a0 | a0 -> remap code - lea %a5@(0),%a1 | a1 -> internal system RAM - - move.l #boot_phase_3,%d0 - and.l #(ROM_SIZE - 1),%d0 - sub.l %a0,%d0 - -copy_remap: - move.b (%a0)+,(%a1)+ | copy - dbra %d0,copy_remap - - | - | Jump to the remap code in the 68302''s internal system RAM. - | - - jsr %a5@(0) | execute the swap code - - | - | Map to the 68302 registers - | - - move.l #MC68302_BASE,%a5 - - | - | Copy initialized data area from ROM to RAM - | - -copy_data: - moveal #_etext,%a0 | find the end of .text - moveal #_copy_start,%a1 | find the beginning of .data - moveal #_edata,%a2 | find the end of .data - -copy_data_loop: - - movel %a0@+,%a1@+ | copy the data - cmpal %a2,%a1 - jlt copy_data_loop | loop until edata reached - - | - | zero out uninitialized data area - | - -zerobss: - moveal #_clear_end,%a0 | find end of .bss - moveal #_clear_start,%a1 | find beginning of .bss - moveq #0,%d0 - -zerobss_loop: - - movel %d0,%a1@+ | to zero out uninitialized - cmpal %a0,%a1 - jlt zerobss_loop | loop until _end reached - - movel #stack_end,%d0 - andl #0xfffffffc,%d0 | align it on 16 byte boundary - - movw #0x3700,%sr | SUPV MODE,INTERRUPTS OFF!!! - movel %d0,%a7 | set master stack pointer - movel %d0,%a6 | set base pointer - - jsr boot_phase_3 - -| -| Create an unhandled exception jump table. The table has an entry for -| each vector in the vector table. The entry pushes the vector number onto -| the stack and then calls a common exception handler using PIC. -| -| The macros are to create the labels and format vectors. -| - -#define FORMAT_ID(n) (n << 2) -#define EXPAND(x) x -#define EXCEPTION_HANDLER(h, n) EH__##n: move.w EXPAND(h) FORMAT_ID(n),-(%sp) ; \ - bra common_exception_handler - -unhandled_exception: - -EXCEPTION_HANDLER(#, 0) -EXCEPTION_HANDLER(#, 1) -EXCEPTION_HANDLER(#, 2) -EXCEPTION_HANDLER(#, 3) -EXCEPTION_HANDLER(#, 4) -EXCEPTION_HANDLER(#, 5) -EXCEPTION_HANDLER(#, 6) -EXCEPTION_HANDLER(#, 7) -EXCEPTION_HANDLER(#, 8) -EXCEPTION_HANDLER(#, 9) - -EXCEPTION_HANDLER(#, 10) -EXCEPTION_HANDLER(#, 11) -EXCEPTION_HANDLER(#, 12) -EXCEPTION_HANDLER(#, 13) -EXCEPTION_HANDLER(#, 14) -EXCEPTION_HANDLER(#, 15) -EXCEPTION_HANDLER(#, 16) -EXCEPTION_HANDLER(#, 17) -EXCEPTION_HANDLER(#, 18) -EXCEPTION_HANDLER(#, 19) - -EXCEPTION_HANDLER(#, 20) -EXCEPTION_HANDLER(#, 21) -EXCEPTION_HANDLER(#, 22) -EXCEPTION_HANDLER(#, 23) -EXCEPTION_HANDLER(#, 24) -EXCEPTION_HANDLER(#, 25) -EXCEPTION_HANDLER(#, 26) -EXCEPTION_HANDLER(#, 27) -EXCEPTION_HANDLER(#, 28) -EXCEPTION_HANDLER(#, 29) - -EXCEPTION_HANDLER(#, 30) -EXCEPTION_HANDLER(#, 31) -EXCEPTION_HANDLER(#, 32) -EXCEPTION_HANDLER(#, 33) -EXCEPTION_HANDLER(#, 34) -EXCEPTION_HANDLER(#, 35) -EXCEPTION_HANDLER(#, 36) -EXCEPTION_HANDLER(#, 37) -EXCEPTION_HANDLER(#, 38) -EXCEPTION_HANDLER(#, 39) - -EXCEPTION_HANDLER(#, 40) -EXCEPTION_HANDLER(#, 41) -EXCEPTION_HANDLER(#, 42) -EXCEPTION_HANDLER(#, 43) -EXCEPTION_HANDLER(#, 44) -EXCEPTION_HANDLER(#, 45) -EXCEPTION_HANDLER(#, 46) -EXCEPTION_HANDLER(#, 47) -EXCEPTION_HANDLER(#, 48) -EXCEPTION_HANDLER(#, 49) - -EXCEPTION_HANDLER(#, 50) -EXCEPTION_HANDLER(#, 51) -EXCEPTION_HANDLER(#, 52) -EXCEPTION_HANDLER(#, 53) -EXCEPTION_HANDLER(#, 54) -EXCEPTION_HANDLER(#, 55) -EXCEPTION_HANDLER(#, 56) -EXCEPTION_HANDLER(#, 57) -EXCEPTION_HANDLER(#, 58) -EXCEPTION_HANDLER(#, 59) - -EXCEPTION_HANDLER(#, 60) -EXCEPTION_HANDLER(#, 61) -EXCEPTION_HANDLER(#, 62) -EXCEPTION_HANDLER(#, 63) -EXCEPTION_HANDLER(#, 64) -EXCEPTION_HANDLER(#, 65) -EXCEPTION_HANDLER(#, 66) -EXCEPTION_HANDLER(#, 67) -EXCEPTION_HANDLER(#, 68) -EXCEPTION_HANDLER(#, 69) - -EXCEPTION_HANDLER(#, 70) -EXCEPTION_HANDLER(#, 71) -EXCEPTION_HANDLER(#, 72) -EXCEPTION_HANDLER(#, 73) -EXCEPTION_HANDLER(#, 74) -EXCEPTION_HANDLER(#, 75) -EXCEPTION_HANDLER(#, 76) -EXCEPTION_HANDLER(#, 77) -EXCEPTION_HANDLER(#, 78) -EXCEPTION_HANDLER(#, 79) - -EXCEPTION_HANDLER(#, 80) -EXCEPTION_HANDLER(#, 81) -EXCEPTION_HANDLER(#, 82) -EXCEPTION_HANDLER(#, 83) -EXCEPTION_HANDLER(#, 84) -EXCEPTION_HANDLER(#, 85) -EXCEPTION_HANDLER(#, 86) -EXCEPTION_HANDLER(#, 87) -EXCEPTION_HANDLER(#, 88) -EXCEPTION_HANDLER(#, 89) - -EXCEPTION_HANDLER(#, 90) -EXCEPTION_HANDLER(#, 91) -EXCEPTION_HANDLER(#, 92) -EXCEPTION_HANDLER(#, 93) -EXCEPTION_HANDLER(#, 94) -EXCEPTION_HANDLER(#, 95) -EXCEPTION_HANDLER(#, 96) -EXCEPTION_HANDLER(#, 97) -EXCEPTION_HANDLER(#, 98) -EXCEPTION_HANDLER(#, 99) - -EXCEPTION_HANDLER(#, 100) -EXCEPTION_HANDLER(#, 101) -EXCEPTION_HANDLER(#, 102) -EXCEPTION_HANDLER(#, 103) -EXCEPTION_HANDLER(#, 104) -EXCEPTION_HANDLER(#, 105) -EXCEPTION_HANDLER(#, 106) -EXCEPTION_HANDLER(#, 107) -EXCEPTION_HANDLER(#, 108) -EXCEPTION_HANDLER(#, 109) - -EXCEPTION_HANDLER(#, 110) -EXCEPTION_HANDLER(#, 111) -EXCEPTION_HANDLER(#, 112) -EXCEPTION_HANDLER(#, 113) -EXCEPTION_HANDLER(#, 114) -EXCEPTION_HANDLER(#, 115) -EXCEPTION_HANDLER(#, 116) -EXCEPTION_HANDLER(#, 117) -EXCEPTION_HANDLER(#, 118) -EXCEPTION_HANDLER(#, 119) - -EXCEPTION_HANDLER(#, 120) -EXCEPTION_HANDLER(#, 121) -EXCEPTION_HANDLER(#, 122) -EXCEPTION_HANDLER(#, 123) -EXCEPTION_HANDLER(#, 124) -EXCEPTION_HANDLER(#, 125) -EXCEPTION_HANDLER(#, 126) -EXCEPTION_HANDLER(#, 127) -EXCEPTION_HANDLER(#, 128) -EXCEPTION_HANDLER(#, 129) - -EXCEPTION_HANDLER(#, 130) -EXCEPTION_HANDLER(#, 131) -EXCEPTION_HANDLER(#, 132) -EXCEPTION_HANDLER(#, 133) -EXCEPTION_HANDLER(#, 134) -EXCEPTION_HANDLER(#, 135) -EXCEPTION_HANDLER(#, 136) -EXCEPTION_HANDLER(#, 137) -EXCEPTION_HANDLER(#, 138) -EXCEPTION_HANDLER(#, 139) - -EXCEPTION_HANDLER(#, 140) -EXCEPTION_HANDLER(#, 141) -EXCEPTION_HANDLER(#, 142) -EXCEPTION_HANDLER(#, 143) -EXCEPTION_HANDLER(#, 144) -EXCEPTION_HANDLER(#, 145) -EXCEPTION_HANDLER(#, 146) -EXCEPTION_HANDLER(#, 147) -EXCEPTION_HANDLER(#, 148) -EXCEPTION_HANDLER(#, 149) - -EXCEPTION_HANDLER(#, 150) -EXCEPTION_HANDLER(#, 151) -EXCEPTION_HANDLER(#, 152) -EXCEPTION_HANDLER(#, 153) -EXCEPTION_HANDLER(#, 154) -EXCEPTION_HANDLER(#, 155) -EXCEPTION_HANDLER(#, 156) -EXCEPTION_HANDLER(#, 157) -EXCEPTION_HANDLER(#, 158) -EXCEPTION_HANDLER(#, 159) - -EXCEPTION_HANDLER(#, 160) -EXCEPTION_HANDLER(#, 161) -EXCEPTION_HANDLER(#, 162) -EXCEPTION_HANDLER(#, 163) -EXCEPTION_HANDLER(#, 164) -EXCEPTION_HANDLER(#, 165) -EXCEPTION_HANDLER(#, 166) -EXCEPTION_HANDLER(#, 167) -EXCEPTION_HANDLER(#, 168) -EXCEPTION_HANDLER(#, 169) - -EXCEPTION_HANDLER(#, 170) -EXCEPTION_HANDLER(#, 171) -EXCEPTION_HANDLER(#, 172) -EXCEPTION_HANDLER(#, 173) -EXCEPTION_HANDLER(#, 174) -EXCEPTION_HANDLER(#, 175) -EXCEPTION_HANDLER(#, 176) -EXCEPTION_HANDLER(#, 177) -EXCEPTION_HANDLER(#, 178) -EXCEPTION_HANDLER(#, 179) - -EXCEPTION_HANDLER(#, 180) -EXCEPTION_HANDLER(#, 181) -EXCEPTION_HANDLER(#, 182) -EXCEPTION_HANDLER(#, 183) -EXCEPTION_HANDLER(#, 184) -EXCEPTION_HANDLER(#, 185) -EXCEPTION_HANDLER(#, 186) -EXCEPTION_HANDLER(#, 187) -EXCEPTION_HANDLER(#, 188) -EXCEPTION_HANDLER(#, 189) - -EXCEPTION_HANDLER(#, 190) -EXCEPTION_HANDLER(#, 191) -EXCEPTION_HANDLER(#, 192) -EXCEPTION_HANDLER(#, 193) -EXCEPTION_HANDLER(#, 194) -EXCEPTION_HANDLER(#, 195) -EXCEPTION_HANDLER(#, 196) -EXCEPTION_HANDLER(#, 197) -EXCEPTION_HANDLER(#, 198) -EXCEPTION_HANDLER(#, 199) - -EXCEPTION_HANDLER(#, 200) -EXCEPTION_HANDLER(#, 201) -EXCEPTION_HANDLER(#, 202) -EXCEPTION_HANDLER(#, 203) -EXCEPTION_HANDLER(#, 204) -EXCEPTION_HANDLER(#, 205) -EXCEPTION_HANDLER(#, 206) -EXCEPTION_HANDLER(#, 207) -EXCEPTION_HANDLER(#, 208) -EXCEPTION_HANDLER(#, 209) - -EXCEPTION_HANDLER(#, 210) -EXCEPTION_HANDLER(#, 211) -EXCEPTION_HANDLER(#, 212) -EXCEPTION_HANDLER(#, 213) -EXCEPTION_HANDLER(#, 214) -EXCEPTION_HANDLER(#, 215) -EXCEPTION_HANDLER(#, 216) -EXCEPTION_HANDLER(#, 217) -EXCEPTION_HANDLER(#, 218) -EXCEPTION_HANDLER(#, 219) - -EXCEPTION_HANDLER(#, 220) -EXCEPTION_HANDLER(#, 221) -EXCEPTION_HANDLER(#, 222) -EXCEPTION_HANDLER(#, 223) -EXCEPTION_HANDLER(#, 224) -EXCEPTION_HANDLER(#, 225) -EXCEPTION_HANDLER(#, 226) -EXCEPTION_HANDLER(#, 227) -EXCEPTION_HANDLER(#, 228) -EXCEPTION_HANDLER(#, 229) - -EXCEPTION_HANDLER(#, 230) -EXCEPTION_HANDLER(#, 231) -EXCEPTION_HANDLER(#, 232) -EXCEPTION_HANDLER(#, 233) -EXCEPTION_HANDLER(#, 234) -EXCEPTION_HANDLER(#, 235) -EXCEPTION_HANDLER(#, 236) -EXCEPTION_HANDLER(#, 237) -EXCEPTION_HANDLER(#, 238) -EXCEPTION_HANDLER(#, 239) - -EXCEPTION_HANDLER(#, 240) -EXCEPTION_HANDLER(#, 241) -EXCEPTION_HANDLER(#, 242) -EXCEPTION_HANDLER(#, 243) -EXCEPTION_HANDLER(#, 244) -EXCEPTION_HANDLER(#, 245) -EXCEPTION_HANDLER(#, 246) -EXCEPTION_HANDLER(#, 247) -EXCEPTION_HANDLER(#, 248) -EXCEPTION_HANDLER(#, 249) - -EXCEPTION_HANDLER(#, 250) -EXCEPTION_HANDLER(#, 251) -EXCEPTION_HANDLER(#, 252) -EXCEPTION_HANDLER(#, 253) -EXCEPTION_HANDLER(#, 254) -EXCEPTION_HANDLER(#, 255) - -common_exception_handler: - - | - | Need to put the format/vector above the PC and status register - | - - move.l %d0,-(%sp) | free a register - move.w 4(%sp),%d0 | get the format/vector id - - | - | If a bus error or address error then trash the extra - | data saved on the stack - | - - cmp.w #0x0008,%d0 - beq ceh_10 - - cmp.w #0x000C,%d0 - beq ceh_10 - - bra ceh_20 -ceh_10: - - move.w %d0,12(%sp) | need to move the format/id - move.l (%sp)+,%d0 | recover d0 - addq #8,%sp | trash the stack - move.l %d0,-(%sp) | free a register, again - move.w 4(%sp),%d0 | get the format/vector id - -ceh_20: - - move.w 6(%sp),4(%sp) - move.w 8(%sp),6(%sp) - move.w 10(%sp),8(%sp) - move.w %d0,10(%sp) | put the format/vector id - move.l (%sp)+,%d0 - - | - | Save all the registers, pass control to a dump trace routine - | - - movem.l %d0-%d7/%a0-%a7,%sp@- - - | - | check to see if ROM is mapped to zero - | - - move.l #(ROM_SIZE - 1),%d1 - not.l %d1 - lea.l %pc@(0),%a0 | were are we currently - move.l %a0,%d0 | need to use a data register - and.l %d1,%d0 | keep the top part of the address - move.l #trace_exception,%d1 | get the linked address - and.l #(ROM_SIZE - 1),%d1 | obtain the offset into the ROM - or.l %d1,%d0 | apply it to the trace exception offset - move.l %d0,%a0 | need an address register for jumping - jsr %a0@(0) - -ceh_30: - jmp ceh_30 - -| -| The RAM based vector table -| - - .sect .vtable - - .global vector_table - -vector_table: - .space (256 * 4),0 - -| -| Initialised data -| - - .sect .data - - .global start_frame - -start_frame: - .space 4,0 - -| -| Uninitialised data -| - - .sect .bss - - .global environ - .align 2 - -environ: - .long 0 - - .global heap_size - .set heap_size,0x2000 - - .global stack_size - .set stack_size,0x1000 - .global stack_start - -stack_start: -stack_base: - .space 0x2000, 0 -stack_end: - .long 0 diff --git a/c/src/lib/libbsp/m68k/ods68302/startup/cpuboot.c b/c/src/lib/libbsp/m68k/ods68302/startup/cpuboot.c deleted file mode 100644 index 2d537facc2..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/startup/cpuboot.c +++ /dev/null @@ -1,140 +0,0 @@ -/*****************************************************************************/ -/* - Boot the CPU. - - Occurs in 3 phases for a 68302. - - Phase 1. - - Called as soon as able after reset. The BAR has been programed, and - a small stack exists in the DPRAM. All interrupts are masked, and - the processor is running in supervisor mode. No other hardware or - chip selects are active. - - This phase programs the chip select registers, the parallel ports - are set into default configurations, and basic registers cleared or - reset. The leds are programmed to show the end of phase 1. - - Phase 2. - - This is a piece of code which is copied to DPRAM and executed. It - should not do any more thann is currently present. The return to ROM - is managed by modifing the return address. Again leds show the status. - - Phase 3. - - This code executes with a valid C environment. That is the data - section has been intialised and the bss section set to 0. This phase - performs any special card initialisation and then calls boot card. - -*/ -/*****************************************************************************/ - -#include -#include -#include -#include -#include - -/* - Open the address, reset all registers - */ - -extern int ROM_SIZE, ROM_BASE; -extern int RAM_SIZE, RAM_BASE; - -#define _ROM_SIZE ((unsigned int)&ROM_SIZE) -#define _ROM_BASE ((unsigned int)&ROM_BASE) -#define _RAM_SIZE ((unsigned int)&RAM_SIZE) -#define _RAM_BASE ((unsigned int)&RAM_BASE) - -void boot_phase_1(void) -{ - M302_SCR = SCR_DEFAULT; - - WRITE_OR(CSEL_ROM, _ROM_SIZE, ROM_WAIT_STATES, OR_MASK_RW, OR_MASK_FC); - WRITE_BR(CSEL_ROM, _RAM_BASE, BR_READ_ONLY, BR_FC_NULL, BR_ENABLED); - WRITE_OR(CSEL_RAM, _RAM_SIZE, RAM_WAIT_STATES, OR_MASK_RW, OR_MASK_FC); - WRITE_BR(CSEL_RAM, _ROM_BASE, BR_READ_WRITE, BR_FC_NULL, BR_ENABLED); - -#if defined(CSEL_1) - WRITE_OR(CSEL_1, CSEL_1_SIZE, CSEL_1_WAIT_STATES, OR_MASK_RW, OR_MASK_FC); - WRITE_BR(CSEL_1, CSEL_1_BASE, BR_READ_WRITE, BR_FC_NULL, BR_ENABLED); -#endif - -#if defined(CSEL_2) - WRITE_OR(CSEL_2, CSEL_2_SIZE, CSEL_2_WAIT_STATES, OR_MASK_RW, OR_MASK_FC); - WRITE_BR(CSEL_2, CSEL_2_BASE, BR_READ_WRITE, BR_FC_NULL, BR_ENABLED); -#endif - - m302.reg.ipr = m302.reg.imr = m302.reg.isr = 0; - m302.reg.gimr = 0x0080; - - m302.reg.simode = 0; - - m302.reg.pacnt = CARD_PA_CONFIGURATION; - m302.reg.paddr = CARD_PA_DEFAULT_DIRECTIONS; - m302.reg.padat = CARD_PA_DEFAULT_DATA; - - m302.reg.pbcnt = CARD_PB_CONFIGURATION; - m302.reg.pbddr = CARD_PB_DEFAULT_DIRECTIONS; - m302.reg.pbdat = CARD_PB_DEFAULT_DATA; - - m302.reg.wrr = WATCHDOG_TIMEOUT_PERIOD | WATCHDOG_ENABLE; - -#if defined(LED_CONTROL) - LED_CONTROL(LED_1_RED, LED_2_OFF, LED_3_OFF, LED_4_OFF, - LED_5_OFF, LED_6_OFF, LED_7_OFF, LED_8_OFF); -#endif -} - -/* - Swap the chip select mapping for ROM and RAM - */ - -void boot_phase_2(void) -{ - uint32_t stack; - -#if defined(LED_CONTROL) - LED_CONTROL(LED_1_RED, LED_2_RED, LED_3_OFF, LED_4_OFF, - LED_5_OFF, LED_6_OFF, LED_7_OFF, LED_8_OFF); -#endif - - WRITE_BR(CSEL_ROM, _ROM_BASE, BR_READ_ONLY, BR_FC_NULL, BR_ENABLED); - WRITE_BR(CSEL_RAM, _RAM_BASE, BR_READ_WRITE, BR_FC_NULL, BR_ENABLED); - -#if defined(LED_CONTROL) - LED_CONTROL(LED_1_GREEN, LED_2_RED, LED_3_OFF, LED_4_OFF, - LED_5_OFF, LED_6_OFF, LED_7_OFF, LED_8_OFF); -#endif - - /* seems to want 2, looked at assember code output */ - *((volatile uint32_t*) (&stack + 2)) |= ROM_BASE; -} - -/* - Any pre-main initialisation, the C environment is setup, how-ever C++ - static constructors have not been called, and RTEMS is not initialised. - */ - -void set_debug_traps(void); -void breakpoint(void); - -void boot_phase_3(void) -{ - if (GDB_RUN_MONITOR()) - { - set_debug_traps(); - breakpoint(); - } - - debug_port_banner(); - - /* FIXME : add RAM and ROM checks */ - - /* boot the bsp, what ever this means */ - boot_card((void*)0); - - WATCHDOG_TRIGGER(); -} diff --git a/c/src/lib/libbsp/m68k/ods68302/startup/crc.c b/c/src/lib/libbsp/m68k/ods68302/startup/crc.c deleted file mode 100644 index 4170f9c57b..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/startup/crc.c +++ /dev/null @@ -1,86 +0,0 @@ -/*****************************************************************************/ -/* - CRC 16 Calculation - - This module calculates the CRC-16. - - */ -/*****************************************************************************/ - -#include "bsp.h" -#include -#include "crc.h" - - /* ---- - C O N S T A N T S - - */ - -static const uint16_t factor[] = - { - 0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241, - 0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440, - 0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40, - 0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841, - 0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40, - 0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41, - 0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641, - 0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040, - 0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240, - 0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441, - 0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41, - 0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840, - 0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41, - 0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40, - 0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640, - 0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041, - 0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240, - 0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441, - 0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41, - 0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840, - 0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41, - 0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40, - 0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640, - 0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041, - 0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241, - 0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440, - 0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40, - 0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841, - 0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40, - 0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41, - 0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641, - 0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040 - }; - -/* - MACRO : calculates a CRC byte wise - */ - -#define NEW_CRC(byte, crc) factor[(byte) ^ ((crc) & 0xFF)] ^ (((crc) >> 8) & 0xFF) - -/* ---- - CalcCRC - - Calculates the CRC value of a block of memory -*/ - -uint16_t calc_crc(void* vdata, /* pointer to memory block */ - uint32_t count) /* length of block in bytes */ -{ - register uint8_t *data = vdata; - register uint16_t crc; - register uint32_t byte; - - /* initialise to either 0x0 or 0xffff depending on the - CRC implementation */ - - crc = 0; - - for (byte = count; byte > 0; byte--) - { - WATCHDOG_TOGGLE(); - crc = NEW_CRC(*data++, crc); - } - - return crc; -} diff --git a/c/src/lib/libbsp/m68k/ods68302/startup/debugger b/c/src/lib/libbsp/m68k/ods68302/startup/debugger deleted file mode 100644 index 62fd5bc07d..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/startup/debugger +++ /dev/null @@ -1,76 +0,0 @@ -/* - * MC68302 Linker command file - */ - -SECTIONS -{ - .text . : - { - text_start = .; - *(.text) - etext = .; - . = ALIGN(4); - __CTOR_LIST__ = .; - LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) - *(.ctors) - LONG(0) - __CTOR_END__ = .; - . = ALIGN(4); - __DTOR_LIST__ = .; - LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) - *(.dtors) - LONG(0) - __DTOR_END__ = .; - } - - .tdata : { - _TLS_Data_begin = .; - *(.tdata .tdata.* .gnu.linkonce.td.*) - _TLS_Data_end = .; - } - .tbss : { - _TLS_BSS_begin = .; - *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) - _TLS_BSS_end = .; - } - _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin; - _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin; - _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin; - _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin; - _TLS_Size = _TLS_BSS_end - _TLS_Data_begin; - _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss)); - - .vtable (ADDR(.text) + SIZEOF(.text)) : - { - vtable_start = .; - *(.vtable) - evtable = .; - } - .data (ADDR(.vtable) + SIZEOF(.vtable)) : - { - data_start = .; - *(.data) - KEEP (*(SORT(.rtemsroset.*))) - KEEP (*(SORT(.rtemsrwset.*))) - edata = .; - } - .bss (ADDR(.data) + SIZEOF(.data)) : - { - bss_start = .; - *(.bss) - *(COMMON) - end = . ; - _end = . ; - } -} - - -RAM_BASE = DEFINED(RAM_BASE) ? RAM_BASE : 0x00000000; -RAM_SIZE = DEFINED(RAM_SIZE) ? RAM_SIZE : 0x00100000; -ROM_BASE = DEFINED(ROM_BASE) ? ROM_BASE : 0x00010000; -ROM_SIZE = DEFINED(ROM_SIZE) ? ROM_SIZE : 0x00100000; -MC68302_BASE = DEFINED(MC68302_BASE) ? MC68302_BASE : 0x00700000; -m302 = MC68302_BASE; -_VBR = 0; /* location of the VBR table (in RAM) */ - -ENTRY(start); diff --git a/c/src/lib/libbsp/m68k/ods68302/startup/debugport.c b/c/src/lib/libbsp/m68k/ods68302/startup/debugport.c deleted file mode 100644 index fcbdc99e86..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/startup/debugport.c +++ /dev/null @@ -1,160 +0,0 @@ -/*****************************************************************************/ -/* - High Level Debug Port Functions - - */ -/*****************************************************************************/ - -#include -#include - -#include "debugport.h" -#include "m68302scc.h" -#include "bsp.h" - -static int initialised; - -void debug_port_initialise(void) -{ - scc_initialise(CONSOLE_PORT, CONSOLE_BAUD, FALSE); -#if defined(DEBUG_PORT) - scc_initialise(DEBUG_PORT, DEBUG_BAUD, FALSE); -#endif -} - -unsigned char debug_port_status(const unsigned char status) -{ - if (!initialised) - { - initialised = 1; - debug_port_initialise(); - } - - return scc_status(CONSOLE_PORT, status); -} - -unsigned char debug_port_in(void) -{ - if (!initialised) - { - initialised = 1; - debug_port_initialise(); - } - - return scc_in(CONSOLE_PORT); -} - -void debug_port_out(const unsigned char character) -{ - if (!initialised) - { - initialised = 1; - debug_port_initialise(); - } - - scc_out(CONSOLE_PORT, character); -} - -void debug_port_write(const char *buffer) -{ - while (*buffer != '\0') - { - debug_port_out(*buffer++); - } -} - -void debug_port_write_buffer(const char *buffer, unsigned int size) -{ - unsigned int count; - for (count = 0; count < size; count++) - { - debug_port_out(buffer[count]); - } -} - -void debug_port_write_hex_uint(const unsigned int value) -{ - unsigned int bits = sizeof(value) * 8; - unsigned char c; - - do - { - bits -= 4; - c = (unsigned char) ((value >> bits) & 0x0F); - if (c < 10) - { - c += '0'; - } - else - { - c += 'a' - 10; - } - debug_port_out((char) c); - } - while (bits); -} - -void debug_port_write_hex_ulong(const unsigned long value) -{ - unsigned int bits = sizeof(value) * 8; - unsigned char c; - - do - { - bits -= 4; - c = (unsigned char) ((value >> bits) & 0x0F); - if (c < 10) - { - c += '0'; - } - else - { - c += 'a' - 10; - } - debug_port_out((char) c); - } - while (bits); -} - -#define BUFFER_SIZE (256) -static char buffer[BUFFER_SIZE]; - -void debug_port_printf(const char *format, ...) -{ - va_list args; - int written; - - /* gain access to the argument list */ - va_start(args, format); - - /* set the trap */ - buffer[BUFFER_SIZE - 2] = '\xAA'; - buffer[BUFFER_SIZE - 1] = '\x55'; - - /* format the string and send to stdout */ - written = vsprintf(buffer, format, args); - - /* try an trap format buffer overflows */ - if ((buffer[BUFFER_SIZE - 2] != '\xAA') || - (buffer[BUFFER_SIZE - 1] != '\x55')) - { - debug_port_write("debug port buffer overflow, halting..."); - DISABLE_WATCHDOG(); - while (1 == 1); - } - - /* see if an error occurred, if not flush the output buffer */ - if (written != -1) - { - debug_port_write_buffer(buffer, written); - } -} - -void debug_port_banner(void) -{ -#define CARD_LABEL "ods68302-" #VARIANT - - debug_port_write("\n\n\r"); - debug_port_write(_Copyright_Notice); - debug_port_write("\n\r " CARD_ID "\n\r"); -} diff --git a/c/src/lib/libbsp/m68k/ods68302/startup/gdb-hooks.c b/c/src/lib/libbsp/m68k/ods68302/startup/gdb-hooks.c deleted file mode 100644 index 45bfe42725..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/startup/gdb-hooks.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Hooks for GDB - * - */ - -#include -#include -#include - -static int initialised = 0; - -/* - * This file does not intend to make things part of the public interface. - * Methods here are only available to the GDB stub. So prototypes are - * needed to avoid warnings. - */ -void putDebugChar(char ch); -char getDebugChar(void); -void exceptionHandler(unsigned int vector, void *handler); - -void putDebugChar(char ch) -{ - if (!initialised) - { - scc_initialise(DEBUG_PORT, DEBUG_BAUD, 0); - initialised = 1; - } - - scc_out(DEBUG_PORT, ch); -} - -char getDebugChar(void) -{ - if (!initialised) - { - scc_initialise(DEBUG_PORT, DEBUG_BAUD, 0); - initialised = 1; - } - - while (!scc_status(DEBUG_PORT, 0)); - - return scc_in(DEBUG_PORT); -} - -/* - * Need to create yet another jump table for gdb this time - */ - -void (*exceptionHook)(unsigned int) = 0; - -typedef struct { - uint16_t move_a7; /* move #FORMAT_ID,%a7@- */ - uint16_t format_id; - uint16_t jmp; /* jmp _ISR_Handlers */ - uint32_t isr_handler; -} GDB_HANDLER_ENTRY; - -#if !defined(M68K_MOVE_A7) -#define M68K_MOVE_A7 0x3F3C -#endif - -#if !defined(M68K_JMP) -#define M68K_JMP 0x4EF9 -#endif - -/* points to jsr-exception-table in targets wo/ VBR register */ -static GDB_HANDLER_ENTRY gdb_jump_table[256]; - -void exceptionHandler(unsigned int vector, void *handler) -{ - uint32_t *interrupt_table = 0; - - gdb_jump_table[vector].move_a7 = M68K_MOVE_A7; - gdb_jump_table[vector].format_id = vector; - gdb_jump_table[vector].jmp = M68K_JMP; - gdb_jump_table[vector].isr_handler = (uint32_t) handler; - - interrupt_table[vector] = (uint32_t) &gdb_jump_table[vector]; -} diff --git a/c/src/lib/libbsp/m68k/ods68302/startup/linkcmds b/c/src/lib/libbsp/m68k/ods68302/startup/linkcmds deleted file mode 100644 index 39bdee0cbc..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/startup/linkcmds +++ /dev/null @@ -1,223 +0,0 @@ -/* - * MC68302 Linker command file - * - */ - -/* - * Declare some sizes. - */ -RamBase = DEFINED(RamBase) ? RamBase : 0x0; -RamSize = DEFINED(RamSize) ? RamSize : 1M; -HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0; -_StackSize = DEFINED(_StackSize) ? _StackSize : 0x1000; - -/* - * Memory map. - */ -RAM_BASE = DEFINED(RAM_BASE) ? RAM_BASE : 0x00000000; -RAM_SIZE = DEFINED(RAM_SIZE) ? RAM_SIZE : 0x00100000; -ROM_BASE = DEFINED(ROM_BASE) ? ROM_BASE : 0x00C00000; -ROM_SIZE = DEFINED(ROM_SIZE) ? ROM_SIZE : 0x00100000; -MC68302_BASE = DEFINED(MC68302_BASE) ? MC68302_BASE : 0x00700000; - -/* - * Declare on-board memory. - */ -MEMORY { - ram : ORIGIN = 0x00000000, LENGTH = 1M - rom : ORIGIN = 0x00C00000, LENGTH = 512K -} -SECTIONS -{ - .vtable RAM_BASE : - { - vtable_start = .; - *(.vtable*) - evtable = .; - } >ram - - /* - * Text, data and bss segments - */ - .text ROM_BASE : { - /* - * Needs to be first. 8K limit on CS0 at reset. - */ - *(.resettext); - *cpuboot.o(.text*) - - /* - * The reset of the text is entered once CS0 is remapped. - */ - *(.text*) - - /* - * C++ constructors/destructors - */ - *(.gnu.linkonce.t.*) - - /* - * Initialization and finalization code. - * - * Various files can provide initialization and finalization - * functions. crtbegin.o and crtend.o are two instances. The - * body of these functions are in .init and .fini sections. We - * accumulate the bodies here, and prepend function prologues - * from crti.o and function epilogues from crtn.o. crti.o must - * be linked first; crtn.o must be linked last. Because these - * are wildcards, it doesn't matter if the user does not - * actually link against crti.o and crtn.o; the linker won't - * look for a file to match a wildcard. The wildcard also - * means that it doesn't matter which directory crti.o and - * crtn.o are in. - */ - PROVIDE (_init = .); - *crti.o(.init) - *(.init) - *crtn.o(.init) - PROVIDE (_fini = .); - *crti.o(.fini) - *(.fini) - *crtn.o(.fini) - - /* - * Special FreeBSD sysctl sections. - */ - . = ALIGN (16); - __start_set_sysctl_set = .; - *(set_sysctl_*); - __stop_set_sysctl_set = ABSOLUTE(.); - *(set_domain_*); - *(set_pseudo_*); - - /* - * C++ constructors/destructors - * - * gcc uses crtbegin.o to find the start of the constructors - * and destructors so we make sure it is first. Because this - * is a wildcard, it doesn't matter if the user does not - * actually link against crtbegin.o; the linker won't look for - * a file to match a wildcard. The wildcard also means that - * it doesn't matter which directory crtbegin.o is in. The - * constructor and destructor list are terminated in - * crtend.o. The same comments apply to it. - */ - . = ALIGN (16); - *crtbegin.o(.ctors) - *(.ctors) - *crtend.o(.ctors) - *crtbegin.o(.dtors) - *(.dtors) - *crtend.o(.dtors) - - /* - * Exception frame info - */ - . = ALIGN (16); - *(.eh_frame) - - /* - * Read-only data - */ - . = ALIGN (16); - _rodata_start = .; - *(.rodata*) - KEEP (*(SORT(.rtemsroset.*))) - *(.gnu.linkonce.r*) - - . = ALIGN (16); - PROVIDE (_etext = .); - } >rom - - .tdata : { - _TLS_Data_begin = .; - *(.tdata .tdata.* .gnu.linkonce.td.*) - _TLS_Data_end = .; - } >rom - - .tbss : { - _TLS_BSS_begin = .; - *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) - _TLS_BSS_end = .; - } >rom - - _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin; - _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin; - _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin; - _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin; - _TLS_Size = _TLS_BSS_end - _TLS_Data_begin; - _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss)); - - - .data (ADDR(.vtable) + SIZEOF(.vtable)) : - AT (ADDR(.tdata) + SIZEOF(.tdata)) { - PROVIDE (_copy_start = .); - *(.data*) - KEEP (*(SORT(.rtemsrwset.*))) - *(.gnu.linkonce.d*) - *(.gcc_except_table*) - *(.jcr) - . = ALIGN (16); - PROVIDE (_edata = .); - PROVIDE (_copy_end = .); - } >ram - .bss (ADDR(.data) + SIZEOF(.data)) : { - _clear_start = .; - *(.dynbss) - *(.bss* .gnu.linkonce.b.*) - *(COMMON) - . = ALIGN (16); - PROVIDE (end = .); - - . += _StackSize; - . = ALIGN (16); - _stack_init = .; - _clear_end = .; - - WorkAreaBase = .; - } >ram - - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - - /* DWARF debug sections. - Symbols in the DWARF debugging sections are relative to the beginning - of the section so we begin them at 0. */ - /* DWARF 1 */ - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - - /* GNU DWARF 1 extensions */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - - /* DWARF 1.1 and DWARF 2 */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - - /* DWARF 2 */ - .debug_info 0 : { *(.debug_info) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - - /* SGI/MIPS DWARF 2 extensions */ - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } - /* These must appear regardless of . */ -} - -m302 = MC68302_BASE; -_VBR = ADDR(.vtable); /* location of the VBR table (in RAM) */ - diff --git a/c/src/lib/libbsp/m68k/ods68302/startup/m68302scc.c b/c/src/lib/libbsp/m68k/ods68302/startup/m68302scc.c deleted file mode 100644 index 6065cfb1ac..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/startup/m68302scc.c +++ /dev/null @@ -1,146 +0,0 @@ -/*****************************************************************************/ -/* - M68302 SCC Polled Driver - - */ -/*****************************************************************************/ - -#include -#include -#include - -#define M68302_SCC_COUNT (3) - -static volatile m302_SCC_t *scc[M68302_SCC_COUNT] = { 0, 0, 0 }; -static volatile m302_SCC_Registers_t *scc_reg[M68302_SCC_COUNT] = { 0, 0, 0 }; -static int scc_translate[M68302_SCC_COUNT] = { 0, 0, 0 }; - -static const uint16_t baud_clocks[] = -{ - (SYSTEM_CLOCK / ( 4800 * 16)), - (SYSTEM_CLOCK / ( 9600 * 16)), - (SYSTEM_CLOCK / ( 19200 * 16)), - (SYSTEM_CLOCK / ( 38400 * 16)), - (SYSTEM_CLOCK / ( 57600 * 16)), - (SYSTEM_CLOCK / (115700 * 16)) -}; - -void scc_initialise(int channel, int baud, int translate) -{ - uint16_t scon; - - if (channel < M68302_SCC_COUNT) - { - scc[channel] = &m302.scc1 + channel; - scc_reg[channel] = &m302.reg.scc[channel]; - scc_translate[channel] = translate; - - scon = (baud_clocks[baud] & 0xF800) == 0 ? 0 : 1; - scon |= (((baud_clocks[baud] / (1 + scon * 3)) - 1) << 1) & 0x0FFE; - - scc_reg[channel]->scon = scon; - scc_reg[channel]->scm = 0x0171; - - scc[channel]->bd.tx[0].status = 0x2000; - scc[channel]->bd.tx[0].length = 0; - scc[channel]->bd.tx[0].buffer = - (uint8_t*) &(scc[channel]->bd.tx[1].buffer); - - scc[channel]->bd.rx[0].status = 0x2000; - scc[channel]->bd.rx[0].length = 0; - scc[channel]->bd.rx[0].buffer = - (uint8_t*) &(scc[channel]->bd.rx[1].buffer); - - scc[channel]->parm.rfcr = 0x50; - scc[channel]->parm.tfcr = 0x50; - - scc[channel]->parm.mrblr = 0x0001; - scc[channel]->prot.uart.max_idl = 0x0004; - scc[channel]->prot.uart.brkcr = 1; - scc[channel]->prot.uart.parec = 0; - scc[channel]->prot.uart.frmec = 0; - scc[channel]->prot.uart.nosec = 0; - scc[channel]->prot.uart.brkec = 0; - scc[channel]->prot.uart.uaddr1 = 0; - scc[channel]->prot.uart.uaddr2 = 0; - scc[channel]->prot.uart.character[0] = 0x0003; - scc[channel]->prot.uart.character[1] = 0x8000; - - scc_reg[channel]->scce = 0xFF; - scc_reg[channel]->sccm = 0x15; - - scc_reg[channel]->scm = 0x17d; - } -} - -unsigned char scc_status(int channel, unsigned char status) -{ - uint16_t rx_status; - - m302.reg.wcn = 0; - - if ((channel < M68302_SCC_COUNT) && scc[channel]) - { - rx_status = scc[channel]->bd.rx[0].status; - - if ((rx_status & 0x8000) == 0) - { - if (rx_status & 0x003B) - { - return 2; - } - if (status == 0) - { - return 1; - } - } - } - - return 0; -} - -unsigned char scc_in(int channel) -{ - m302.reg.wcn = 0; - - if ((channel < M68302_SCC_COUNT) && scc[channel]) - { - if ((scc[channel]->bd.rx[0].status & 0x8000) == 0) - { - unsigned char c; - - c = *(scc[channel]->bd.rx[0].buffer); - - scc[channel]->bd.rx[0].status = 0xa000; - - return c; - } - } - - return 0; -} - -void scc_out(int channel, unsigned char character) -{ - if ((channel < M68302_SCC_COUNT) && scc[channel]) - { - do - { - m302.reg.wcn = 0; - } - while (scc[channel]->bd.tx[0].status & 0x8000); - - *(scc[channel]->bd.tx[0].buffer) = character; - - scc[channel]->bd.tx[0].length = 1; - scc[channel]->bd.tx[0].status = 0xa000; - - if (scc_translate[channel]) - { - if (character == '\n') - { - scc_out(channel, '\r'); - } - } - } -} diff --git a/c/src/lib/libbsp/m68k/ods68302/startup/m68k-stub.c b/c/src/lib/libbsp/m68k/ods68302/startup/m68k-stub.c deleted file mode 100644 index d9533efa06..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/startup/m68k-stub.c +++ /dev/null @@ -1,1087 +0,0 @@ -/**************************************************************************** - - THIS SOFTWARE IS NOT COPYRIGHTED - - HP offers the following for use in the public domain. HP makes no - warranty with regard to the software or it's performance and the - user accepts the software "AS IS" with all faults. - - HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD - TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - -****************************************************************************/ - -/**************************************************************************** - * Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $ - * - * Module name: remcom.c $ - * Revision: 1.34 $ - * Date: 91/03/09 12:29:49 $ - * Contributor: Lake Stevens Instrument Division$ - * - * Description: low level support for gdb debugger. $ - * - * Considerations: only works on target hardware $ - * - * Written by: Glenn Engel $ - * ModuleState: Experimental $ - * - * NOTES: See Below $ - * - * To enable debugger support, two things need to happen. One, a - * call to set_debug_traps() is necessary in order to allow any breakpoints - * or error conditions to be properly intercepted and reported to gdb. - * Two, a breakpoint needs to be generated to begin communication. This - * is most easily accomplished by a call to breakpoint(). Breakpoint() - * simulates a breakpoint by executing a trap #1. The breakpoint instruction - * is hardwired to trap #1 because not to do so is a compatibility problem-- - * there either should be a standard breakpoint instruction, or the protocol - * should be extended to provide some means to communicate which breakpoint - * instruction is in use (or have the stub insert the breakpoint). - * - * Some explanation is probably necessary to explain how exceptions are - * handled. When an exception is encountered the 68000 pushes the current - * program counter and status register onto the supervisor stack and then - * transfers execution to a location specified in it's vector table. - * The handlers for the exception vectors are hardwired to jmp to an address - * given by the relation: (exception - 256) * 6. These are decending - * addresses starting from -6, -12, -18, ... By allowing 6 bytes for - * each entry, a jsr, jmp, bsr, ... can be used to enter the exception - * handler. Using a jsr to handle an exception has an added benefit of - * allowing a single handler to service several exceptions and use the - * return address as the key differentiation. The vector number can be - * computed from the return address by [ exception = (addr + 1530) / 6 ]. - * The sole purpose of the routine _catchException is to compute the - * exception number and push it on the stack in place of the return address. - * The external function exceptionHandler() is - * used to attach a specific handler to a specific m68k exception. - * For 68020 machines, the ability to have a return address around just - * so the vector can be determined is not necessary because the '020 pushes an - * extra word onto the stack containing the vector offset - * - * Because gdb will sometimes write to the stack area to execute function - * calls, this program cannot rely on using the supervisor stack so it - * uses it's own stack area reserved in the int array remcomStack. - * - ************* - * - * The following gdb commands are supported: - * - * command function Return value - * - * g return the value of the CPU registers hex data or ENN - * G set the value of the CPU registers OK or ENN - * - * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN - * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN - * - * c Resume at current address SNN ( signal NN) - * cAA..AA Continue at address AA..AA SNN - * - * s Step one instruction SNN - * sAA..AA Step one instruction from AA..AA SNN - * - * k kill - * - * ? What was the last sigval ? SNN (signal NN) - * - * All commands and responses are sent with a packet which includes a - * checksum. A packet consists of - * - * $#. - * - * where - * :: - * :: < two hex digits computed as modulo 256 sum of > - * - * When a packet is received, it is first acknowledged with either '+' or '-'. - * '+' indicates a successful transfer. '-' indicates a failed transfer. - * - * Example: - * - * Host: Reply: - * $m0,10#2a +$00010203040506070809101112131415#42 - * - ****************************************************************************/ - -#include -#include -#include - -#include -#include - -/************************************************************************ - * - * external low-level support routines - */ -typedef void (*ExceptionHook)(int); /* pointer to function with int parm */ -typedef void (*Function)(void); /* pointer to a function */ - -/* assign an exception handler */ -Function exceptionHandler(int vector, Function handler); -extern ExceptionHook exceptionHook; /* hook variable for errors/exceptions */ - -int putDebugChar(char ch); -char getDebugChar(void); - -/************************/ -/* FORWARD DECLARATIONS */ -/************************/ -static int hex(char ch); -static void getpacket(char *buffer); -static void putpacket(char *buffer); -static char* mem2hex(char *mem, char *buf, int count); -static char* hex2mem(char *buf, char *mem, int count); -static void handle_buserror(void); -static int computeSignal(int exceptionVector); -static int hexToInt(char **ptr, int *intValue); - void handle_exception(int exceptionVector); -static void initializeRemcomErrorFrame(void); - -void set_debug_traps(void); -void breakpoint(void); - -/************************************************************************/ -/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/ -/* at least NUMREGBYTES*2 are needed for register packets */ -#define BUFMAX 400 - -static bool initialized = false; /* boolean flag. != 0 means we've been initialized */ - -int remote_debug; -/* debug > 0 prints ill-formed commands in valid packets & checksum errors */ - -static const char hexchars[]="0123456789abcdef"; - -/* there are 180 bytes of registers on a 68020 w/68881 */ -/* many of the fpa registers are 12 byte (96 bit) registers */ -#define NUMREGBYTES 180 -enum regnames {D0,D1,D2,D3,D4,D5,D6,D7, - A0,A1,A2,A3,A4,A5,A6,A7, - PS,PC, - FP0,FP1,FP2,FP3,FP4,FP5,FP6,FP7, - FPCONTROL,FPSTATUS,FPIADDR - }; - - -/* We keep a whole frame cache here. "Why?", I hear you cry, "doesn't - GDB handle that sort of thing?" Well, yes, I believe the only - reason for this cache is to save and restore floating point state - (fsave/frestore). A cleaner way to do this would be to make the - fsave data part of the registers which GDB deals with like any - other registers. This should not be a performance problem if the - ability to read individual registers is added to the protocol. */ - -typedef struct FrameStruct -{ - struct FrameStruct *previous; - int exceptionPC; /* pc value when this frame created */ - int exceptionVector; /* cpu vector causing exception */ - short frameSize; /* size of cpu frame in words */ - short sr; /* for 68000, this not always sr */ - int pc; - short format; - int fsaveHeader; - int morejunk[0]; /* exception frame, fp save... */ -} Frame; - -#define FRAMESIZE 500 -int gdbFrameStack[FRAMESIZE]; -static Frame *lastFrame; - -/* - * these should not be static cuz they can be used outside this module - */ -int registers[NUMREGBYTES/4]; -int superStack; - -#define STACKSIZE 10000 -int remcomStack[STACKSIZE/sizeof(int)]; -static int* stackPtr = &remcomStack[STACKSIZE/sizeof(int) - 1]; - -/* - * In many cases, the system will want to continue exception processing - * when a continue command is given. - * oldExceptionHook is a function to invoke in this case. - */ - -static ExceptionHook oldExceptionHook; - -#if (defined(__mc68020__) && !defined(__mcpu32__)) -/* the size of the exception stack on the 68020 varies with the type of - * exception. The following table is the number of WORDS used - * for each exception format. - */ -const short exceptionSize[] = { 4,4,6,4,4,4,4,4,29,10,16,46,12,4,4,4 }; -#endif - -#if defined(__mc68332__) -static const short exceptionSize[] = { 4,4,6,4,4,4,4,4,4,4,4,4,16,4,4,4 }; -#endif - -/************* jump buffer used for setjmp/longjmp **************************/ -jmp_buf remcomEnv; - -/*************************** ASSEMBLY CODE MACROS *************************/ -/* */ - -#if defined(__HAVE_68881__) - -/* do an fsave, then remember the address to begin a restore from */ -#define SAVE_FP_REGS() \ - __asm__ (" fsave %a0@-"); \ - __asm__ (" fmovemx %fp0-%fp7,registers+72"); \ - __asm__ (" fmoveml %fpcr/%fpsr/%fpi,registers+168"); - -#define RESTORE_FP_REGS() \ -__asm__ (" \n\ - fmoveml registers+168,%fpcr/%fpsr/%fpi \n\ - fmovemx registers+72,%fp0-%fp7 \n\ - cmpl #-1,%a0@ | skip frestore flag set ? \n\ - beq skip_frestore \n\ - frestore %a0@+ \n\ -skip_frestore: \n\ -"); - -#else - -#define SAVE_FP_REGS() -#define RESTORE_FP_REGS() - -#endif /* __HAVE_68881__ */ - -void return_to_super(void); -void return_to_user(void); - -__asm__ ("\n\ - .text\n\ -\n\ - .globl return_to_super\n\ - .align 4\n\ -return_to_super:\n\ - movel registers+60,%sp /* get new stack pointer */ \n\ - movel lastFrame,%a0 /* get last frame info */ \n\ - bra return_to_any\n\ -\n\ - .globl return_to_user\n\ - .align 4\n\ -\n\ -return_to_user:\n\ - movel registers+60,%a0 /* get usp */ \n\ - movel %a0,%usp /* set usp */ \n\ - movel superStack,%sp /* get original stack pointer */ \n\ -\n\ -return_to_any:\n\ - movel lastFrame,%a0 /* get last frame info */ \n\ - movel %a0@+,lastFrame /* link in previous frame */ \n\ - addql #8,%a0 /* skip over pc, vector#*/ \n\ - movew %a0@+,%d0 /* get # of words in cpu frame */ \n\ - addw %d0,%a0 /* point to end of data */ \n\ - addw %d0,%a0 /* point to end of data */ \n\ - movel %a0,%a1 \n\ -# \n\ -# copy the stack frame \n\ - subql #1,%d0\n\ -\n\ -copyUserLoop: \n\ - movew %a1@-,%sp@- \n\ - dbf %d0,copyUserLoop \n\ -"); - RESTORE_FP_REGS() -__asm__ ("\n\ - moveml registers,%d0-%d7/%a0-%a6\n\ - rte /* pop and go! */\n\ -"); - -#define DISABLE_INTERRUPTS() __asm__ (" oriw #0x0700,%sr"); -#define BREAKPOINT() __asm__ (" trap #1"); - -/* this function is called immediately when a level 7 interrupt occurs */ -/* if the previous interrupt level was 7 then we're already servicing */ -/* this interrupt and an rte is in order to return to the debugger. */ -/* For the 68000, the offset for sr is 6 due to the jsr return address */ -__asm__ ("\n\ - .text\n\ - .globl _debug_level7\n\ - .align 4\n\ -\n\ -_debug_level7:\n\ - movew %d0,%sp@-\n\ -"); - -#if (defined(__mc68020__) && !defined(__mcpu32__)) || defined(__mc68332__) -__asm__ ("\n\ - movew %sp@(2),%d0\n\ -"); -#else -__asm__ ("\n\ - movew %sp@(6),%d0\n\ -"); -#endif -__asm__ ("\n\ - andiw #0x700,%d0\n\ - cmpiw #0x700,%d0\n\ - beq _already7\n\ - movew %sp@+,%d0 \n\ - bra _catchException\n\ -_already7:\n\ - movew %sp@+,%d0\n\ -"); -#if defined (__mc68000__) && !(defined(__mc68020__) && !defined(__mcpu32__)) -__asm__ ("\n\ - lea %sp@(4),%sp"); /* pull off 68000 return address */ -#endif -__asm__ ("\n\ - rte\n\ -"); - -extern void _catchException(void); - -#if (defined(__mc68020__) && !defined(__mcpu32__)) || defined(__mc68332__) -/* This function is called when a 68020 exception occurs. It saves - * all the cpu and fpcp regs in the _registers array, creates a frame on a - * linked list of frames which has the cpu and fpcp stack frames needed - * to properly restore the context of these processors, and invokes - * an exception handler (remcom_handler). - * - * stack on entry: stack on exit: - * N bytes of junk exception # MSWord - * Exception Format Word exception # MSWord - * Program counter LSWord - * Program counter MSWord - * Status Register - * - * - */ -__asm__ (" \n\ - .text\n\ -\n\ - .globl _catchException\n\ - .align 4\n\ -_catchException:\n\ -"); - -DISABLE_INTERRUPTS(); - -__asm__ ("\n\ - moveml %d0-%d7/%a0-%a6,registers /* save registers */\n\ - movel lastFrame,%a0 /* last frame pointer */\n\ -"); -SAVE_FP_REGS(); -__asm__ ("\n\ - lea registers,%a5 /* get address of registers */\n\ - movew %sp@,%d1 /* get status register */\n\ - movew %d1,%a5@(66) /* save sr */ \n\ - movel %sp@(2),%a4 /* save pc in %a4 for later use */\n\ - movel %a4,%a5@(68) /* save pc in _regisers[] */\n\ -\n\ -#\n\ -# figure out how many bytes in the stack frame\n\ -#\n\ - movew %sp@(6),%d0 /* get '020 exception format */\n\ - movew %d0,%d2 /* make a copy of format word */\n\ - andiw #0xf000,%d0 /* mask off format type */\n\ - rolw #5,%d0 /* rotate into the low byte *2 */\n\ - lea exceptionSize,%a1 \n\ - addw %d0,%a1 /* index into the table */\n\ - movew %a1@,%d0 /* get number of words in frame */\n\ - movew %d0,%d3 /* save it */\n\ - subw %d0,%a0 /* adjust save pointer */\n\ - subw %d0,%a0 /* adjust save pointer(bytes) */\n\ - movel %a0,%a1 /* copy save pointer */\n\ - subql #1,%d0 /* predecrement loop counter */\n\ -#\n\ -# copy the frame\n\ -#\n\ -saveFrameLoop:\n\ - movew %sp@+,%a1@+\n\ - dbf %d0,saveFrameLoop\n\ -#\n\ -# now that the stack has been clenaed,\n\ -# save the %a7 in use at time of exception\n\ -\n\ - movel %sp,superStack /* save supervisor %sp */\n\ - andiw #0x2000,%d1 /* were we in supervisor mode ? */\n\ - beq userMode \n\ - movel %a7,%a5@(60) /* save %a7 */\n\ - bra a7saveDone\n\ -userMode: \n\ - movel %usp,%a1 \n\ - movel %a1,%a5@(60) /* save user stack pointer */\n\ -a7saveDone:\n\ -\n\ -#\n\ -# save size of frame\n\ - movew %d3,%a0@-\n\ -\n\ -#\n\ -# compute exception number\n\ - andl #0xfff,%d2 /* mask off vector offset */\n\ - lsrw #2,%d2 /* divide by 4 to get vect num */\n\ - movel %d2,%a0@- /* save it */\n\ -#\n\ -# save pc causing exception\n\ - movel %a4,%a0@-\n\ -#\n\ -# save old frame link and set the new value\n\ - movel lastFrame,%a1 /* last frame pointer */\n\ - movel %a1,%a0@- /* save pointer to prev frame */\n\ - movel %a0,lastFrame\n\ -\n\ - movel %d2,%sp@- /* push exception num */\n\ - movel exceptionHook,%a0 /* get address of handler */\n\ - jbsr %a0@ /* and call it */\n\ - clrl %sp@ /* replace exception num parm with frame ptr */\n\ - jbsr _returnFromException /* jbsr, but never returns */\n\ -\n\ -"); - -#else /* mc68000 */ - -/* This function is called when an exception occurs. It translates the - * return address found on the stack into an exception vector # which - * is then handled by either handle_exception or a system handler. - * _catchException provides a front end for both. - * - * stack on entry: stack on exit: - * Program counter MSWord exception # MSWord - * Program counter LSWord exception # MSWord - * Status Register - * Return Address MSWord - * Return Address LSWord - */ -__asm__ ("\n\ - .text\n\ - .globl _catchException\n\ - .align 4\n\ -_catchException:\n\ -"); -DISABLE_INTERRUPTS(); -__asm__ ("\n\ - moveml %d0-%d7/%a0-%a6,registers /* save registers */\n\ - movel lastFrame,%a0 /* last frame pointer */\n\ -"); - -SAVE_FP_REGS(); -__asm__ ("\n\ - moveq.l #0,%d2\n\ - movew %sp@+,%d2\n\ - lea registers,%a5 /* get address of registers */\n\ -\n\ - moveql #3,%d3 /* assume a three word frame */\n\ -\n\ - cmpiw #3,%d2 /* bus error or address error ? */\n\ - bgt normal /* if >3 then normal error */\n\ - movel %sp@+,%a0@- /* copy error info to frame buff*/\n\ - movel %sp@+,%a0@- /* these are never used */\n\ - moveql #7,%d3 /* this is a 7 word frame */\n\ - \n\ -normal: \n\ - movew %sp@+,%d1 /* pop status register */\n\ - movel %sp@+,%a4 /* pop program counter */\n\ -\n\ - cmpiw #33,%d2 /* trap #1, breakpoint ? */\n\ - bne not_breakpoint\n\ -\n\ - subql #2,%a4 /* trap leaves the pc after the trap */\n\ -\n\ -not_breakpoint:\n\ - movew %d1,%a5@(66) /* save sr */ \n\ - movel %a4,%a5@(68) /* save pc in _regisers[] */\n\ - movel %a4,%a0@- /* copy pc to frame buffer */\n\ - movew %d1,%a0@- /* copy sr to frame buffer */\n\ -\n\ - movel %sp,superStack /* save supervisor %sp */\n\ -\n\ - andiw #0x2000,%d1 /* were we in supervisor mode ? */\n\ - beq userMode \n\ - movel %a7,%a5@(60) /* save %a7 */\n\ - bra saveDone \n\ -userMode:\n\ - movel %usp,%a1 /* save user stack pointer */\n\ - movel %a1,%a5@(60) /* save user stack pointer */\n\ -saveDone:\n\ -\n\ - movew %d3,%a0@- /* push frame size in words */\n\ - movel %d2,%a0@- /* push vector number */\n\ - movel %a4,%a0@- /* push exception pc */\n\ -\n\ -#\n\ -# save old frame link and set the new value\n\ -#\n\ - movel lastFrame,%a1 /* last frame pointer */\n\ - movel %a1,%a0@- /* save pointer to prev frame */\n\ - movel %a0,lastFrame\n\ -\n\ - movel %d2,%sp@- /* push exception num */\n\ - movel exceptionHook,%a0 /* get address of handler */\n\ -\n\ - jbsr %a0@ /* and call it */\n\ - clrl %sp@ /* replace exception num parm with frame ptr */\n\ - jbsr _returnFromException /* jbsr, but never returns */\n\ -"); -#endif - -/* - * remcomHandler is a front end for handle_exception. It moves the - * stack pointer into an area reserved for debugger use in case the - * breakpoint happened in supervisor mode. - */ -__asm__ ("remcomHandler:"); -__asm__ (" addl #4,%sp"); /* pop off return address */ -__asm__ (" movel %sp@+,%d0"); /* get the exception number */ -__asm__ (" movel stackPtr,%sp"); /* move to remcom stack area */ -__asm__ (" movel %d0,%sp@-"); /* push exception onto stack */ -__asm__ (" jbsr handle_exception"); /* this never returns */ -__asm__ (" rts"); /* return */ - -/* - * This is only called from assembly in this file. This file is a self - * contained gdb stub. - */ -void _returnFromException(Frame *frame); - -void _returnFromException(Frame *frame) -{ - /* if no passed in frame, use the last one */ - if (! frame) - { - frame = lastFrame; - frame->frameSize = 4; - frame->format = 0; - frame->fsaveHeader = -1; /* restore regs, but we dont have fsave info*/ - } - -#if defined(__mc68000__) && !(defined(__mc68020__) && !defined(__mcpu32__)) - /* a 68000 cannot use the internal info pushed onto a bus error - * or address error frame when doing an RTE so don't put this info - * onto the stack or the stack will creep every time this happens. - */ - frame->frameSize=3; -#endif - - /* throw away any frames in the list after this frame */ - lastFrame = frame; - - frame->sr = registers[(int) PS]; - frame->pc = registers[(int) PC]; - - if (registers[(int) PS] & 0x2000) - { - /* return to supervisor mode... */ - return_to_super(); - } - else - { /* return to user mode */ - return_to_user(); - } -} - -int hex(char ch) -{ - if ((ch >= 'a') && (ch <= 'f')) return (ch-'a'+10); - if ((ch >= '0') && (ch <= '9')) return (ch-'0'); - if ((ch >= 'A') && (ch <= 'F')) return (ch-'A'+10); - return (-1); -} - -/* scan for the sequence $# */ -void getpacket(char *buffer) -{ - unsigned char checksum; - unsigned char xmitcsum; - int i; - int count; - char ch; - - do { - /* wait around for the start character, ignore all other characters */ - while ((ch = (getDebugChar() & 0x7f)) != '$'); - checksum = 0; - xmitcsum = -1; - - count = 0; - - /* now, read until a # or end of buffer is found */ - while (count < (BUFMAX - 1)) { - ch = getDebugChar() & 0x7f; - if (ch == '#') break; - checksum = checksum + ch; - buffer[count] = ch; - count = count + 1; - } - buffer[count] = 0; - - if (ch == '#') { - xmitcsum = hex(getDebugChar() & 0x7f) << 4; - xmitcsum += hex(getDebugChar() & 0x7f); - if ((remote_debug ) && (checksum != xmitcsum)) { - debug_port_printf ("bad checksum. My count = 0x%x, sent=0x%x. buf=%s\n", - checksum,xmitcsum,buffer); - } - - if (checksum != xmitcsum) putDebugChar('-'); /* failed checksum */ - else { - putDebugChar('+'); /* successful transfer */ - /* if a sequence char is present, reply the sequence ID */ - if (buffer[2] == ':') { - putDebugChar( buffer[0] ); - putDebugChar( buffer[1] ); - /* remove sequence chars from buffer */ - count = strlen(buffer); - for (i=3; i <= count; i++) buffer[i-3] = buffer[i]; - } - } - } - } while (checksum != xmitcsum); -} - -/* send the packet in buffer. The host get's one chance to read it. - This routine does not wait for a positive acknowledge. */ - -void -putpacket(char *buffer) -{ - unsigned char checksum; - int count; - char ch; - - /* $#. */ - do { - putDebugChar('$'); - checksum = 0; - count = 0; - - while ((ch=buffer[count])) { - if (! putDebugChar(ch)) return; - checksum += ch; - count += 1; - } - - putDebugChar('#'); - putDebugChar(hexchars[checksum >> 4]); - putDebugChar(hexchars[checksum % 16]); - - } while (1 == 0); /* (getDebugChar() != '+'); */ - -} - -char remcomInBuffer[BUFMAX]; -char remcomOutBuffer[BUFMAX]; -static short error; - -/* convert the memory pointed to by mem into hex, placing result in buf */ -/* return a pointer to the last char put in buf (null) */ -char *mem2hex(char *mem, char *buf, int count) -{ - int i; - unsigned char ch; - - if (remote_debug) - debug_port_printf("mem=0x%x, count=0x%x\n", mem, count); - - for (i=0;i> 4]; - *buf++ = hexchars[ch % 16]; - } - *buf = 0; - return(buf); -} - -/* convert the hex array pointed to by buf into binary to be placed in mem */ -/* return a pointer to the character AFTER the last byte written */ -char *hex2mem(char *buf, char *mem, int count) -{ - int i; - unsigned char ch; - - if (remote_debug) - debug_port_printf("mem=0x%x, count=0x%x\n", mem, count); - - for (i=0;i=0) - { - *intValue = (*intValue <<4) | hexValue; - numChars ++; - } - else - break; - - (*ptr)++; - } - - return (numChars); -} - -/* - * This function does all command procesing for interfacing to gdb. - */ -void handle_exception(int exceptionVector) -{ - int sigval; - int addr, length; - char * ptr; - int newPC; - Frame *frame; - - if (remote_debug) - printf("vector=%d, sr=0x%x, pc=0x%x\n", - exceptionVector, - registers[ PS ], - registers[ PC ]); - - /* reply to host that an exception has occurred */ - sigval = computeSignal( exceptionVector ); - remcomOutBuffer[0] = 'S'; - remcomOutBuffer[1] = hexchars[sigval >> 4]; - remcomOutBuffer[2] = hexchars[sigval % 16]; - remcomOutBuffer[3] = 0; - - putpacket(remcomOutBuffer); - - while (1==1) { - error = 0; - remcomOutBuffer[0] = 0; - getpacket(remcomInBuffer); - switch (remcomInBuffer[0]) { - case '?' : remcomOutBuffer[0] = 'S'; - remcomOutBuffer[1] = hexchars[sigval >> 4]; - remcomOutBuffer[2] = hexchars[sigval % 16]; - remcomOutBuffer[3] = 0; - break; - case 'd' : - remote_debug = !(remote_debug); /* toggle debug flag */ - debug_port_printf("debug mode "); - if (remote_debug) - { - debug_port_printf("on\n"); - } - else - { - debug_port_printf("off\n"); - } - break; - case 'g' : /* return the value of the CPU registers */ - mem2hex((char*) registers, remcomOutBuffer, NUMREGBYTES); - break; - case 'G' : /* set the value of the CPU registers - return OK */ - hex2mem(&remcomInBuffer[1], (char*) registers, NUMREGBYTES); - strcpy(remcomOutBuffer,"OK"); - break; - - /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */ - case 'm' : - if (setjmp(remcomEnv) == 0) - { - exceptionHandler(2,handle_buserror); - - /* TRY TO READ %x,%x. IF SUCCEED, SET PTR = 0 */ - ptr = &remcomInBuffer[1]; - if (hexToInt(&ptr,&addr)) - if (*(ptr++) == ',') - if (hexToInt(&ptr,&length)) - { - ptr = 0; - mem2hex((char*) addr, remcomOutBuffer, length); - } - - if (ptr) - { - strcpy(remcomOutBuffer,"E01"); - if (remote_debug) - printf("malformed read memory command: %s",remcomInBuffer); - } - } - else { - exceptionHandler(2,_catchException); - strcpy(remcomOutBuffer,"E03"); - if (remote_debug) - printf("bus error"); - } - - /* restore handler for bus error */ - exceptionHandler(2,_catchException); - break; - - /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */ - case 'M' : - if (setjmp(remcomEnv) == 0) { - exceptionHandler(2,handle_buserror); - - /* TRY TO READ '%x,%x:'. IF SUCCEED, SET PTR = 0 */ - ptr = &remcomInBuffer[1]; - if (hexToInt(&ptr,&addr)) - if (*(ptr++) == ',') - if (hexToInt(&ptr,&length)) - if (*(ptr++) == ':') - { - hex2mem(ptr, (char*) addr, length); - ptr = 0; - strcpy(remcomOutBuffer,"OK"); - } - if (ptr) - { - strcpy(remcomOutBuffer,"E02"); - if (remote_debug) - printf("malformed write memory command: %s",remcomInBuffer); - } - } - else { - exceptionHandler(2,_catchException); - strcpy(remcomOutBuffer,"E03"); - if (remote_debug) - printf("bus error"); - } - - /* restore handler for bus error */ - exceptionHandler(2,_catchException); - break; - - /* cAA..AA Continue at address AA..AA(optional) */ - /* sAA..AA Step one instruction from AA..AA(optional) */ - case 'c' : - case 's' : - /* try to read optional parameter, pc unchanged if no parm */ - ptr = &remcomInBuffer[1]; - if (hexToInt(&ptr,&addr)) - registers[ PC ] = addr; - - newPC = registers[ PC]; - - /* clear the trace bit */ - registers[ PS ] &= 0x7fff; - - /* set the trace bit if we're stepping */ - if (remcomInBuffer[0] == 's') registers[ PS ] |= 0x8000; - - /* - * look for newPC in the linked list of exception frames. - * if it is found, use the old frame it. otherwise, - * fake up a dummy frame in returnFromException(). - */ - if (remote_debug) debug_port_printf("new pc = 0x%x\n",newPC); - - frame = lastFrame; - while (frame) - { - if (remote_debug) - debug_port_printf("frame at 0x%x has pc=0x%x, except#=%d\n", - frame,frame->exceptionPC, - (unsigned int) frame->exceptionVector); - if (frame->exceptionPC == newPC) break; /* bingo! a match */ - /* - * for a breakpoint instruction, the saved pc may - * be off by two due to re-executing the instruction - * replaced by the trap instruction. Check for this. - */ - if ((frame->exceptionVector == 33) && - (frame->exceptionPC == newPC)) break; - if (frame == frame->previous) - { - frame = 0; /* no match found */ - break; - } - frame = frame->previous; - } - - /* - * If we found a match for the PC AND we are not returning - * as a result of a breakpoint (33), - * trace exception (9), nmi (31), jmp to - * the old exception handler as if this code never ran. - */ - if (frame) - { - if ((frame->exceptionVector != 9) && - (frame->exceptionVector != 31) && - (frame->exceptionVector != 33)) - { - /* - * invoke the previous handler. - */ - if (oldExceptionHook) - (*oldExceptionHook) (frame->exceptionVector); - newPC = registers[ PC ]; /* pc may have changed */ - if (newPC != frame->exceptionPC) - { - if (remote_debug) - debug_port_printf("frame at 0x%x has pc=0x%x, except#=%d\n", - frame,frame->exceptionPC, - (unsigned int) frame->exceptionVector); - /* re-use the last frame, we're skipping it (longjump?)*/ - frame = (Frame *) 0; - _returnFromException( frame ); /* this is a jump */ - } - } - } - - /* if we couldn't find a frame, create one */ - if (frame == 0) - { - frame = lastFrame -1 ; - - /* by using a bunch of print commands with breakpoints, - it's possible for the frame stack to creep down. If it creeps - too far, give up and reset it to the top. Normal use should - not see this happen. - */ - if ((unsigned int) (frame-2) < (unsigned int) &gdbFrameStack) - { - initializeRemcomErrorFrame(); - frame = lastFrame; - } - frame->previous = lastFrame; - lastFrame = frame; - frame = 0; /* null so _return... will properly initialize it */ - } - - _returnFromException( frame ); /* this is a jump */ - - break; - - /* kill the program */ - case 'k' : - /* reset the board */ - WATCHDOG_TRIGGER(); - while (1 == 1); - break; - - } /* switch */ - - /* reply to the request */ - putpacket(remcomOutBuffer); - } -} - -void initializeRemcomErrorFrame() -{ - lastFrame = ((Frame *) &gdbFrameStack[FRAMESIZE-1]) - 1; - lastFrame->previous = lastFrame; -} - -extern void _debug_level7(void); -extern void remcomHandler(void); - -/* this function is used to set up exception handlers for tracing and - breakpoints */ -void set_debug_traps() -{ - int exception; - - initializeRemcomErrorFrame(); - stackPtr = &remcomStack[STACKSIZE/sizeof(int) - 1]; - - registers[ PC ] = 0x400; - registers[ PS ] = 0x2700; - - for (exception = 2; exception <= 30; exception++) - exceptionHandler(exception,_catchException); - - /* level 7 interrupt */ - exceptionHandler(31,_debug_level7); - - for (exception = 32; exception <= 47; exception++) - exceptionHandler(exception,_catchException); - - /* exclude the unassigned, reserved vector locations */ - - for (exception = 64; exception <= 255; exception++) - exceptionHandler(exception,_catchException); - - if (oldExceptionHook != (ExceptionHook) remcomHandler) - { - oldExceptionHook = exceptionHook; - exceptionHook = (ExceptionHook) remcomHandler; - } - - initialized = true; - -#if defined(UPDATE_DISPLAY) - UPDATE_DISPLAY("gdb "); -#endif -} - -/* This function will generate a breakpoint exception. It is used at the - beginning of a program to sync up with a debugger and can be used - otherwise as a quick means to stop program execution and "break" into - the debugger. */ - -void breakpoint() -{ - if (initialized) BREAKPOINT(); -} diff --git a/c/src/lib/libbsp/m68k/ods68302/startup/rom b/c/src/lib/libbsp/m68k/ods68302/startup/rom deleted file mode 100644 index 4b0e81050f..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/startup/rom +++ /dev/null @@ -1,77 +0,0 @@ -/* - * MC68302 Linker command file - */ - -SECTIONS -{ - .text . : - { - text_start = .; - *(.text) - etext = .; - . = ALIGN(4); - __CTOR_LIST__ = .; - LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) - *(.ctors) - LONG(0) - __CTOR_END__ = .; - . = ALIGN(4); - __DTOR_LIST__ = .; - LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) - *(.dtors) - LONG(0) - __DTOR_END__ = .; - } - - .tdata : { - _TLS_Data_begin = .; - *(.tdata .tdata.* .gnu.linkonce.td.*) - _TLS_Data_end = .; - } - .tbss : { - _TLS_BSS_begin = .; - *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) - _TLS_BSS_end = .; - } - _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin; - _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin; - _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin; - _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin; - _TLS_Size = _TLS_BSS_end - _TLS_Data_begin; - _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss)); - - .vtable 0 : - { - vtable_start = .; - *(.vtable) - evtable = .; - } - - .data (ADDR(.vtable) + SIZEOF(.vtable)) : - AT (ADDR(.text) + SIZEOF(.text)) - { - data_start = .; - *(.data) - KEEP (*(SORT(.rtemsroset.*))) - KEEP (*(SORT(.rtemsrwset.*))) - edata = .; - } - .bss (ADDR(.data) + SIZEOF(.data)) : - { - bss_start = .; - *(.bss) - *(COMMON) - end = . ; - _end = . ; - } -} - -RAM_BASE = DEFINED(RAM_BASE) ? RAM_BASE : 0x00000000; -RAM_SIZE = DEFINED(RAM_SIZE) ? RAM_SIZE : 0x00100000; -ROM_BASE = DEFINED(ROM_BASE) ? ROM_BASE : 0x00C00000; -ROM_SIZE = DEFINED(ROM_SIZE) ? ROM_SIZE : 0x00100000; -MC68302_BASE = DEFINED(MC68302_BASE) ? MC68302_BASE : 0x00700000; -m302 = MC68302_BASE; -_VBR = 0; /* location of the VBR table (in RAM) */ - - diff --git a/c/src/lib/libbsp/m68k/ods68302/startup/trace.c b/c/src/lib/libbsp/m68k/ods68302/startup/trace.c deleted file mode 100644 index efe8abf3dd..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/startup/trace.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Trace Exception dumps a back trace to the debug serial port - * - */ - -#include -#include - -#if 0 -/* FIXME : could get the string to print when in the BSP */ -static const char *exception_names[] = -{ - "RESET STACK TOP", - "RESET", - "BUS ERROR", - "ADDRESS ERROR", - "ILLEGAL OPCODE", - "ZERO DIVIDE", - "CHK", - "OVERFLOW", - "PRIVILEGE", - "TRACE", - "LINE 1010 EMULATOR", - "LINE 1111 EMULATOR", - "UNASSIGNED 12", - "UNASSIGNED 13", - "FORMAT ERROR", - "UNINITIALISED INTERRUPT", - "UNASSIGNED 16", - "NODE ANCHOR", - "SYSTEM ANCHOR", - "UNASSIGNED 19", - "UNASSIGNED 20", - "UNASSIGNED 21", - "UNASSIGNED 22", - "UNASSIGNED 23", - "SPURIOUS HANDLER", - "LEVEL 1", - "LEVEL 2", - "LEVEL 3", - "LEVEL 4", - "LEVEL 5", - "LEVEL 6", - "LEVEL 7", - "TRAP 0", - "TRAP 1", - "TRAP 2", - "TRAP 3", - "TRAP 4", - "TRAP 5", - "TRAP 6", - "TRAP 7", - "TRAP 8", - "TRAP 9", - "TRAP 10", - "TRAP 11", - "TRAP 12", - "TRAP 13", - "TRAP 14", - "TRAP 15" -}; -#endif - -void trace_exception(unsigned long d0, - unsigned long d1, - unsigned long d2, - unsigned long d3, - unsigned long d4, - unsigned long d5, - unsigned long d6, - unsigned long d7, - unsigned long a0, - unsigned long a1, - unsigned long a2, - unsigned long a3, - unsigned long a4, - unsigned long a5, - unsigned long a6, - unsigned long a7, - unsigned long sr_pch, - unsigned long pcl_format) -{ - unsigned int sr = sr_pch >> 16; - unsigned long pc = (sr_pch << 16) | (pcl_format >> 16); - unsigned int format = pcl_format & 0xFFFF; - unsigned int index; - unsigned char ch; - - __asm__ volatile(" orw #0x0700,%sr"); - - debug_port_banner(); - - debug_port_write("unhandled exception="); - debug_port_write_hex_uint(format >> 2); - debug_port_write("\n"); - - debug_port_write("sr="); - debug_port_write_hex_uint(sr); - debug_port_write(", pc="); - debug_port_write_hex_ulong(pc); - debug_port_write("\n"); - - for (index = 0; index < 16; index++) - { - if (index == 8) - { - debug_port_write("\n\r"); - } - if (index < 8) - { - debug_port_out('d'); - debug_port_out('0' + index); - } - else - { - debug_port_out('a'); - debug_port_out('0' + index - 8); - } - debug_port_out('='); - debug_port_write_hex_ulong(*(((unsigned long*) &d0) + index)); - debug_port_out(' '); - } - - for (index = 0; index < (16 * 10); index++) - { - if ((index % 16) == 0) - { - debug_port_write("\n"); - debug_port_write_hex_ulong((unsigned long) (((char*) &index) + index)); - debug_port_write(" : "); - } - else - { - debug_port_out(' '); - } - - ch = (*(((char*) &index) + index) >> 4) & 0x0F; - - if (ch < 10) - { - ch += '0'; - } - else - { - ch += 'a' - 10; - } - - debug_port_out((char) ch); - - ch = *(((char*) &index) + index) & 0x0F; - - if (ch < 10) - { - ch += '0'; - } - else - { - ch += 'a' - 10; - } - debug_port_out((char) ch); - } - - debug_port_write("\nhalting cpu..."); - -#if defined(UPDATE_DISPLAY) - UPDATE_DISPLAY("HALT"); -#endif - - WATCHDOG_TRIGGER(); - while (1 == 1); -} diff --git a/c/src/lib/libbsp/m68k/ods68302/timer/timer.c b/c/src/lib/libbsp/m68k/ods68302/timer/timer.c deleted file mode 100644 index 1e03015127..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/timer/timer.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * - * This routine initializes TIMER 2 for an MC68302. - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#include -#include -#include -#include - -#define TMR2_VAL 0x071b /* Timer mode register - * (section 3.5.2.1 in 68302 manual) - * 15-8: "7" prescaler divide by 8 (x+1) - * 7-6: 00 dis. intr. on capture event - * 5: 0 active-low pulse - * 4: 1 intr. on reaching reference - * 3: 1 restart counter on reference - * 2-1: 01 master clock input source - * 0: 1 enable timer - */ -#define TRR2_VAL 2000 /* Timer reference register - * (section 3.5.2.2 in 68302 manual) - * 2000 ticks @ (16MHz/1)/8 = 1-ms count - */ - -uint32_t Timer_interrupts; - -bool benchmark_timer_find_average_overhead; - -rtems_isr timerisr(void); - -void benchmark_timer_initialize( void ) -{ - m302.reg.tmr2 = 0; /* disable timer */ - - Timer_interrupts = 0; /* clear timer ISR count */ - - m302.reg.trr2 = TRR2_VAL; /* set timer reference register */ - m302.reg.tmr2 = TMR2_VAL; /* set timer mode register */ - m302.reg.imr |= RBIT_IMR_TIMER2; /* set 68302 int-mask to allow ints */ -} - -/* - * The following controls the behavior of benchmark_timer_read(). - * - * FIND_AVG_OVERHEAD * instructs the routine to return the "raw" count. - * - * AVG_OVEREHAD is the overhead for starting and stopping the timer. It - * is usually deducted from the number returned. - * - * LEAST_VALID is the lowest number this routine should trust. Numbers - * below this are "noise" and zero is returned. - */ - -#define AVG_OVERHEAD 0 /* It typically takes X.X microseconds */ - /* (Y countdowns) to start/stop the timer. */ - /* This value is in microseconds. */ -#define LEAST_VALID 1 /* Don't trust a clicks value lower than this */ - -/* - * Return timer value in 1/2-microsecond units - */ -benchmark_timer_t benchmark_timer_read( void ) -{ - uint16_t clicks; - uint32_t total; - - /* - * Read the timer and see how many clicks it has been since counter - * rolled over. - */ - - clicks = m302.reg.tcn2; - - /* - * Total is calculated by taking into account the number of timer overflow - * interrupts since the timer was initialized and clicks since the last - * interrupts. - */ - - total = (Timer_interrupts * TRR2_VAL) + clicks; - - if ( benchmark_timer_find_average_overhead == true ) - return total; /* in XXX microsecond units */ - - if ( total < LEAST_VALID ) - return 0; /* below timer resolution */ - - /* - * Convert 1/2-microsecond count into microseconds - */ - - return (total - AVG_OVERHEAD) >> 1; -} - -void benchmark_timer_disable_subtracting_average_overhead( - bool find_flag -) -{ - benchmark_timer_find_average_overhead = find_flag; -} diff --git a/c/src/lib/libbsp/m68k/ods68302/timer/timerisr.S b/c/src/lib/libbsp/m68k/ods68302/timer/timerisr.S deleted file mode 100644 index 1fe3931310..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/timer/timerisr.S +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Handle 68302 TIMER2 interrupts. - * - * All code in this routine is pure overhead which can perturb the - * accuracy of RTEMS' timing test suite. - * - * See also: benchmark_timer_read() - * - * To reduce overhead this is best to be the "rawest" hardware interupt - * handler you can write. This should be the only interrupt which can - * occur during the measured time period. - * - * An external counter, Timer_interrupts, is incremented. - */ - -#include - -BEGIN_CODE - PUBLIC(timerisr) -SYM(timerisr): - move.w #0x0040,SYM(m302)+2072 | clear interrupt in-service bit - move.b #3,SYM(m302)+2137 | clear timer interrupt event register - addq.l #1,SYM(Timer_interrupts) | increment timer value - rte -END_CODE -END -- cgit v1.2.3