Added i960sim BSP which (ignoring the 3 instructions not supported

by gdb 5.0's i960 simulator) is enough to run hello world.
This commit is contained in:
Joel Sherrill
2000-06-12 16:34:46 +00:00
parent edeed26a86
commit 68c498f477
19 changed files with 708 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
##
## $Id$
##
AUTOMAKE_OPTIONS = foreign 1.4
ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal
# wrapup is the one that actually builds and installs the library
# from the individual .rel files built in other directories
SUBDIRS = include start startup clock console timer wrapup
include $(top_srcdir)/../../bsp.am
EXTRA_DIST = bsp_specs times
include $(top_srcdir)/../../../../../../automake/subdirs.am
include $(top_srcdir)/../../../../../../automake/local.am

View File

@@ -0,0 +1,23 @@
%rename cpp old_cpp
%rename lib old_lib
%rename endfile old_endfile
%rename startfile old_startfile
%rename link old_link
*cpp:
%(old_cpp) %{qrtems: -D__embedded__} -Asystem(embedded)
*lib:
%{!qrtems: %(old_lib)} %{qrtems: --start-group \
%{!qrtems_debug: -lrtemsall} %{qrtems_debug: -lrtemsall_g} \
-lc -lgcc --end-group \
%{!qnolinkcmds: -T linkcmds%s}}
*startfile:
%{!qrtems: %(old_startfile)} %{qrtems: \
%{!qrtems_debug: start.o%s} \
%{qrtems_debug: start_g.o%s}}
*link:
%(old_link) %{!qrtems: %(old_link)} %{qrtems: -dc -dp -N -e _start}

View File

@@ -0,0 +1,34 @@
dnl Process this file with autoconf to produce a configure script.
dnl
dnl $Id$
AC_PREREQ(2.13)
AC_INIT(bsp_specs)
RTEMS_TOP(../../../../../..)
AC_CONFIG_AUX_DIR(../../../../../..)
RTEMS_CANONICAL_TARGET_CPU
AM_INIT_AUTOMAKE(rtems-c-src-lib-libbsp-i960-cvme961,$RTEMS_VERSION,no)
AM_MAINTAINER_MODE
RTEMS_PROG_CC_FOR_TARGET
RTEMS_CANONICALIZE_TOOLS
RTEMS_ENABLE_MULTIPROCESSING
RTEMS_ENV_RTEMSBSP
RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
RTEMS_CHECK_BSP_CACHE(RTEMS_BSP)
RTEMS_CANONICAL_HOST
RTEMS_PROJECT_ROOT
# Explicitly list all Makefiles here
AC_OUTPUT(
Makefile
clock/Makefile
console/Makefile
include/Makefile
start/Makefile
startup/Makefile
timer/Makefile
wrapup/Makefile)

View File

@@ -0,0 +1,2 @@
Makefile
Makefile.in

View File

@@ -0,0 +1,35 @@
##
## $Id$
##
AUTOMAKE_OPTIONS = foreign 1.4
PGM = $(ARCH)/console.rel
C_FILES = console-io.c console-polled.c
C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o)
S_FILES = mon-syscalls.S
S_O_FILES = $(S_FILES:%.S=$(ARCH)/%.o)
OBJS = $(C_O_FILES) $(S_O_FILES)
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../../../../../../automake/lib.am
#
# (OPTIONAL) Add local stuff here using +=
#
$(PGM): $(OBJS)
$(make-rel)
# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
all-local: $(ARCH) $(OBJS) $(PGM)
.PRECIOUS: $(PGM)
EXTRA_DIST = console.c
include $(top_srcdir)/../../../../../../automake/local.am

View File

@@ -0,0 +1,62 @@
/*
* This file contains the hardware specific portions of the TTY driver
* for the serial ports on the erc32.
*
* COPYRIGHT (c) 1989-1997.
* On-Line Applications Research Corporation (OAR).
* Copyright assigned to U.S. Government, 1994.
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#include <bsp.h>
#include <rtems/libio.h>
#include <stdlib.h>
#include <assert.h>
/* external prototypes for monitor interface routines */
void outbyte( char );
char inbyte( void );
/*
* console_outbyte_polled
*
* This routine transmits a character using polling.
*/
void console_outbyte_polled(
int port,
char ch
)
{
int status;
int nwritten;
status = _sys_write (1, &ch, 1, &nwritten);
}
/*
* console_inbyte_nonblocking
*
* This routine polls for a character.
*/
int console_inbyte_nonblocking(
int port
)
{
int status;
int nread;
char c;
status = _sys_read (0, &c, 1, &nread);
if ( status == 0 )
return c;
return -1;
}

