2009-09-24 Joel Sherrill <joel.sherrill@oarcorp.com>

* .cvsignore, ChangeLog, Makefile.am, README, bsp_specs, configure.ac,
	preinstall.am, console/console-io.c, include/.cvsignore,
	include/bsp.h, start/start.S, startup/bsppanic.c, startup/cmain.c,
	startup/linkcmds: New files.
This commit is contained in:
Joel Sherrill
2009-09-24 16:08:14 +00:00
parent b981f5f0a2
commit 9fd02e20aa
14 changed files with 594 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
aclocal.m4
autom4te*.cache
config.cache
config.log
config.status
configure
Makefile
Makefile.in

View File

@@ -0,0 +1,7 @@
2009-09-24 Joel Sherrill <joel.sherrill@oarcorp.com>
* .cvsignore, ChangeLog, Makefile.am, README, bsp_specs, configure.ac,
preinstall.am, console/console-io.c, include/.cvsignore,
include/bsp.h, start/start.S, startup/bsppanic.c, startup/cmain.c,
startup/linkcmds: New files.

View File

@@ -0,0 +1,63 @@
##
## $Id$
##
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
include_bsp_HEADERS = irq/irq.h
nodist_include_HEADERS = include/bspopts.h
nodist_include_bsp_HEADERS = ../../shared/include/bootcard.h
DISTCLEANFILES = include/bspopts.h
noinst_PROGRAMS =
nodist_include_HEADERS += ../../shared/include/coverhd.h
noinst_LIBRARIES = libbspstart.a
libbspstart_a_SOURCES = start/start.S
project_lib_DATA = start.$(OBJEXT)
libbspstart_a_SOURCES += ../../powerpc/shared/start/rtems_crti.S
project_lib_DATA += rtems_crti.$(OBJEXT)
dist_project_lib_DATA += startup/linkcmds
startup_SOURCES = ../../shared/bspclean.c ../../shared/bsplibc.c \
../../shared/bsppredriverhook.c ../../shared/bsppretaskinghook.c \
../../shared/bspgetworkarea.c ../../shared/bsppost.c \
../../shared/bspstart.c ../../shared/bootcard.c ../../shared/sbrk.c \
../../shared/gnatinstallhandler.c \
startup/cmain.c startup/bsppanic.c
clock_SOURCES = ../../shared/clock_driver_simidle.c
console_SOURCES = ../../shared/console-polled.c console/console-io.c
timer_SOURCES = ../../shared/timerstub.c
noinst_LIBRARIES += libbsp.a
libbsp_a_SOURCES = $(startup_SOURCES) $(clock_SOURCES) $(console_SOURCES) \
$(timer_SOURCES)
# ../../../libcpu/@RTEMS_CPU@/mpc6xx/clock.rel
libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/shared/cpuIdent.rel \
../../../libcpu/@RTEMS_CPU@/shared/stack.rel \
../../../libcpu/@RTEMS_CPU@/@exceptions@/rtems-cpu.rel \
../../../libcpu/@RTEMS_CPU@/@exceptions@/raw_exception.rel \
../../../libcpu/@RTEMS_CPU@/@exceptions@/exc_bspsupport.rel \
../../../libcpu/@RTEMS_CPU@/@exceptions@/irq_bspsupport.rel \
../../../libcpu/@RTEMS_CPU@/mpc6xx/mmu.rel \
../../../libcpu/@RTEMS_CPU@/mpc6xx/timer.rel
EXTRA_DIST = times
include $(srcdir)/preinstall.am
include $(top_srcdir)/../../../../automake/local.am

View File

@@ -0,0 +1,32 @@
#
# $Id$
#
This BSP is designed to operate on the PPC simulator provided by qemu.
We are using the Courverture Project's qemu source tree.
Couverture Project to add tracing/coverage to qemu
http://libre.adacore.com/libre/tools/coverage/
Their source repository
http://forge.open-do.org/scm/?group_id=8
That has instructions on checking it out.
If you check it out into ${BASE} directory, then the
directory with their modified qemu is:
${BASE}/couverture/trunk/couverture/tools/qemu-r6588
My BASE is /home/joel/qemu-coverage. I configured like this
from within the qemu source tree.
./configure --prefix=/home/joel/qemu-coverage/install
make
make install
This gives all simulated targets supported.
See the Makefile for more details.

View File

@@ -0,0 +1,14 @@
%rename endfile old_endfile
%rename startfile old_startfile
%rename link old_link
*startfile:
%{!qrtems: %(old_startfile)} \
%{!nostdlib: %{qrtems: ecrti%O%s rtems_crti%O%s crtbegin.o%s \
start.o%s -e _start -u __vectors}}
*link:
%{!qrtems: %(old_link)} %{qrtems: -dp -Bstatic}
*endfile:
%{!qrtems: %(old_endfile)} %{qrtems: crtend.o%s ecrtn.o%s}

View File

