summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/sparc
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-05-15 15:54:15 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-05-15 15:54:15 +0000
commit4c94ffff2c016186c24911def5951445c9273c59 (patch)
treec6ffa6f7bf79fd35acd6d26286a6bde9fa6154cc /c/src/lib/libbsp/sparc
parent2008-05-15 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-4c94ffff2c016186c24911def5951445c9273c59.tar.bz2
2008-05-15 Joel Sherrill <joel.sherrill@OARcorp.com>
* Makefile.am, configure.ac, startup/bspstart.c: Add capability for bootcard.c BSP Initialization Framework to ask the BSP where it has memory for the RTEMS Workspace and C Program Heap. These collectively are referred to as work area. If the BSP supports this, then it does not have to include code to split the available memory between the two areas. This reduces the amount of code in the BSP specific bspstart.c file. Additionally, the shared framework can initialize the C Library, call rtems_debug_enable(), and dirty the work area memory. Until most/all BSPs support this new capability, if the BSP supports this, it should call RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION from its configure.ac. When the transition is complete, this autoconf macro can be removed.
Diffstat (limited to 'c/src/lib/libbsp/sparc')
-rw-r--r--c/src/lib/libbsp/sparc/leon3/ChangeLog15
-rw-r--r--c/src/lib/libbsp/sparc/leon3/Makefile.am117
-rw-r--r--c/src/lib/libbsp/sparc/leon3/configure.ac2
-rw-r--r--c/src/lib/libbsp/sparc/leon3/startup/bspstart.c68
4 files changed, 84 insertions, 118 deletions
diff --git a/c/src/lib/libbsp/sparc/leon3/ChangeLog b/c/src/lib/libbsp/sparc/leon3/ChangeLog
index afdeda8d10..7eb52c2a07 100644
--- a/c/src/lib/libbsp/sparc/leon3/ChangeLog
+++ b/c/src/lib/libbsp/sparc/leon3/ChangeLog
@@ -1,3 +1,18 @@
+2008-05-15 Joel Sherrill <joel.sherrill@OARcorp.com>
+
+ * Makefile.am, configure.ac, startup/bspstart.c: Add capability for
+ bootcard.c BSP Initialization Framework to ask the BSP where it has
+ memory for the RTEMS Workspace and C Program Heap. These collectively
+ are referred to as work area. If the BSP supports this, then it does
+ not have to include code to split the available memory between the
+ two areas. This reduces the amount of code in the BSP specific
+ bspstart.c file. Additionally, the shared framework can initialize
+ the C Library, call rtems_debug_enable(), and dirty the work area
+ memory. Until most/all BSPs support this new capability, if the BSP
+ supports this, it should call
+ RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION from its configure.ac. When
+ the transition is complete, this autoconf macro can be removed.
+
2008-05-12 Joel Sherrill <joel.sherrill@OARcorp.com>
* startup/bspstart.c: Refactored and renamed initialization routines to
diff --git a/c/src/lib/libbsp/sparc/leon3/Makefile.am b/c/src/lib/libbsp/sparc/leon3/Makefile.am
index a006684dff..3e74513d45 100644
--- a/c/src/lib/libbsp/sparc/leon3/Makefile.am
+++ b/c/src/lib/libbsp/sparc/leon3/Makefile.am
@@ -33,83 +33,54 @@ project_lib_DATA = start.$(OBJEXT)
dist_project_lib_DATA += startup/linkcmds
-noinst_PROGRAMS += startup.rel
-startup_rel_SOURCES = ../../sparc/shared/bspclean.c ../../shared/bsplibc.c \
+startup_SOURCES = ../../sparc/shared/bspclean.c ../../shared/bsplibc.c \
../../shared/bsppost.c startup/bspstart.c \
../../shared/bootcard.c ../../shared/sbrk.c startup/setvec.c \
startup/spurious.c startup/ithread.S
-startup_rel_CPPFLAGS = $(AM_CPPFLAGS)
-startup_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-noinst_PROGRAMS += gnatsupp.rel
-gnatsupp_rel_SOURCES = gnatsupp/gnatsupp.c ../../sparc/shared/gnatcommon.c
-gnatsupp_rel_CPPFLAGS = $(AM_CPPFLAGS)
-gnatsupp_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+gnatsupp_SOURCES = gnatsupp/gnatsupp.c ../../sparc/shared/gnatcommon.c
include_HEADERS += include/amba.h
include_HEADERS += ../../sparc/shared/include/ambapp.h
-noinst_PROGRAMS += amba.rel
-amba_rel_SOURCES = amba/amba.c ../../sparc/shared/amba/ambapp.c
-amba_rel_CPPFLAGS = $(AM_CPPFLAGS)
-amba_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-
-noinst_PROGRAMS += console.rel
-console_rel_SOURCES = console/console.c
-console_rel_CPPFLAGS = $(AM_CPPFLAGS)
-console_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-
-noinst_PROGRAMS += debugio.rel
-debugio_rel_SOURCES = console/debugputs.c
-debugio_rel_CPPFLAGS = $(AM_CPPFLAGS)
-debugio_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-
-noinst_PROGRAMS += clock.rel
-clock_rel_SOURCES = clock/ckinit.c
-clock_rel_CPPFLAGS = $(AM_CPPFLAGS)
-clock_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+amba_SOURCES = amba/amba.c ../../sparc/shared/amba/ambapp.c
+console_SOURCES = console/console.c
+debugio_SOURCES = console/debugputs.c
+clock_SOURCES = clock/ckinit.c
# PCI
include_HEADERS += ../../sparc/shared/include/pci.h
-noinst_PROGRAMS += pci.rel
-pci_rel_SOURCES = pci/pci.c ../../sparc/shared/pci/pcifinddevice.c
-pci_rel_CPPFLAGS = $(AM_CPPFLAGS)
-pci_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+pci_SOURCES = pci/pci.c ../../sparc/shared/pci/pcifinddevice.c
# B1553BRM
-include_HEADERS += ../../sparc/shared/include/b1553brm.h ../../sparc/shared/include/b1553brm_pci.h
-noinst_PROGRAMS += brm.rel
-brm_rel_SOURCES = ../../sparc/shared/1553/b1553brm.c ../../sparc/shared/1553/b1553brm_pci.c
-brm_rel_CPPFLAGS = $(AM_CPPFLAGS)
-brm_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+include_HEADERS += ../../sparc/shared/include/b1553brm.h \
+ ../../sparc/shared/include/b1553brm_pci.h
+brm_SOURCES = ../../sparc/shared/1553/b1553brm.c \
+ ../../sparc/shared/1553/b1553brm_pci.c
# CAN
-include_HEADERS += ../../sparc/shared/include/occan.h ../../sparc/shared/include/occan_pci.h ../../sparc/shared/include/grcan.h
-noinst_PROGRAMS += can.rel
-can_rel_SOURCES = ../../sparc/shared/can/occan.c ../../sparc/shared/can/occan_pci.c ../../sparc/shared/can/grcan.c
-can_rel_CPPFLAGS = $(AM_CPPFLAGS)
-can_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+include_HEADERS += ../../sparc/shared/include/occan.h \
+ ../../sparc/shared/include/occan_pci.h ../../sparc/shared/include/grcan.h
+can_SOURCES = ../../sparc/shared/can/occan.c \
+ ../../sparc/shared/can/occan_pci.c ../../sparc/shared/can/grcan.c
# SpaceWire
-include_HEADERS += ../../sparc/shared/include/grspw.h ../../sparc/shared/include/grspw_pci.h
-noinst_PROGRAMS += spw.rel
-spw_rel_SOURCES = ../../sparc/shared/spw/grspw.c ../../sparc/shared/spw/grspw_pci.c
-spw_rel_CPPFLAGS = $(AM_CPPFLAGS)
-spw_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+include_HEADERS += ../../sparc/shared/include/grspw.h \
+ ../../sparc/shared/include/grspw_pci.h
+spw_SOURCES = ../../sparc/shared/spw/grspw.c \
+ ../../sparc/shared/spw/grspw_pci.c
# UART
-include_HEADERS += ../../sparc/shared/include/apbuart.h ../../sparc/shared/include/apbuart_pci.h
-noinst_PROGRAMS += uart.rel
-uart_rel_SOURCES = ../../sparc/shared/uart/apbuart.c ../../sparc/shared/uart/apbuart_pci.c
-uart_rel_CPPFLAGS = $(AM_CPPFLAGS)
-uart_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+include_HEADERS += ../../sparc/shared/include/apbuart.h \
+ ../../sparc/shared/include/apbuart_pci.h
+uart_SOURCES = ../../sparc/shared/uart/apbuart.c \
+ ../../sparc/shared/uart/apbuart_pci.c
# I2CMST
include_HEADERS += ../../sparc/shared/include/i2cmst.h
-noinst_PROGRAMS += i2cmst.rel
-i2cmst_rel_SOURCES = ../../sparc/shared/i2c/i2cmst.c
-i2cmst_rel_CPPFLAGS = $(AM_CPPFLAGS)
-i2cmst_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
+i2cmst_SOURCES = ../../sparc/shared/i2c/i2cmst.c
+
+timer_SOURCES = timer/timer.c
if HAS_NETWORKING
noinst_PROGRAMS += leon_smc91111.rel
@@ -119,11 +90,6 @@ leon_smc91111_rel_CPPFLAGS += -D__INSIDE_RTEMS_BSD_TCPIP_STACK__
leon_smc91111_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
endif
-noinst_PROGRAMS += timer.rel
-timer_rel_SOURCES = timer/timer.c
-timer_rel_CPPFLAGS = $(AM_CPPFLAGS)
-timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
-
if HAS_NETWORKING
noinst_PROGRAMS += leon_open_eth.rel
leon_open_eth_rel_SOURCES = leon_open_eth/leon_open_eth.c
@@ -140,33 +106,26 @@ leon_greth_rel_CPPFLAGS += -D__INSIDE_RTEMS_BSD_TCPIP_STACK__
leon_greth_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
endif
-noinst_LIBRARIES = libbsp.a
-libbsp_a_SOURCES =
-libbsp_a_LIBADD = startup.rel amba.rel console.rel clock.rel debugio.rel \
- timer.rel gnatsupp.rel brm.rel can.rel spw.rel uart.rel pci.rel i2cmst.rel
-
-if HAS_NETWORKING
-libbsp_a_LIBADD += leon_open_eth.rel
-libbsp_a_LIBADD += leon_greth.rel
-libbsp_a_LIBADD += leon_smc91111.rel
-endif
-
if HAS_MP
EXTRA_DIST += shmsupp/README
-
-noinst_PROGRAMS += shmsupp.rel
-shmsupp_rel_SOURCES = shmsupp/addrconv.c shmsupp/getcfg.c shmsupp/lock.c \
+shmsupp_SOURCES = shmsupp/addrconv.c shmsupp/getcfg.c shmsupp/lock.c \
shmsupp/mpisr.c
-shmsupp_rel_CPPFLAGS = $(AM_CPPFLAGS)
-shmsupp_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
endif
-libbsp_a_LIBADD += ../../../libcpu/@RTEMS_CPU@/cache.rel \
+noinst_LIBRARIES = libbsp.a
+libbsp_a_SOURCES = $(startup_SOURCES) $(gnatsupp_SOURCES) $(amba_SOURCES) \
+ $(console_SOURCES) $(debugio_SOURCES) $(clock_SOURCES) $(pci_SOURCES) \
+ $(brm_SOURCES) $(can_SOURCES) $(spw_SOURCES) $(uart_SOURCES) \
+ $(i2cmst_SOURCES) $(timer_SOURCES) $(shmsupp_SOURCES)
+
+libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/cache.rel \
../../../libcpu/@RTEMS_CPU@/reg_win.rel \
../../../libcpu/@RTEMS_CPU@/syscall.rel
-if HAS_MP
-libbsp_a_LIBADD += shmsupp.rel
+if HAS_NETWORKING
+libbsp_a_LIBADD += leon_open_eth.rel
+libbsp_a_LIBADD += leon_greth.rel
+libbsp_a_LIBADD += leon_smc91111.rel
endif
EXTRA_DIST += times
diff --git a/c/src/lib/libbsp/sparc/leon3/configure.ac b/c/src/lib/libbsp/sparc/leon3/configure.ac
index a65de6a0c9..4c94124548 100644
--- a/c/src/lib/libbsp/sparc/leon3/configure.ac
+++ b/c/src/lib/libbsp/sparc/leon3/configure.ac
@@ -37,6 +37,8 @@ RTEMS_BSPOPTS_HELP([SIMSPARC_FAST_IDLE],
time spent in the idle task is minimized. This significantly reduces
the wall time required to execute the RTEMS test suites.])
+RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION
+
# Explicitly list all Makefiles here
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
diff --git a/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c b/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c
index 92ec5affc4..c411c9b3c7 100644
--- a/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c
+++ b/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c
@@ -36,9 +36,6 @@ extern uint32_t rdb_start;
*/
int CPU_SPARC_HAS_SNOOPING;
-void bsp_libc_init( void *, uint32_t, int );
-extern void bsp_spurious_initialize();
-
/*
* set_snooping
*
@@ -50,62 +47,55 @@ extern void bsp_spurious_initialize();
static inline int set_snooping(void)
{
- int tmp;
- asm(" lda [%1] 2, %0 "
- : "=r"(tmp)
- : "r"(0xC)
- );
- return (tmp >> 27) & 1;
+ int tmp;
+ asm(" lda [%1] 2, %0 "
+ : "=r"(tmp)
+ : "r"(0xC)
+ );
+ return (tmp >> 27) & 1;
}
/*
* bsp_pretasking_hook
*
* BSP pretasking hook. Called just before drivers are initialized.
- * Used to setup libc and install any BSP extensions.
+ * Used to setup libc and install any BSP extensions .
*/
void bsp_pretasking_hook(void)
{
- extern int end;
- uint32_t heap_start;
- uint32_t heap_size;
-
- heap_start = (uint32_t) &end;
- if (heap_start & (CPU_ALIGNMENT-1))
- heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
-
- heap_size = Configuration.work_space_start - (void *)&end - STACK_SIZE;
- heap_size &= 0xfffffff0; /* keep it as a multiple of 16 bytes */
-
- bsp_libc_init((void *) heap_start, heap_size, 0);
-
-#ifdef RTEMS_DEBUG
- rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
-#endif
+ extern void bsp_spurious_initialize();
bsp_spurious_initialize();
}
/*
+ * This method returns the base address and size of the area which
+ * is to be allocated between the RTEMS Workspace and the C Program
+ * Heap.
+ */
+void bsp_get_workarea(
+ void **workarea_base,
+ size_t *workarea_size,
+ size_t *requested_heap_size
+)
+{
+ /* Tells us where to put the workspace in case remote debugger is present. */
+ extern uint32_t rdb_start;
+ /* must be identical to STACK_SIZE in start.S */
+ #define STACK_SIZE (16 * 1024)
+
+ *workarea_base = &end;
+ *workarea_size = (void *)rdb_start - (void *)&end - STACK_SIZE;
+ *requested_heap_size = 0;
+}
+
+/*
* bsp_start
*
* This routine does the bulk of the system initialization.
*/
-
void bsp_start( void )
{
- unsigned char *work_space_start;
-
- work_space_start =
- (unsigned char *)rdb_start - rtems_configuration_get_work_space_size();
-
- if ( work_space_start <= (unsigned char *)&end ) {
- printk( "bspstart: Not enough RAM!!!\n" );
- BSP_fatal_return();
- }
-
- Configuration.work_space_start = work_space_start;
-
CPU_SPARC_HAS_SNOOPING = set_snooping();
}