View File

@@ -0,0 +1,43 @@
#ifdef __STDC__
# define _C_LABEL(x) _ ## x
#else
# define _C_LABEL(x) _/**/x
#endif
#define _ASM_LABEL(x) x
#define _ENTRY(name) \
.text; .align 4; .globl name; name:
#define ENTRY(name) \
_ENTRY(_C_LABEL(name))
ENTRY(_sys_exit)
lda 257,g13
calls g13
ENTRY(_sys_open)
lda 230,g13
calls g13
ret
ENTRY(_sys_read)
lda 231,g13
calls g13
ret
ENTRY(_sys_write)
lda 232,g13
calls g13
ret
ENTRY(_sys_lseek)
lda 233,g13
calls g13
ret
ENTRY(_sys_close)
lda 234,g13
calls g13
ret

View File

@@ -0,0 +1,2 @@
Makefile
Makefile.in

View File

@@ -0,0 +1,25 @@
##
## $Id$
##
AUTOMAKE_OPTIONS = foreign 1.4
H_FILES = bsp.h ../../../shared/include/coverhd.h
$(PROJECT_INCLUDE):
$(mkinstalldirs) $@
$(PROJECT_INCLUDE)/bsp.h: bsp.h
$(INSTALL_DATA) $< $@
$(PROJECT_INCLUDE)/coverhd.h: ../../../shared/include/coverhd.h
$(INSTALL_DATA) $< $@
TMPINSTALL_FILES += $(PROJECT_INCLUDE) $(PROJECT_INCLUDE)/bsp.h \
$(PROJECT_INCLUDE)/coverhd.h
all-local: $(TMPINSTALL_FILES)
EXTRA_DIST = bsp.h
include $(top_srcdir)/../../../../../../automake/local.am

View File

@@ -0,0 +1,102 @@
/* bsp.h
*
* This include file contains some definitions specific to the
* i960 simulator in gdb.
*
* 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.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#ifndef __CVME961_h
#define __CVME961_h
#ifdef __cplusplus
extern "C" {
#endif
#include <rtems.h>
#include <iosupp.h>
#include <console.h>
#include <clockdrv.h>
/*
* Define the time limits for RTEMS Test Suite test durations.
* Long test and short test duration limits are provided. These
* values are in seconds and need to be converted to ticks for the
* application.
*
*/
#define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */
#define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */
/*
* Define the interrupt mechanism for Time Test 27
*
* NOTE: Following are for i960CA and are board independent
*
*/
#define MUST_WAIT_FOR_INTERRUPT 0
#define Install_tm27_vector( handler ) set_vector( (handler), 6, 1 )
#define Cause_tm27_intr() i960_cause_intr( 0x62 )
#define Clear_tm27_intr() i960_clear_intr( 6 )
#define Lower_tm27_intr()
/*
* Simple spin delay in microsecond units for device drivers.
* This is very dependent on the clock speed of the target.
*/
#define delay( microseconds ) \
{ register rtems_unsigned32 _delay=(microseconds); \
register rtems_unsigned32 _tmp = 0; /* initialized to avoid warning */ \
asm volatile( "0: \
remo 3,31,%0 ; \
cmpo 0,%0 ; \
subo 1,%1,%1 ; \
cmpobne.t 0,%1,0b " \
: "=d" (_tmp), "=d" (_delay) \
: "0" (_tmp), "1" (_delay) ); \
}
/* Constants */
/* miscellaneous stuff assumed to exist */
extern rtems_configuration_table BSP_Configuration;
/*
* Device Driver Table Entries
*/
/*
* NOTE: Use the standard Console driver entry
*/
/*
* NOTE: Use the standard Clock driver entry
*/
/* functions */
void bsp_cleanup( void );
i960_isr_entry set_vector( rtems_isr_entry, unsigned int, unsigned int );
#ifdef __cplusplus
}
#endif
#endif
/* end of include file */

View File

@@ -0,0 +1,2 @@
Makefile
Makefile.in

View File

@@ -0,0 +1,32 @@
##
## $Id$
##
AUTOMAKE_OPTIONS = foreign 1.4
PGM = $(ARCH)/start.o
C_FILES = start.c
C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o)
OBJS = $(C_O_FILES)
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../../../../../../automake/lib.am
#
# (OPTIONAL) Add local stuff here using +=
#
$(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).o: $(PGM)
$(INSTALL_DATA) $< $@
TMPINSTALL_FILES += $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).o
all-local: $(ARCH) $(OBJS) $(PGM) $(TMPINSTALL_FILES)
.PRECIOUS: $(PGM)
EXTRA_DIST = start.S
include $(top_srcdir)/../../../../../../automake/local.am