@@ -0,0 +1,26 @@
## Process this file with autoconf to produce a configure script.
##
## $Id$
AC_PREREQ(2.60)
AC_INIT([rtems-c-src-lib-libbsp-h8300-h8sim],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla])
AC_CONFIG_SRCDIR([bsp_specs])
RTEMS_TOP(../../../../../..)
RTEMS_CANONICAL_TARGET_CPU
AM_INIT_AUTOMAKE([no-define nostdinc foreign 1.10])
RTEMS_BSP_CONFIGURE
RTEMS_PROG_CC_FOR_TARGET([-ansi -fasm])
RTEMS_CANONICALIZE_TOOLS
RTEMS_PROG_CCAS
RTEMS_BSP_CLEANUP_OPTIONS(0, 0)
# Explicitly list all Makefiles here
AC_CONFIG_FILES([Makefile])
RTEMS_PPC_EXCEPTIONS
AC_OUTPUT

View File

@@ -0,0 +1,76 @@
/*
* This file contains the hardware specific portions of the TTY driver
* for the serial ports on the erc32.
*
* COPYRIGHT (c) 1989-2008.
* 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.com/license/LICENSE.
*
* $Id$
*/
#include <bsp.h>
#include <rtems/libio.h>
#include <stdlib.h>
#include <assert.h>
static void
__outb(int port, unsigned char v)
{
*((volatile unsigned char *)(0x80000000 + port)) = v;
}
static unsigned char
__inb(int port)
{
return *((volatile unsigned char *)(0x80000000 + port));
}
/*
* console_initialize_hardware
*
* This routine initializes the console hardware.
*
*/
void console_initialize_hardware(void)
{
return;
}
/*
* console_outbyte_polled
*
* This routine transmits a character using polling.
*/
void console_outbyte_polled(
int port,
char ch
)
{
__outb(0x3f8 + 0x00, ch);
}
/*
* console_inbyte_nonblocking
*
* This routine polls for a character.
*/
int console_inbyte_nonblocking(
int port
)
{
if ( __inb(0x3f8 + 0x05) & 0x01 )
return __inb(0x3f8 + 0x00);
return -1;
}
#include <rtems/bspIo.h>
void simBSP_output_char(char c) { console_outbyte_polled( 0, c ); }
BSP_output_char_function_type BSP_output_char = simBSP_output_char;
BSP_polling_getchar_function_type BSP_poll_char = NULL;

View File

@@ -0,0 +1,5 @@
bspopts.h
bspopts.h.in
coverhd.h
stamp-h
stamp-h.in

View File

@@ -0,0 +1,37 @@
/*
* This include file contains some definitions specific to the
* qemu powerpc Prep simulator
*
* COPYRIGHT (c) 1989-2009.
* 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.com/license/LICENSE.
*
* $Id$
*/
#ifndef _BSP_H
#define _BSP_H
#ifdef __cplusplus
extern "C" {
#endif
#include <bspopts.h>
#include <rtems.h>
#include <rtems/iosupp.h>
#include <rtems/console.h>
#include <rtems/clockdrv.h>
/* support for simulated clock tick */
Thread clock_driver_sim_idle_body(uintptr_t);
#define BSP_IDLE_TASK_BODY clock_driver_sim_idle_body
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,75 @@
## 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-local: $(TMPINSTALL_FILES)
TMPINSTALL_FILES =
CLEANFILES = $(TMPINSTALL_FILES)
all-am: $(PREINSTALL_FILES)
PREINSTALL_FILES =
CLEANFILES += $(PREINSTALL_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)/bsp/irq.h: irq/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq.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)/coverhd.h: ../../shared/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)/rtems_crti.$(OBJEXT): rtems_crti.$(OBJEXT) $(PROJECT_LIB)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_LIB)/rtems_crti.$(OBJEXT)
TMPINSTALL_FILES += $(PROJECT_LIB)/rtems_crti.$(OBJEXT)
$(PROJECT_LIB)/linkcmds: startup/linkcmds $(PROJECT_LIB)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds
PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds

View File

@@ -0,0 +1,21 @@
#.section ".text"
.section .entry_point_section,"awx",@progbits
.global _start
_start:
lis %r1,_stack@h
ori %r1,%r1,_stack@l
li %r3,8192
mtmsr %r3
bl cmain
.size _start, . - _start
.global __eabi
__eabi:
blr
.size __eabi, . - __eabi
.section ".reset","ax"
_reset:
b _start
.size _reset, . - _reset

View File

@@ -0,0 +1,11 @@
void BSP_panic(char *s)
{
/*
printk("%s PANIC %s\n",_RTEMS_version, s);
rebootQuestion();
*/
}
void _BSP_Fatal_error(unsigned int v)
{
}

View File

