summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/avr
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-11-20 15:39:04 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-11-20 15:39:04 +0000
commit858ea06c85966d406ad4e2544ee8fe46ed6d2345 (patch)
tree55d220b62693c5abebbe14b7d3edbe5e8845ca44 /c/src/lib/libbsp/avr
parent2008-11-20 Daron Chabot <daronchabot@gmail.com> (diff)
downloadrtems-858ea06c85966d406ad4e2544ee8fe46ed6d2345.tar.bz2
2008-11-20 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/linkcmds, tools/.cvsignore, tools/Makefile.am, tools/configure.ac, tools/runtest.in: New files.
Diffstat (limited to 'c/src/lib/libbsp/avr')
-rw-r--r--c/src/lib/libbsp/avr/avrtest/.cvsignore8
-rw-r--r--c/src/lib/libbsp/avr/avrtest/ChangeLog7
-rw-r--r--c/src/lib/libbsp/avr/avrtest/Makefile.am49
-rw-r--r--c/src/lib/libbsp/avr/avrtest/README15
-rw-r--r--c/src/lib/libbsp/avr/avrtest/bsp_specs15
-rw-r--r--c/src/lib/libbsp/avr/avrtest/configure.ac24
-rw-r--r--c/src/lib/libbsp/avr/avrtest/console/console-io.c67
-rw-r--r--c/src/lib/libbsp/avr/avrtest/include/.cvsignore5
-rw-r--r--c/src/lib/libbsp/avr/avrtest/include/bsp.h55
-rw-r--r--c/src/lib/libbsp/avr/avrtest/preinstall.am67
-rw-r--r--c/src/lib/libbsp/avr/avrtest/start/start.S82
-rw-r--r--c/src/lib/libbsp/avr/avrtest/startup/linkcmds227
-rw-r--r--c/src/lib/libbsp/avr/avrtest/tools/.cvsignore9
-rw-r--r--c/src/lib/libbsp/avr/avrtest/tools/Makefile.am26
-rw-r--r--c/src/lib/libbsp/avr/avrtest/tools/configure.ac25
-rw-r--r--c/src/lib/libbsp/avr/avrtest/tools/runtest.in227
16 files changed, 908 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/avr/avrtest/.cvsignore b/c/src/lib/libbsp/avr/avrtest/.cvsignore
new file mode 100644
index 0000000000..baba64eafa
--- /dev/null
+++ b/c/src/lib/libbsp/avr/avrtest/.cvsignore
@@ -0,0 +1,8 @@
+aclocal.m4
+autom4te*.cache
+config.cache
+config.log
+config.status
+configure
+Makefile
+Makefile.in
diff --git a/c/src/lib/libbsp/avr/avrtest/ChangeLog b/c/src/lib/libbsp/avr/avrtest/ChangeLog
new file mode 100644
index 0000000000..56c950fef9
--- /dev/null
+++ b/c/src/lib/libbsp/avr/avrtest/ChangeLog
@@ -0,0 +1,7 @@
+2008-11-20 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/linkcmds, tools/.cvsignore,
+ tools/Makefile.am, tools/configure.ac, tools/runtest.in: New files.
+
diff --git a/c/src/lib/libbsp/avr/avrtest/Makefile.am b/c/src/lib/libbsp/avr/avrtest/Makefile.am
new file mode 100644
index 0000000000..ad3d4ca55d
--- /dev/null
+++ b/c/src/lib/libbsp/avr/avrtest/Makefile.am
@@ -0,0 +1,49 @@
+##
+## $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
+
+nodist_include_HEADERS = include/bspopts.h
+nodist_include_bsp_HEADERS = ../../shared/include/bootcard.h
+DISTCLEANFILES = include/bspopts.h
+noinst_PROGRAMS =
+
+SUBDIRS = . tools
+
+nodist_include_HEADERS += ../../shared/include/coverhd.h
+
+EXTRA_DIST = start/start.S
+start.$(OBJEXT): start/start.S
+ $(CPPASCOMPILE) -o $@ -c $<
+project_lib_DATA = start.$(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
+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)
+
+EXTRA_DIST += times
+
+include $(srcdir)/preinstall.am
+include $(top_srcdir)/../../../../automake/local.am
diff --git a/c/src/lib/libbsp/avr/avrtest/README b/c/src/lib/libbsp/avr/avrtest/README
new file mode 100644
index 0000000000..83535e209e
--- /dev/null
+++ b/c/src/lib/libbsp/avr/avrtest/README
@@ -0,0 +1,15 @@
+#
+# $Id$
+#
+
+This BSP is designed to operate on the AVR Mega128 variants.
+
+It has only been run on the AVRTEST simulator.
+
+Download from sourceforge.net:
+
+cvs -d:pserver:anonymous@winavr.cvs.sourceforge.net:/cvsroot/winavr login
+cvs -z3 -d:pserver:anonymous@winavr.cvs.sourceforge.net:/cvsroot/winavr \
+ co -P avrtest
+
+
diff --git a/c/src/lib/libbsp/avr/avrtest/bsp_specs b/c/src/lib/libbsp/avr/avrtest/bsp_specs
new file mode 100644
index 0000000000..86dd2f4d22
--- /dev/null
+++ b/c/src/lib/libbsp/avr/avrtest/bsp_specs
@@ -0,0 +1,15 @@
+%rename endfile old_endfile
+%rename startfile old_startfile
+%rename link old_link
+
+*startfile:
+%{!qrtems: %(old_startfile)} \
+%{!nostdlib: %{qrtems: start.o%s}}
+
+*endfile:
+%{!qrtems: %(old_endfile)} \
+%{!nostdlib: %{qrtems:}}
+
+*link:
+%(old_link) %{!qrtems: %(old_link)} %{qrtems: -dc -dp -N -e _start}
+
diff --git a/c/src/lib/libbsp/avr/avrtest/configure.ac b/c/src/lib/libbsp/avr/avrtest/configure.ac
new file mode 100644
index 0000000000..9f1ac113ed
--- /dev/null
+++ b/c/src/lib/libbsp/avr/avrtest/configure.ac
@@ -0,0 +1,24 @@
+## 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_CONFIG_BUILD_SUBDIRS(tools)
+
+RTEMS_PROG_CC_FOR_TARGET([-ansi -fasm])
+RTEMS_CANONICALIZE_TOOLS
+RTEMS_PROG_CCAS
+
+BSP_BOOTCARD_OPTIONS
+
+# Explicitly list all Makefiles here
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/c/src/lib/libbsp/avr/avrtest/console/console-io.c b/c/src/lib/libbsp/avr/avrtest/console/console-io.c
new file mode 100644
index 0000000000..792f249aa9
--- /dev/null
+++ b/c/src/lib/libbsp/avr/avrtest/console/console-io.c
@@ -0,0 +1,67 @@
+/*
+ * 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>
+
+#define STDIO_PORT 0x52
+#define EXIT_PORT 0x4F
+#define ABORT_PORT 0x49
+
+/*
+ * 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
+)
+{
+ *((volatile unsigned char *) STDIO_PORT) = ch;
+}
+
+/*
+ * console_inbyte_nonblocking
+ *
+ * This routine polls for a character.
+ */
+
+int console_inbyte_nonblocking(
+ int port
+)
+{
+ return -1;
+}
+
+#include <rtems/bspIo.h>
+
+void AVRsimBSP_output_char(char c) { console_outbyte_polled( 0, c ); }
+
+BSP_output_char_function_type BSP_output_char = AVRsimBSP_output_char;
+BSP_polling_getchar_function_type BSP_poll_char = NULL;
diff --git a/c/src/lib/libbsp/avr/avrtest/include/.cvsignore b/c/src/lib/libbsp/avr/avrtest/include/.cvsignore
new file mode 100644
index 0000000000..eb2d61f966
--- /dev/null
+++ b/c/src/lib/libbsp/avr/avrtest/include/.cvsignore
@@ -0,0 +1,5 @@
+bspopts.h
+bspopts.h.in
+coverhd.h
+stamp-h
+stamp-h.in
diff --git a/c/src/lib/libbsp/avr/avrtest/include/bsp.h b/c/src/lib/libbsp/avr/avrtest/include/bsp.h
new file mode 100644
index 0000000000..5a1e679f84
--- /dev/null
+++ b/c/src/lib/libbsp/avr/avrtest/include/bsp.h
@@ -0,0 +1,55 @@
+/* bsp.h
+ *
+ * This include file contains some definitions specific to the
+ * h8 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.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
+
+/*
+ * Simple spin delay in microsecond units for device drivers.
+ * This is very dependent on the clock speed of the target.
+ */
+
+#define rtems_bsp_delay( microseconds ) \
+ { register uint32_t _delay=(microseconds); \
+ register uint32_t _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) ); \
+ }
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/c/src/lib/libbsp/avr/avrtest/preinstall.am b/c/src/lib/libbsp/avr/avrtest/preinstall.am
new file mode 100644
index 0000000000..bdd3a3e368
--- /dev/null
+++ b/c/src/lib/libbsp/avr/avrtest/preinstall.am
@@ -0,0 +1,67 @@
+## 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)/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)/linkcmds: startup/linkcmds $(PROJECT_LIB)/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds
+PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds
+
diff --git a/c/src/lib/libbsp/avr/avrtest/start/start.S b/c/src/lib/libbsp/avr/avrtest/start/start.S
new file mode 100644
index 0000000000..f2e1ee5e17
--- /dev/null
+++ b/c/src/lib/libbsp/avr/avrtest/start/start.S
@@ -0,0 +1,82 @@
+
+#define SPL 0x3d
+#define SPH 0x3e
+#define SREG 0x3f
+#define RAMPZ 0x3b
+
+#define RAMEND (64 * 1024)
+
+/*
+ .weak __stack
+ .set __stack, RAMEND - 1
+*/
+
+ .weak __heap_end
+ .set __heap_end, 0
+
+
+ .section .vectors,"ax",@progbits
+ .global __vectors
+ .func __vectors
+__vectors:
+__reset:
+ jmp __init
+ .endfunc
+
+ .section .init0,"ax",@progbits
+ .weak __init
+; .func __init
+__init:
+
+ .section .init2,"ax",@progbits
+ clr r1
+ out 0x3f, r1
+ ldi r28,lo8(__stack)
+ ldi r29,hi8(__stack)
+ out SPH, r29
+ out SPL, r28
+
+ /* Only for >64K devices with RAMPZ, replaces the default code
+ provided by libgcc.S which is only linked in if necessary. */
+
+ .section .init4,"ax",@progbits
+ .global __do_copy_data
+__do_copy_data:
+ .global __do_clear_bss
+__do_clear_bss:
+#if 0
+ ldi r17, hi8(__data_end)
+
+ ldi r26, lo8(__data_start)
+ ldi r27, hi8(__data_start)
+
+ ldi r30, lo8(__data_load_start)
+ ldi r31, hi8(__data_load_start)
+ ldi r16, hh8(__data_load_start)
+ out RAMPZ, r16
+
+0:
+ cpi r26, lo8(__data_end)
+ cpc r27, r17
+ breq 1f
+
+ elpm r0, Z+
+ st X+, r0
+ rjmp 0b
+1:
+#endif
+
+ .section .init9,"ax",@progbits
+ call boot_card
+ jmp exit
+; .endfunc
+
+ .global exit
+ .func exit
+exit: out 0x2f, r0
+ .endfunc
+
+ .global abort
+ .func abort
+abort: out 0x29, r0
+ .endfunc
diff --git a/c/src/lib/libbsp/avr/avrtest/startup/linkcmds b/c/src/lib/libbsp/avr/avrtest/startup/linkcmds
new file mode 100644
index 0000000000..a1957cbae2
--- /dev/null
+++ b/c/src/lib/libbsp/avr/avrtest/startup/linkcmds
@@ -0,0 +1,227 @@
+/*
+ * $Id$
+ */
+
+/*
+ * Declare some sizes.
+ */
+RamBase = DEFINED(RamBase) ? RamBase : 0;
+RamSize = DEFINED(RamSize) ? RamSize : 256K;
+HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0;
+StackSize = DEFINED(StackSize) ? StackSize : 0x1000;
+
+/* Default linker script, for normal executables */
+OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr")
+OUTPUT_ARCH(avr:5)
+MEMORY
+{
+ text (rx) : ORIGIN = 0, LENGTH = 256K
+ data (rw!x) : ORIGIN = 0x800060, LENGTH = 0xffa0
+ eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K
+}
+SECTIONS
+{
+ /* Read-only sections, merged into text segment: */
+ .hash : { *(.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+ .gnu.version : { *(.gnu.version) }
+ .gnu.version_d : { *(.gnu.version_d) }
+ .gnu.version_r : { *(.gnu.version_r) }
+ .rel.init : { *(.rel.init) }
+ .rela.init : { *(.rela.init) }
+ .rel.text :
+ {
+ *(.rel.text)
+ *(.rel.text.*)
+ *(.rel.gnu.linkonce.t*)
+ }
+ .rela.text :
+ {
+ *(.rela.text)
+ *(.rela.text.*)
+ *(.rela.gnu.linkonce.t*)
+ }
+ .rel.fini : { *(.rel.fini) }
+ .rela.fini : { *(.rela.fini) }
+ .rel.rodata :
+ {
+ *(.rel.rodata)
+ *(.rel.rodata.*)
+ *(.rel.gnu.linkonce.r*)
+ }
+ .rela.rodata :
+ {
+ *(.rela.rodata)
+ *(.rela.rodata.*)
+ *(.rela.gnu.linkonce.r*)
+ }
+ .rel.data :
+ {
+ *(.rel.data)
+ *(.rel.data.*)
+ *(.rel.gnu.linkonce.d*)
+ }
+ .rela.data :
+ {
+ *(.rela.data)
+ *(.rela.data.*)
+ *(.rela.gnu.linkonce.d*)
+ }
+ .rel.ctors : { *(.rel.ctors) }
+ .rela.ctors : { *(.rela.ctors) }
+ .rel.dtors : { *(.rel.dtors) }
+ .rela.dtors : { *(.rela.dtors) }
+ .rel.got : { *(.rel.got) }
+ .rela.got : { *(.rela.got) }
+ .rel.bss : { *(.rel.bss) }
+ .rela.bss : { *(.rela.bss) }
+ .rel.plt : { *(.rel.plt) }
+ .rela.plt : { *(.rela.plt) }
+ /* Internal text space or external memory */
+ .text :
+ {
+ *(.vectors)
+ KEEP(*(.vectors))
+ /* For data that needs to reside in the lower 64k of progmem. */
+ *(.progmem.gcc*)
+ *(.progmem*)
+ . = ALIGN(2);
+ __trampolines_start = . ;
+ /* The jump trampolines for the 16-bit limited relocs will reside here. */
+ *(.trampolines)
+ *(.trampolines*)
+ __trampolines_end = . ;
+ /* For future tablejump instruction arrays for 3 byte pc devices.
+ We don't relax jump/call instructions within these sections. */
+ *(.jumptables)
+ *(.jumptables*)
+ /* For code that needs to reside in the lower 128k progmem. */
+ *(.lowtext)
+ *(.lowtext*)
+ __ctors_start = . ;
+ *(.ctors)
+ __ctors_end = . ;
+ __dtors_start = . ;
+ *(.dtors)
+ __dtors_end = . ;
+ KEEP(SORT(*)(.ctors))
+ KEEP(SORT(*)(.dtors))
+ /* From this point on, we don't bother about wether the insns are
+ below or above the 16 bits boundary. */
+ *(.init0) /* Start here after reset. */
+ KEEP (*(.init0))
+ *(.init1)
+ KEEP (*(.init1))
+ *(.init2) /* Clear __zero_reg__, set up stack pointer. */
+ KEEP (*(.init2))
+ *(.init3)
+ KEEP (*(.init3))
+ *(.init4) /* Initialize data and BSS. */
+ KEEP (*(.init4))
+ *(.init5)
+ KEEP (*(.init5))
+ *(.init6) /* C++ constructors. */
+ KEEP (*(.init6))
+ *(.init7)
+ KEEP (*(.init7))
+ *(.init8)
+ KEEP (*(.init8))
+ *(.init9) /* Call main(). */
+ KEEP (*(.init9))
+ *(.text)
+ . = ALIGN(2);
+ *(.text.*)
+ . = ALIGN(2);
+ *(.fini9) /* _exit() starts here. */
+ KEEP (*(.fini9))
+ *(.fini8)
+ KEEP (*(.fini8))
+ *(.fini7)
+ KEEP (*(.fini7))
+ *(.fini6) /* C++ destructors. */
+ KEEP (*(.fini6))
+ *(.fini5)
+ KEEP (*(.fini5))
+ *(.fini4)
+ KEEP (*(.fini4))
+ *(.fini3)
+ KEEP (*(.fini3))
+ *(.fini2)
+ KEEP (*(.fini2))
+ *(.fini1)
+ KEEP (*(.fini1))
+ *(.fini0) /* Infinite loop after program termination. */
+ KEEP (*(.fini0))
+ _etext = . ;
+ } > text
+ .data : AT (ADDR (.text) + SIZEOF (.text))
+ {
+ PROVIDE (__data_start = .) ;
+ *(.data)
+ *(.data*)
+ *(.rodata) /* We need to include .rodata here if gcc is used */
+ *(.rodata*) /* with -fdata-sections. */
+ *(.gnu.linkonce.d*)
+ . = ALIGN(2);
+ _edata = . ;
+ PROVIDE (__data_end = .) ;
+ } > data
+ .bss SIZEOF(.data) + ADDR(.data) :
+ {
+ PROVIDE (__bss_start = .) ;
+ *(.bss)
+ *(.bss*)
+ *(COMMON)
+ PROVIDE (__bss_end = .) ;
+ . = ALIGN(16);
+
+ . += StackSize;
+ PROVIDE (__stack = .);
+ PROVIDE (WorkAreaBase = .);
+ } > data
+ __data_load_start = LOADADDR(.data);
+ __data_load_end = __data_load_start + SIZEOF(.data);
+ /* Global data not cleared after reset. */
+ .noinit SIZEOF(.bss) + ADDR(.bss) :
+ {
+ PROVIDE (__noinit_start = .) ;
+ *(.noinit*)
+ PROVIDE (__noinit_end = .) ;
+ _end = . ;
+ PROVIDE (__heap_start = .) ;
+ } > data
+ .eeprom :
+ {
+ *(.eeprom*)
+ __eeprom_end = . ;
+ } > eeprom
+ /* 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) *(.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) }
+}
diff --git a/c/src/lib/libbsp/avr/avrtest/tools/.cvsignore b/c/src/lib/libbsp/avr/avrtest/tools/.cvsignore
new file mode 100644
index 0000000000..074184bf59
--- /dev/null
+++ b/c/src/lib/libbsp/avr/avrtest/tools/.cvsignore
@@ -0,0 +1,9 @@
+aclocal.m4
+autom4te*.cache
+config.cache
+config.log
+config.status
+configure
+Makefile
+Makefile.in
+runtest
diff --git a/c/src/lib/libbsp/avr/avrtest/tools/Makefile.am b/c/src/lib/libbsp/avr/avrtest/tools/Makefile.am
new file mode 100644
index 0000000000..0a5f8b2d7b
--- /dev/null
+++ b/c/src/lib/libbsp/avr/avrtest/tools/Makefile.am
@@ -0,0 +1,26 @@
+##
+## $Id$
+##
+
+ACLOCAL_AMFLAGS = -I ../../../../../aclocal
+
+transform =
+bsptools_bindir = ${exec_prefix}/@RTEMS_BSP@/tests
+bsptools_bin_SCRIPTS = runtest
+
+all-local: $(TMPINSTALL_FILES)
+
+TMPINSTALL_FILES =
+
+$(PROJECT_ROOT)/@RTEMS_BSP@/tests/$(dirstamp):
+ @$(MKDIR_P) $(PROJECT_ROOT)/@RTEMS_BSP@/tests
+ @: > $(PROJECT_ROOT)/@RTEMS_BSP@/tests/$(dirstamp)
+TMPINSTALL_FILES += $(PROJECT_ROOT)/@RTEMS_BSP@/tests/$(dirstamp)
+
+$(PROJECT_ROOT)/@RTEMS_BSP@/tests/runtest: runtest $(PROJECT_ROOT)/@RTEMS_BSP@/tests/$(dirstamp)
+ $(INSTALL_SCRIPT) $< $(PROJECT_ROOT)/@RTEMS_BSP@/tests/runtest
+TMPINSTALL_FILES += $(PROJECT_ROOT)/@RTEMS_BSP@/tests/runtest
+
+CLEANFILES = $(TMPINSTALL_FILES)
+
+include $(top_srcdir)/../../../../../automake/host.am
diff --git a/c/src/lib/libbsp/avr/avrtest/tools/configure.ac b/c/src/lib/libbsp/avr/avrtest/tools/configure.ac
new file mode 100644
index 0000000000..9f00774267
--- /dev/null
+++ b/c/src/lib/libbsp/avr/avrtest/tools/configure.ac
@@ -0,0 +1,25 @@
+## Process this file with autoconf to produce a configure script.
+##
+## $Id$
+
+AC_PREREQ(2.60)
+AC_INIT([rtems-c-src-lib-libbsp-sparc-erc32-tools],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla])
+AC_CONFIG_SRCDIR([runtest.in])
+RTEMS_TOP(../../../../../../..)
+
+RTEMS_CANONICAL_TARGET_CPU
+
+AM_INIT_AUTOMAKE([no-define foreign 1.10])
+AM_MAINTAINER_MODE
+
+RTEMS_ENV_RTEMSBSP
+
+RTEMS_PATH_KSH
+
+RTEMS_PROJECT_ROOT
+RTEMS_TOOLPATHS
+
+# Explicitly list all Makefiles here
+AC_CONFIG_FILES([Makefile
+runtest])
+AC_OUTPUT
diff --git a/c/src/lib/libbsp/avr/avrtest/tools/runtest.in b/c/src/lib/libbsp/avr/avrtest/tools/runtest.in
new file mode 100644
index 0000000000..b3e48312d4
--- /dev/null
+++ b/c/src/lib/libbsp/avr/avrtest/tools/runtest.in
@@ -0,0 +1,227 @@
+#!@KSH@ -p
+#
+# $Id$
+#
+# Run rtems tests on the M32C simulator includeed with GDB
+#
+
+# progname=`basename $0`
+progname=${0##*/} # fast basename hack for ksh, bash
+
+USAGE=\
+"usage: $progname [ -opts ] test [ test ... ]
+ -o options -- specify options to be passed to simulator
+ -v -- verbose
+ -l logdir -- specify log directory (default is 'logdir')
+
+ Specify test as 'test' or 'test.exe' or 'test.ralf'.
+ All multiprocessing tests *must* be specified simply as 'mp01', etc.
+"
+
+# export everything
+set -a
+
+# log an error to stderr
+prerr()
+{
+ echo "$*" >&2
+}
+
+fatal() {
+ [ "$1" ] && prerr $*
+ prerr "$USAGE"
+ exit 1
+}
+
+warn() {
+ [ "$1" ] && prerr $*
+}
+
+# print args, 1 per line
+ml_echo()
+{
+ for l
+ do
+ echo "$l"
+ done
+}
+
+# run at normal and signalled exit
+test_exit()
+{
+ exit_code=$1
+
+ rm -f ${statfile}* ${logfile}.tmp*
+ [ "$sim_pid" ] && kill -9 $sim_pid
+
+ exit $exit_code
+}
+
+#
+# process the options
+#
+# defaults for getopt vars
+#
+# max_run_time is defaulted to 3 minutes
+#
+
+verbose=""
+extra_options=""
+stdio_setup="yes"
+run_to_completion="yes"
+logdir=log
+update_on_tick="no"
+max_run_time=$((30))
+using_print_buffer="yes"
+
+while getopts vhr12o:c:sl:t OPT
+do
+ case "$OPT" in
+ v)
+ verbose="yes";;
+ l)
+ logdir="$OPTARG";;
+ o)
+ extra_options="$OPTARG";;
+ *)
+ fatal;;
+ esac
+done
+
+let $((shiftcount = $OPTIND - 1))
+shift $shiftcount
+
+args=$*
+
+#
+# Run the tests
+#
+
+tests="$args"
+if [ ! "$tests" ]
+then
+ set -- `ls -1 *.exe *.ralf 2>/dev/null`
+ tests="$*"
+fi
+
+[ -d $logdir ] ||
+ mkdir $logdir || fatal "could not create log directory ($logdir)"
+
+# where the tmp files go
+statfile=/tmp/stats$$
+
+trap "test_exit" 1 2 3 13 14 15
+
+for tfile in $tests
+do
+
+ echo $tfile | grep "exe$" >/dev/null
+ if [ $? -eq 0 ] ; then
+ ext=.exe
+ else
+ ext=.ralf
+ fi
+ tname=`basename $tfile ${ext}`
+ TEST_TYPE="single"
+
+ case $tname in
+ capture* | monitor* | termios* | fileio* | pppd*)
+ if [ $run_to_completion = "yes" ]
+ then
+ warn "Skipping $tname; it is interactive"
+ continue
+ fi
+ ;;
+ *-node2*)
+ fatal "MP tests not supported"
+ warn "Skipping $tname; 'runtest' runs both nodes when for *-node1"
+ continue;;
+ *-node1*)
+ warn "Running both nodes associated with $tname"
+ variant=`echo $tname | sed 's/.*-node[12]//' | sed "s/${ext}/"`
+ tname=`echo $tname | sed 's/-node.*//'`
+ TEST_TYPE="mp"
+ ;;
+ sp39*|sp41*)
+ warn "Skipping $tname; it does not complete long on sis"
+ continue
+ ;;
+ minimum*|stackchk*|*fatal*|termio*)
+ warn "Skipping $tname; it locks up or takes a VERY long time to run"
+ continue
+ ;;
+ esac
+
+ # Change the title bar to indicate which test we are running
+ # The simulator screen doesn't provide any indication
+
+ logfile=$logdir/$tname
+ infofile=$logfile.info
+
+ rm -f ${statfile}* ${logfile}.tmp*
+
+ date=`date`
+ echo "Starting $tname at $date"
+
+ # Spin off the simulator in the background
+ # @target_alias@-run ${tfile} >${logfile}.tmp 2>&1 &
+ /home/joel/work-gnat/svn/m32c-install/bin/m32c-elf-run ${tfile} >${logfile}.tmp 2>&1 &
+ sim_pid=$!
+
+ # Make sure it won't run forever...
+ {
+ time_run=0
+ while [ $time_run -lt $max_run_time ]
+ do
+ # sleep 1s at a time waiting for job to finish or timer to expire
+ # if job has exited, then we exit, too.
+ sleep 1
+ if kill -0 $sim_pid 2>/dev/null
+ then
+ grep "Memory exception " ${logfile}.tmp >/dev/null
+ if [ $? -eq 0 ] ; then
+ break
+ fi
+
+ time_run=$((time_run + 1))
+ else
+ exit 0
+ fi
+ done
+
+ kill -2 $sim_pid 2>/dev/null
+ { sleep 5; kill -9 $sim_pid 2>/dev/null; } &
+ } &
+
+ wait $sim_pid
+ status=$?
+ if [ $status -ne 0 ]
+ then
+ ran_too_long="yes"
+ else
+ ran_too_long="no"
+ fi
+
+ sim_pid=""
+
+ # fix up the printf output from the test
+ case $TEST_TYPE in
+ mp)
+ fatal "MP not supported"
+ ;;
+ *)
+ output_it=1
+ cat ${logfile}.tmp > ${logfile}
+ ;;
+ esac
+
+ rm -f ${logfile}.tmp*
+
+done
+
+test_exit 0
+
+# Local Variables: ***
+# mode:ksh ***
+# End: ***
+