View File

@@ -0,0 +1,39 @@
char *__env[1] = {0};
char **environ = __env;
#define ENABLE_TRACE_MASK 1
#define STACK_ALIGN 64
__inline static void
init_Cregs (void)
{
/* set register values gcc like */
register unsigned int mask0=0x3b001000;
register unsigned int mask1=0x00009107;
__asm__ volatile ("mov %0,g14"
: /* no output */
: "I" (0)); /* gnu structure pointer */
__asm__ volatile ("modac %1,%0,%0"
: /* no output */
: "d" (mask0),
"d" (mask1)); /* fpu control kb */
}
void _start(void)
{
extern int stack_init;
register void *ptr = &stack_init;
/* enable tracing */
register int mask = ENABLE_TRACE_MASK;
__asm__ volatile ("modpc %0,%0,%0" : : "d" (mask));
/* SP must be 64 bytes larger than FP at start. */
__asm__ volatile ("mov %0,sp" : : "d" (ptr + STACK_ALIGN));
__asm__ volatile ("mov %0,fp" : : "d" (ptr));
init_Cregs();
boot_card();
_sys_exit(0);
}

View File

@@ -0,0 +1,39 @@
##
## $Id$
##
AUTOMAKE_OPTIONS = foreign 1.4
VPATH = @srcdir@:@srcdir@/../../../shared
PGM = $(ARCH)/startup.rel
C_FILES = bspclean.c bsplibc.c bsppost.c bspstart.c bootcard.c main.c sbrk.c \
gnatinstallhandler.c
C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o)
OBJS = $(C_O_FILES)
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../../../../../../automake/lib.am
#
# (OPTIONAL) Add local stuff here using +=
#
$(PGM): $(OBJS)
$(make-rel)
$(PROJECT_RELEASE)/lib/linkcmds: linkcmds
$(INSTALL_DATA) $< $@
# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
TMPINSTALL_FILES += $(PROJECT_RELEASE)/lib/linkcmds
all-local: $(ARCH) $(OBJS) $(PGM) $(TMPINSTALL_FILES)
.PRECIOUS: $(PGM)
EXTRA_DIST = bspclean.c bspstart.c exit.c linkcmds setvec.c
include $(top_srcdir)/../../../../../../automake/local.am

View File

@@ -0,0 +1,95 @@
/*
* This routine starts the application. It includes application,
* board, and monitor specific initialization and configuration.
* The generic CPU dependent initialization has been performed
* before this routine is invoked.
*
* 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.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#include <bsp.h>
#include <rtems/libio.h>
#include <libcsupport.h>
#include <string.h>
/*
* The original table from the application and our copy of it with
* some changes.
*/
extern rtems_configuration_table Configuration;
rtems_configuration_table BSP_Configuration;
rtems_cpu_table Cpu_table;
char *rtems_progname;
/*
* Use the shared implementations of the following routines
*/
void bsp_postdriver_hook(void);
void bsp_libc_init( void *, unsigned32, int );
/*
* Function: bsp_pretasking_hook
* Created: 95/03/10
*
* Description:
* BSP pretasking hook. Called just before drivers are initialized.
* Used to setup libc and install any BSP extensions.
*
* NOTES:
* Must not use libc (to do io) from here, since drivers are
* not yet initialized.
*
*/
void bsp_pretasking_hook(void)
{
extern int HeapBase;
extern int HeapSize;
void *heapStart = &HeapBase;
unsigned long heapSize = (unsigned long)&HeapSize;
unsigned long ramSpace;
bsp_libc_init(heapStart, heapSize, 0);
#ifdef RTEMS_DEBUG
rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
#endif
}
/*
* bsp_start
*
* This routine does the bulk of the system initialization.
*/
void bsp_start( void )
{
extern int _end;
extern int WorkspaceBase;
/* Configure Number of Register Caches */
Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */
Cpu_table.postdriver_hook = bsp_postdriver_hook;
Cpu_table.interrupt_stack_size = 4096;
Cpu_table.Prcb = 0; /* Prcb; */
if ( BSP_Configuration.work_space_size >(512*1024) )
_sys_exit( 1 );
BSP_Configuration.work_space_start = (void *) &WorkspaceBase;
}

View File