@@ -0,0 +1,53 @@
#if 1
static void
__outb(int port, unsigned char v)
{
*((volatile unsigned char *)(0x80000000 + port)) = v;
}
static unsigned char
__inb(int port)
{
return *((volatile unsigned char *)(0x80000000 + port));
}
#endif
static void
__memcpy (unsigned char *d, unsigned char *s, int len)
{
while (len--)
*d++ = *s++;
}
static void
__bzero (unsigned char *d, int len)
{
while (len--)
*d++ = 0;
}
extern unsigned char __sdata2_load[], __sdata2_start[], __sdata2_end[];
extern unsigned char __data_load[], __data_start[], __data_end[];
extern unsigned char __sbss2_start[], __sbss2_end[];
extern unsigned char __sbss_start[], __sbss_end[];
extern unsigned char __bss_start[], __bss_end[];
extern void boot_card(void *);
void cmain (void)
{
printk( "hello #1\n");
__memcpy (__sdata2_start, __sdata2_load, __sdata2_end - __sdata2_start);
__memcpy (__data_start, __data_load, __data_end - __data_start);
__bzero (__sbss2_start, __sbss2_end - __sbss2_start);
__bzero (__sbss_start, __sbss_end - __sbss_start);
__bzero (__bss_start, __bss_end - __bss_start);
printk( "hello #2\n");
boot_card(0);
printk( "end of BSP\n");
__outb (0x92, 0x01);
while (1)
;
}

View File

@@ -0,0 +1,166 @@
OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc",
"elf32-powerpc")
OUTPUT_ARCH(powerpc:common)
ENTRY(_start)
MEMORY
{
RAM : ORIGIN = 0, LENGTH = 4M
ROM : ORIGIN = 0xFFFC0000, LENGTH = 0x40000
VECTORS : ORIGIN = 0xFFF00000, LENGTH = 0x20000
RESET : ORIGIN = 0xFFFFFFFC, LENGTH = 0x4
}
RamBase = DEFINED(RamBase) ? RamBase : 0x0;
RamSize = DEFINED(RamSize) ? RamSize : 4M;
HeapSize = DEFINED(HeapSize) ? HeapSize : 0;
SECTIONS
{
/* Read-only sections, merged into text segment: */
. = 0xfffc0000;
/*
.entry_point_section :
{
} =0
*/
.text :
{
*(.entry_point_section)
*(.text .text.* .gnu.linkonce.t.*)
*(.eh_frame_hdr*)
*(.eh_frame*)
/*
* Special FreeBSD sysctl sections.
*/
. = ALIGN (16);
__start_set_sysctl_set = .;
*(set_sysctl_*);
__stop_set_sysctl_set = ABSOLUTE(.);
*(set_domain_*);
*(set_pseudo_*);
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
__text_end = .;
} >ROM =0
.init :
{
KEEP (*(.init))
} >ROM =0
.fini :
{
_fini = .;
KEEP (*(.fini))
} >ROM =0
/* Put .ctors and .dtors next to the .got2 section, so that the pointers
get relocated with -mrelocatable. Also put in the .fixup pointers.
The current compiler no longer needs this, but keep it around for 2.7.2 */
PROVIDE (__GOT2_START__ = .);
PROVIDE (_GOT2_START_ = .);
.got2 : { *(.got2) } >ROM =0
PROVIDE (__GOT2_END__ = .);
PROVIDE (_GOT2_END_ = .);
PROVIDE (__CTOR_LIST__ = .);
.ctors : { *(.ctors) } >ROM =0
PROVIDE (__CTOR_END__ = .);
PROVIDE (__DTOR_LIST__ = .);
.dtors : { *(.dtors) } >ROM =0
PROVIDE (__DTOR_END__ = .);
.jcr : { KEEP (*(.jcr)) } > ROM =0
.rodata :
{
*(.rodata .rodata.* .gnu.linkonce.r.*)
*(.rodata1)
. = ALIGN(4);
__rodata_end = .;
} >ROM =0
. = 0x1000;
__sdata2_load = __rodata_end;
.sdata2 : AT (__sdata2_load)
{
__sdata2_start = .;
PROVIDE (_SDA2_BASE_ = 32768);
*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
. = ALIGN(4);
__sdata2_end = .;
} >RAM
.sbss2 :
{
__sbss2_start = .;
*(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
. = ALIGN(4);
__sbss2_end = .;
} >RAM
__data_load = __sdata2_load + SIZEOF (.sdata2);
.data : AT(__data_load)
{
__data_start = .;
*(.data .data.* .gnu.linkonce.d.*)
KEEP (*(.gnu.linkonce.d.*personality*))
SORT(CONSTRUCTORS)
*(.data1)
PROVIDE (_SDA_BASE_ = 32768);
*(.sdata .sdata.* .gnu.linkonce.s.*)
. = ALIGN(4);
__data_end = .;
} >RAM
PROVIDE (__EXCEPT_START__ = .);
.gcc_except_table : { *(.gcc_except_table*) } >RAM
PROVIDE (__EXCEPT_END__ = .);
.sbss :
{
__sbss_start = .;
*(.dynsbss)
*(.sbss .sbss.* .gnu.linkonce.sb.*)
*(.scommon)
__sbss_end = .;
} >RAM
.bss :
{
__bss_start = .;
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
__bss_end = .;
/* Allocate the main stack area. Make sure it starts 16bytes aligned
to accommodate any possible program expectation. */
_stack = ALIGN(16) + 0x1000;
_end = _stack;
} >RAM
WorkAreaBase = .;
. = RamBase + RamSize;
.reset :
{
KEEP(*(.reset))
} >RESET
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.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) }
/DISCARD/ : { *(.note.GNU-stack) }
}