From 6e27be70e131b10e67b75ea033fccbd77c95cf6d Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 4 Jun 2009 16:23:11 +0000 Subject: 2009-06-04 Xi Yang * .cvsignore, ChangeLog, Makefile.am, README, bsp_specs, configure.ac, preinstall.am, console/uarts.c, include/bsp.h, include/bspopts.h.in, include/tm27.h, start/start.S, startup/bspstart.c, startup/linkcmds, startup/memmap.c: New files. --- c/src/lib/libbsp/arm/gumstix/.cvsignore | 8 + c/src/lib/libbsp/arm/gumstix/ChangeLog | 7 + c/src/lib/libbsp/arm/gumstix/Makefile.am | 62 ++++++ c/src/lib/libbsp/arm/gumstix/README | 6 + c/src/lib/libbsp/arm/gumstix/bsp_specs | 13 ++ c/src/lib/libbsp/arm/gumstix/configure.ac | 23 +++ c/src/lib/libbsp/arm/gumstix/console/uarts.c | 71 +++++++ c/src/lib/libbsp/arm/gumstix/include/bsp.h | 50 +++++ c/src/lib/libbsp/arm/gumstix/include/bspopts.h.in | 16 ++ c/src/lib/libbsp/arm/gumstix/include/tm27.h | 32 ++++ c/src/lib/libbsp/arm/gumstix/preinstall.am | 67 +++++++ c/src/lib/libbsp/arm/gumstix/start/start.S | 149 +++++++++++++++ c/src/lib/libbsp/arm/gumstix/startup/bspstart.c | 45 +++++ c/src/lib/libbsp/arm/gumstix/startup/linkcmds | 219 ++++++++++++++++++++++ c/src/lib/libbsp/arm/gumstix/startup/memmap.c | 19 ++ 15 files changed, 787 insertions(+) create mode 100644 c/src/lib/libbsp/arm/gumstix/.cvsignore create mode 100644 c/src/lib/libbsp/arm/gumstix/ChangeLog create mode 100755 c/src/lib/libbsp/arm/gumstix/Makefile.am create mode 100755 c/src/lib/libbsp/arm/gumstix/README create mode 100755 c/src/lib/libbsp/arm/gumstix/bsp_specs create mode 100755 c/src/lib/libbsp/arm/gumstix/configure.ac create mode 100755 c/src/lib/libbsp/arm/gumstix/console/uarts.c create mode 100755 c/src/lib/libbsp/arm/gumstix/include/bsp.h create mode 100644 c/src/lib/libbsp/arm/gumstix/include/bspopts.h.in create mode 100755 c/src/lib/libbsp/arm/gumstix/include/tm27.h create mode 100755 c/src/lib/libbsp/arm/gumstix/preinstall.am create mode 100755 c/src/lib/libbsp/arm/gumstix/start/start.S create mode 100755 c/src/lib/libbsp/arm/gumstix/startup/bspstart.c create mode 100755 c/src/lib/libbsp/arm/gumstix/startup/linkcmds create mode 100755 c/src/lib/libbsp/arm/gumstix/startup/memmap.c diff --git a/c/src/lib/libbsp/arm/gumstix/.cvsignore b/c/src/lib/libbsp/arm/gumstix/.cvsignore new file mode 100644 index 0000000000..849c802af6 --- /dev/null +++ b/c/src/lib/libbsp/arm/gumstix/.cvsignore @@ -0,0 +1,8 @@ +Makefile +Makefile.in +aclocal.m4 +autom4te.cache +config.cache +config.log +config.status +configure diff --git a/c/src/lib/libbsp/arm/gumstix/ChangeLog b/c/src/lib/libbsp/arm/gumstix/ChangeLog new file mode 100644 index 0000000000..58eef9c1dc --- /dev/null +++ b/c/src/lib/libbsp/arm/gumstix/ChangeLog @@ -0,0 +1,7 @@ +2009-06-04 Xi Yang + + * .cvsignore, ChangeLog, Makefile.am, README, bsp_specs, configure.ac, + preinstall.am, console/uarts.c, include/bsp.h, include/bspopts.h.in, + include/tm27.h, start/start.S, startup/bspstart.c, startup/linkcmds, + startup/memmap.c: New files. + diff --git a/c/src/lib/libbsp/arm/gumstix/Makefile.am b/c/src/lib/libbsp/arm/gumstix/Makefile.am new file mode 100755 index 0000000000..483b146ab9 --- /dev/null +++ b/c/src/lib/libbsp/arm/gumstix/Makefile.am @@ -0,0 +1,62 @@ +## +## $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 += include/tm27.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 + +EXTRA_DIST = start/start.S +start.$(OBJEXT): start/start.S + $(CPPASCOMPILE) -o $@ -c $< +project_lib_DATA = start.$(OBJEXT) + +dist_project_lib_DATA += startup/linkcmds + +noinst_PROGRAMS += startup.rel +startup_rel_SOURCES = ../../shared/bsplibc.c ../../shared/bsppost.c \ + ../../shared/bsppredriverhook.c ../../shared/bspgetworkarea.c \ + ../../shared/bootcard.c ../../shared/sbrk.c \ + ../../shared/gnatinstallhandler.c ../../shared/bsppretaskinghook.c \ + ../../shared/bspclean.c ../../shared/bspreset.c \ + startup/bspstart.c startup/memmap.c + +startup_rel_CPPFLAGS = $(AM_CPPFLAGS) +startup_rel_LDFLAGS = $(RTEMS_RELLDFLAGS) + +noinst_PROGRAMS += console.rel +console_rel_SOURCES = console/uarts.c ../../shared/console.c +console_rel_CPPFLAGS = $(AM_CPPFLAGS) +console_rel_LDFLAGS = $(RTEMS_RELLDFLAGS) + +noinst_PROGRAMS += abort.rel +abort_rel_SOURCES = ../shared/abort/abort.c +abort_rel_CPPFLAGS = $(AM_CPPFLAGS) +abort_rel_LDFLAGS = $(RTEMS_RELLDFLAGS) + +noinst_LIBRARIES = libbsp.a +libbsp_a_SOURCES = +libbsp_a_LIBADD = startup.rel console.rel abort.rel +libbsp_a_LIBADD += ../../../libcpu/@RTEMS_CPU@/shared/arm920.rel \ + ../../../libcpu/@RTEMS_CPU@/@RTEMS_CPU_MODEL@/clock.rel \ + ../../../libcpu/@RTEMS_CPU@/@RTEMS_CPU_MODEL@/timer.rel \ + ../../../libcpu/@RTEMS_CPU@/@RTEMS_CPU_MODEL@/ffuart.rel \ + ../../../libcpu/@RTEMS_CPU@/@RTEMS_CPU_MODEL@/irq.rel + +include $(srcdir)/preinstall.am +include $(top_srcdir)/../../../../automake/local.am diff --git a/c/src/lib/libbsp/arm/gumstix/README b/c/src/lib/libbsp/arm/gumstix/README new file mode 100755 index 0000000000..72f560cb6f --- /dev/null +++ b/c/src/lib/libbsp/arm/gumstix/README @@ -0,0 +1,6 @@ +# +# $Id$ +# + +This is the BSP for GUMSTIX which has a PXA255 CPU. + diff --git a/c/src/lib/libbsp/arm/gumstix/bsp_specs b/c/src/lib/libbsp/arm/gumstix/bsp_specs new file mode 100755 index 0000000000..e08cc0f0f3 --- /dev/null +++ b/c/src/lib/libbsp/arm/gumstix/bsp_specs @@ -0,0 +1,13 @@ +%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}} + +*link: +%{!qrtems: %(old_link)} %{qrtems: -Qy -dp -Bstatic -N -e _start} + +*endfile: +%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s } diff --git a/c/src/lib/libbsp/arm/gumstix/configure.ac b/c/src/lib/libbsp/arm/gumstix/configure.ac new file mode 100755 index 0000000000..8bdd9fe3cd --- /dev/null +++ b/c/src/lib/libbsp/arm/gumstix/configure.ac @@ -0,0 +1,23 @@ +## Process this file with autoconf to produce a configure script. +## +## configure.ac,v 1.5 2003/03/11 09:39:07 ralf Exp + +AC_PREREQ(2.60) +AC_INIT([rtems-c-src-lib-libbsp-arm-gumstix],[_RTEMS_VERSION],[rtems-bugs@OARcorp.com]) +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_CHECK_NETWORKING +AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes") + +# Explicitly list all Makefiles here +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/c/src/lib/libbsp/arm/gumstix/console/uarts.c b/c/src/lib/libbsp/arm/gumstix/console/uarts.c new file mode 100755 index 0000000000..2186aa53a0 --- /dev/null +++ b/c/src/lib/libbsp/arm/gumstix/console/uarts.c @@ -0,0 +1,71 @@ +/* + * Console driver for GUMSTIX by Yang Xi + * + * This driver uses the shared console driver in + * ...../libbsp/shared/console.c + * + * Copyright (c) 2003 by Cogent Computer Systems + * Written by Jay Monkman + * + * 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 +#include +#include +#include + +#include +#include +#include + +/* How many serial ports? */ +#define NUM_DEVS 1 + +/* These are used by code in console.c */ +unsigned long Console_Port_Count = NUM_DEVS; +console_data Console_Port_Data[NUM_DEVS]; + +/* rtems console uses the following minor number */ +rtems_device_minor_number Console_Port_Minor = 0; +extern console_fns ffuart_fns; + +/* + * There's one item in array for each UART. + * + * Some of these fields are marked "NOT USED". They are not used + * by console.c, but may be used by drivers in libchip + * + * when we add other types of UARTS we will need to move this + * structure to a generic uart.c file with only this in it + */ +console_tbl Console_Port_Tbl[] = { + { + "/dev/console", /* sDeviceName */ + SERIAL_CUSTOM, /* deviceType */ + &ffuart_fns, /* pDeviceFns */ + NULL, /* deviceProbe */ + NULL, /* pDeviceFlow */ + 0, /* ulMargin - NOT USED */ + 0, /* ulHysteresis - NOT USED */ + NULL, /* pDeviceParams */ + FFUART_BASE, /* ulCtrlPort1 - Pointer to DBGU regs */ + 0, /* ulCtrlPort2 - NOT USED */ + 0, /* ulDataPort - NOT USED */ + NULL, /* getRegister - NOT USED */ + NULL, /* setRegister - NOT USED */ + NULL, /* getData - NOT USED */ + NULL, /* setData - NOT USED */ + 0, /* ulClock - NOT USED */ + 0 /* ulIntVector - NOT USED */ + }}; + + +console_tbl *BSP_get_uart_from_minor(int minor) +{ + return &Console_Port_Tbl[minor]; +} diff --git a/c/src/lib/libbsp/arm/gumstix/include/bsp.h b/c/src/lib/libbsp/arm/gumstix/include/bsp.h new file mode 100755 index 0000000000..326f87f722 --- /dev/null +++ b/c/src/lib/libbsp/arm/gumstix/include/bsp.h @@ -0,0 +1,50 @@ +/* + * By Yang Xi . + * + * 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 + +#include +#include +#include +#include + +/* What is the input clock freq in hertz */ +#define BSP_MAIN_FREQ 3686400 /* 3.6864 MHz */ +#define BSP_SLCK_FREQ 32768 /* 32.768 KHz */ + +/* What is the last interrupt */ +#define BSP_MAX_INT AT91RM9200_MAX_INT + +console_tbl *BSP_get_uart_from_minor(int minor); +static inline int32_t BSP_get_baud(void) {return 115200;} + +/* How many serial ports? */ +#define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 1 + +/* How big should the interrupt stack be? */ +#define CONFIGURE_INTERRUPT_STACK_MEMORY (16 * 1024) + +extern rtems_configuration_table Configuration; + +#define ST_PIMR_PIV 33 /* 33 ticks of the 32.768Khz clock ~= 1msec */ + +#ifdef __cplusplus +} +#endif + +#endif /* _BSP_H */ + diff --git a/c/src/lib/libbsp/arm/gumstix/include/bspopts.h.in b/c/src/lib/libbsp/arm/gumstix/include/bspopts.h.in new file mode 100644 index 0000000000..f11cf7efbb --- /dev/null +++ b/c/src/lib/libbsp/arm/gumstix/include/bspopts.h.in @@ -0,0 +1,16 @@ +/* include/bspopts.h.in. Generated from configure.ac by autoheader. */ + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION diff --git a/c/src/lib/libbsp/arm/gumstix/include/tm27.h b/c/src/lib/libbsp/arm/gumstix/include/tm27.h new file mode 100755 index 0000000000..b417668d83 --- /dev/null +++ b/c/src/lib/libbsp/arm/gumstix/include/tm27.h @@ -0,0 +1,32 @@ +/* + * tm27.h + * + * 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 _RTEMS_TMTEST27 +#error "This is an RTEMS internal file you must not include directly." +#endif + +#ifndef __tm27_h +#define __tm27_h + +/* + * Define the interrupt mechanism for Time Test 27 + */ + +#define MUST_WAIT_FOR_INTERRUPT 0 + +#define Install_tm27_vector( handler ) /* empty */ + +#define Cause_tm27_intr() /* empty */ + +#define Clear_tm27_intr() /* empty */ + +#define Lower_tm27_intr() /* empty */ + +#endif diff --git a/c/src/lib/libbsp/arm/gumstix/preinstall.am b/c/src/lib/libbsp/arm/gumstix/preinstall.am new file mode 100755 index 0000000000..73323b55bf --- /dev/null +++ b/c/src/lib/libbsp/arm/gumstix/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: 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/arm/gumstix/start/start.S b/c/src/lib/libbsp/arm/gumstix/start/start.S new file mode 100755 index 0000000000..844ded6763 --- /dev/null +++ b/c/src/lib/libbsp/arm/gumstix/start/start.S @@ -0,0 +1,149 @@ +/* + * By Yang Xi . + * Based upon CSB336 + * + * 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$ + */ + + +/* Some standard definitions...*/ +.equ PSR_MODE_USR, 0x10 +.equ PSR_MODE_FIQ, 0x11 +.equ PSR_MODE_IRQ, 0x12 +.equ PSR_MODE_SVC, 0x13 +.equ PSR_MODE_ABT, 0x17 +.equ PSR_MODE_UNDEF, 0x1B +.equ PSR_MODE_SYS, 0x1F + +.equ PSR_I, 0x80 +.equ PSR_F, 0x40 +.equ PSR_T, 0x20 + +.text +.globl _start +_start: + /* + * Since I don't plan to return to the bootloader, + * I don't have to save the registers. + * + * I'll just set the CPSR for SVC mode, interrupts + * off, and ARM instructions. + */ + mov r0, #(PSR_MODE_SVC | PSR_I | PSR_F) + msr cpsr, r0 + + + /* zero the bss */ + ldr r1, =_bss_end_ + ldr r0, =_bss_start_ + +_bss_init: + mov r2, #0 + cmp r0, r1 + strlot r2, [r0], #4 + blo _bss_init /* loop while r0 < r1 */ + + /* --- Initialize stack pointer registers */ + /* Enter IRQ mode and set up the IRQ stack pointer */ + mov r0, #(PSR_MODE_IRQ | PSR_I | PSR_F) /* No interrupts */ + msr cpsr, r0 + ldr r1, =_irq_stack_size + ldr sp, =_irq_stack + add sp, sp, r1 + + /* Enter FIQ mode and set up the FIQ stack pointer */ + mov r0, #(PSR_MODE_FIQ | PSR_I | PSR_F) /* No interrupts */ + msr cpsr, r0 + ldr r1, =_fiq_stack_size + ldr sp, =_fiq_stack + add sp, sp, r1 + + /* Enter ABT mode and set up the ABT stack pointer */ + mov r0, #(PSR_MODE_ABT | PSR_I | PSR_F) /* No interrupts */ + msr cpsr, r0 + ldr r1, =_abt_stack_size + ldr sp, =_abt_stack + add sp, sp, r1 + + /* Set up the SVC stack pointer last and stay in SVC mode */ + mov r0, #(PSR_MODE_SVC | PSR_I | PSR_F) /* No interrupts */ + msr cpsr, r0 + ldr r1, =_svc_stack_size + ldr sp, =_svc_stack + add sp, sp, r1 + sub sp, sp, #0x64 + + /* + * Initialize the MMU. After we return, the MMU is enabled, + * and memory may be remapped. I hope we don't remap this + * memory away. + */ + + ldr r0, =mem_map + bl mmu_init + + + + /* + * Initialize the exception vectors. This includes the + * exceptions vectors (0x00000000-0x0000001c), and the + * pointers to the exception handlers (0x00000020-0x0000003c). + */ + mov r0, #0 + adr r1, vector_block + ldmia r1!, {r2-r9} + stmia r0!, {r2-r9} + ldmia r1!, {r2-r9} + stmia r0!, {r2-r9} + + + + /* Now we are prepared to start the BSP's C code */ + bl boot_card + + /* + * Theoretically, we could return to what started us up, + * but we'd have to have saved the registers and stacks. + * Instead, we'll just reset. + */ + bl bsp_reset + + /* We shouldn't get here. If we do, hang */ +_hang: b _hang + + +/* + * This is the exception vector table and the pointers to + * the functions that handle the exceptions. It's a total + * of 16 words (64 bytes) + */ +vector_block: + ldr pc, Reset_Handler + ldr pc, Undefined_Handler + ldr pc, SWI_Handler + ldr pc, Prefetch_Handler + ldr pc, Abort_Handler + nop + ldr pc, IRQ_Handler + ldr pc, FIQ_Handler + +Reset_Handler: b bsp_reset +Undefined_Handler: b Undefined_Handler +SWI_Handler: b SWI_Handler +Prefetch_Handler: b Prefetch_Handler +Abort_Handler: b Abort_Handler + nop +IRQ_Handler: b IRQ_Handler +FIQ_Handler: b FIQ_Handler + +.globl Reset_Handler +.globl Undefined_Handler +.globl SWI_Handler +.globl Prefetch_Handler +.globl Abort_Handler +.globl IRQ_Handler +.globl FIQ_Handler diff --git a/c/src/lib/libbsp/arm/gumstix/startup/bspstart.c b/c/src/lib/libbsp/arm/gumstix/startup/bspstart.c new file mode 100755 index 0000000000..33e8efe87c --- /dev/null +++ b/c/src/lib/libbsp/arm/gumstix/startup/bspstart.c @@ -0,0 +1,45 @@ +/* + * By Yang Xi . + * + * 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 +#include +#include +#include + +/* Function prototypes */ +extern void rtems_irq_mngt_init(void); + +/* + * + * NAME: bsp_start_default - BSP initialization function + * + * DESCRIPTION: + * This function is called before RTEMS is initialized and used + * adjust the kernel's configuration. + * + * This function also configures the CPU's memory protection unit. + * + * RESTRICTIONS/LIMITATIONS: + * Since RTEMS is not configured, no RTEMS functions can be called. + * + */ +void bsp_start_default( void ) +{ + /* disable interrupts */ + XSCALE_INT_ICMR = 0x0; + rtems_exception_init_mngt(); + rtems_irq_mngt_init(); +} /* bsp_start */ + +/* + * By making this a weak alias for bsp_start_default, a brave soul + * can override the actual bsp_start routine used. + */ +void bsp_start (void) __attribute__ ((weak, alias("bsp_start_default"))); diff --git a/c/src/lib/libbsp/arm/gumstix/startup/linkcmds b/c/src/lib/libbsp/arm/gumstix/startup/linkcmds new file mode 100755 index 0000000000..53f9ccd94d --- /dev/null +++ b/c/src/lib/libbsp/arm/gumstix/startup/linkcmds @@ -0,0 +1,219 @@ +/* + * GUMSTIX linkcmd by Yang Xi . Borrow form CSB337 linkcmd. + * + * 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$ + */ + +OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", + "elf32-littlearm") +OUTPUT_ARCH(arm) +ENTRY(_start) + +MEMORY +{ + sdram : ORIGIN = 0xA0000000, LENGTH = 64M + sram : ORIGIN = 0x00000000, LENGTH = 16K +} + +/* + * Declare some sizes. + */ +_sdram_base = DEFINED(_sdram_base) ? _sdram_base : 0xA0000000; +_sdram_size = DEFINED(_sdram_size) ? _sdram_size : 64M; + +RamBase = _sdram_base; +RamSize = _sdram_size; +HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0; + +_sram_base = DEFINED(_sram_base) ? _sram_base : 0x00000000; +_sram_size = DEFINED(_sram_size) ? _sram_size : 16K; + + + +_irq_stack_size = DEFINED(_irq_stack_size) ? _irq_stack_size : 0x1000; +_fiq_stack_size = DEFINED(_fiq_stack_size) ? _fiq_stack_size : 0x400; +_abt_stack_size = DEFINED(_abt_stack_size) ? _abt_stack_size : 0x100; +_svc_stack_size = DEFINED(_svc_stack_size) ? _svc_stack_size : 0x1000; + + + +/* Do we need any of these for elf? + __DYNAMIC = 0; */ + +SECTIONS +{ + .base : + { + + arm_exception_table = .; + . += 64; + } > sdram + +/* } > sram*/ + + + .init : + { + KEEP (*(.init)) + } > sdram /*=0*/ + + .text : + { + _text_start = .; + CREATE_OBJECT_SYMBOLS + *(.text) + *(.text.*) + + /* + * 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) + *(.gnu.linkonce.t*) + *(.glue_7) + *(.glue_7t) + + /* I think these come from the ld docs: */ + ___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__ = .; + + _etext = .; + PROVIDE (etext = .); + } > sdram + + .fini : + { + KEEP (*(.fini)) + } > sdram /*=0*/ + + .data : + { + *(.data) + *(.data.*) + *(.gnu.linkonce.d*) + *(.jcr) + SORT(CONSTRUCTORS) + _edata = .; + } > sdram + + .eh_frame : { *(.eh_frame) } > sdram + .data1 : { *(.data1) } > sdram + .eh_frame : { *(.eh_frame) } > sdram + .gcc_except_table : { *(.gcc_except_table) } > sdram + + .rodata : + { + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r*) + } > sdram + + .bss : + { + _bss_start_ = .; + _clear_start = .; + *(.bss) + *(.bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + . = ALIGN(64); + _clear_end = .; + + . = ALIGN (256); + _abt_stack = .; + . += _abt_stack_size; + + . = ALIGN (256); + _irq_stack = .; + . += _irq_stack_size; + + . = ALIGN (256); + _fiq_stack = .; + . += _fiq_stack_size; + + . = ALIGN (256); + _svc_stack = .; + . += _svc_stack_size; + + _bss_end_ = .; + _end = .; + __end = .; + +/* + * Ideally, the MMU's translation table would be in SRAM. But we need + * 16K which is the size of SRAM. If we do the mapping right, the TLB + * should be big enough that to hold all the translations that matter, + * so keeping the table in SDRAM won't be a problem. + */ + . = ALIGN (16 * 1024); + _ttbl_base = .; + . += (16 * 1024); + + + . = ALIGN (1024); + _bss_free_start = .; + WorkAreaBase = .; + + } > sdram + + +/* Debugging stuff follows? */ + + /* 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) } +/* .stack 0x80000 : { _stack = .; *(.stack) }*/ + /* These must appear regardless of . */ +} + diff --git a/c/src/lib/libbsp/arm/gumstix/startup/memmap.c b/c/src/lib/libbsp/arm/gumstix/startup/memmap.c new file mode 100755 index 0000000000..cf1921d753 --- /dev/null +++ b/c/src/lib/libbsp/arm/gumstix/startup/memmap.c @@ -0,0 +1,19 @@ +/* + * Gumstix Memory Map + * 2008 By Yang Xi + * Copyright (c) 2004 by Cogent Computer Systems + * Written by Jay Monkman + * + * $Id$ + */ + +#include +#include + +mmu_sect_map_t mem_map[] = { +/* */ + {0x40000000, 0x40000000, 20, MMU_CACHE_NONE}, /*Map I/O*/ + {0xA0000000, 0x00000000, 1, MMU_CACHE_NONE}, /*sram*/ + {0xA0000000, 0xA0000000, 64, MMU_CACHE_WBACK}, /* SDRAM */ + {0x00000000, 0x00000000, 0, 0} /* The end */ +}; -- cgit v1.2.3