@@ -0,0 +1,55 @@
/*
* $Id$
*/
/*
* Declare some sizes.
*/
_RamBase = DEFINED(_RamBase) ? _RamBase : 0x0;
_RamSize = DEFINED(_RamSize) ? _RamSize : 1M;
_HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x10000;
_StackSize = DEFINED(_StackSize) ? _StackSize : 0x1000;
SECTIONS
{
. = 0xa0008000;
.text :
{
CREATE_OBJECT_SYMBOLS
*(.text)
_etext = .;
___CTOR_LIST__ = .;
LONG((___CTOR_END__ - ___CTOR_LIST__) / 4 - 2)
*(.ctors)
LONG(0)
___CTOR_END__ = .;
___DTOR_LIST__ = .;
LONG((___DTOR_END__ - ___DTOR_LIST__) / 4 - 2)
*(.dtors)
LONG(0)
___DTOR_END__ = .;
}
.data SIZEOF(.text) + ADDR(.text):
{
*(.data)
CONSTRUCTORS
_edata = .;
}
.bss SIZEOF(.data) + ADDR(.data):
{
_bss_start = .;
*(.bss)
*(COMMON)
. = ALIGN (64);
_stack_init = .;
. += _StackSize;
_clear_end = .;
_WorkspaceBase = .;
. += 512K; /* reserve some memory for workspace */
_HeapBase = .;
. += _HeapSize; /* reserve some memory for heap */
_end = .;
__end = .;
}
}

View File

@@ -0,0 +1,2 @@
Makefile
Makefile.in

View File

@@ -0,0 +1,32 @@
##
## $Id$
##
AUTOMAKE_OPTIONS = foreign 1.4
BSP_FILES = startup console
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../../../../../../automake/lib.am
# bummer; have to use $foreach since % pattern subst rules only replace 1x
OBJS = $(foreach piece, $(BSP_FILES), $(wildcard ../$(piece)/$(ARCH)/*.o)) \
$(foreach piece, $(GENERIC_FILES), ../../../$(piece)/$(ARCH)/$(piece).rel)
LIB = $(ARCH)/libbsp.a
#
# (OPTIONAL) Add local stuff here using +=
#
$(LIB): ${OBJS}
$(make-library)
$(PROJECT_RELEASE)/lib/libbsp$(LIB_VARIANT).a: $(LIB)
$(INSTALL_DATA) $< $@
TMPINSTALL_FILES += $(PROJECT_RELEASE)/lib/libbsp$(LIB_VARIANT).a
all-local: ${ARCH} $(TMPINSTALL_FILES)
include $(top_srcdir)/../../../../../../automake/local.am

67
make/custom/i960sim.cfg Normal file
View File

@@ -0,0 +1,67 @@
#
# Config file for the i960 simulator in gdb
#
# $Id$
#
include $(RTEMS_ROOT)/make/custom/default.cfg
RTEMS_CPU=i960
RTEMS_CPU_MODEL=i960gdbsim
# This is the actual bsp directory used during the build process.
RTEMS_BSP_FAMILY=i960sim
# This contains the compiler options necessary to select the CPU model
# and (hopefully) optimize for it.
#
CPU_CFLAGS=-mka -g
# optimize flag: typically -0, could use -O4 or -fast
# -O4 is ok for RTEMS
# CFLAGS_OPTIMIZE_V=-O4 -mleaf-procedures
CFLAGS_OPTIMIZE_V=-O0 -g
# This section makes the target dependent options file.
# NDEBUG (C library)
# if defined asserts do not generate code. This is commonly used
# as a command line option.
#
# RTEMS_TEST_NO_PAUSE (RTEMS tests)
# do not pause between screens of output in the rtems tests
#
# RTEMS_DEBUG (RTEMS)
# If defined, debug checks in RTEMS and support library code are enabled.
define make-target-options
@echo "/* #define NDEBUG 1 */ " >>$@
@echo "#define RTEMS_TEST_NO_PAUSE 1" >>$@
@echo "/* #define RTEMS_DEBUG 1 */" >>$@
endef
# The following are definitions of make-exe which will work using ld as
# is currently required. It is expected that as of gcc 2.8, the end user
# will be able to override parts of the compilers specs and link using gcc.
ifeq ($(RTEMS_USE_GCC272),yes)
define make-exe
$(LD) -u _sbrk $(LDFLAGS) -N -T $(LINKCMDS) -o $(basename $@).exe \
$(START_FILE) $(LINK_OBJS) --start-group $(LINK_LIBS) --end-group
$(NM) -g -n $(basename $@).exe > $(basename $@).num
$(SIZE) $(basename $@).exe
endef
else
define make-exe
$(LINK.c) $(AM_CFLAGS) $(AM_LDFLAGS) \
$(LDLIBS) -o $@ \
$(LINK_OBJS) $(LINK_LIBS)
$(NM) -g -n $@ > $(basename $@).num
$(SIZE) $@
endef
endif
# Miscellaneous additions go here