forked from Imagelibrary/rtems
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.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,10 +106,21 @@ leon_greth_rel_CPPFLAGS += -D__INSIDE_RTEMS_BSD_TCPIP_STACK__
|
||||
leon_greth_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
|
||||
endif
|
||||
|
||||
if HAS_MP
|
||||
EXTRA_DIST += shmsupp/README
|
||||
shmsupp_SOURCES = shmsupp/addrconv.c shmsupp/getcfg.c shmsupp/lock.c \
|
||||
shmsupp/mpisr.c
|
||||
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
|
||||
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_NETWORKING
|
||||
libbsp_a_LIBADD += leon_open_eth.rel
|
||||
@@ -151,24 +128,6 @@ 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/mpisr.c
|
||||
shmsupp_rel_CPPFLAGS = $(AM_CPPFLAGS)
|
||||
shmsupp_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
|
||||
endif
|
||||
|
||||
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
|
||||
endif
|
||||
|
||||
EXTRA_DIST += times
|
||||
|
||||
include $(srcdir)/preinstall.am
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user