2008-09-15 Joel Sherrill <joel.sherrill@oarcorp.com>

* Makefile.am, configure.ac, include/bsp.h, include/bspopts.h.in,
	startup/bspstart.c, startup/linkcmds: Add use of bsp_get_work_area()
	in its own file and rely on BSP Framework to perform more
	initialization.
	* startup/bspgetworkarea.c: New file.
This commit is contained in:
Joel Sherrill
2008-09-15 22:05:16 +00:00
parent 0f70711148
commit f1359069e0
8 changed files with 67 additions and 88 deletions

View File

@@ -1,3 +1,11 @@
2008-09-15 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, configure.ac, include/bsp.h, include/bspopts.h.in,
startup/bspstart.c, startup/linkcmds: Add use of bsp_get_work_area()
in its own file and rely on BSP Framework to perform more
initialization.
* startup/bspgetworkarea.c: New file.
2008-09-06 Ralf Corsépius <ralf.corsepius@rtems.org>
* startup/bspstart.c: Convert to "bool".

View File

@@ -32,9 +32,10 @@ project_lib_DATA = rtems_crti.$(OBJEXT)
dist_project_lib_DATA += startup/linkcmds
startup_SOURCES = startup/bspclean.c ../../shared/bsplibc.c \
startup_SOURCES = startup/bspclean.c startup/bspgetworkarea.c \
../../shared/bsplibc.c \
../../shared/bsppost.c startup/bspstart.c ../../shared/bootcard.c \
../../shared/bsppredriverhook.c \
../../shared/bsppredriverhook.c ../../shared/bsppretaskinghook.c \
../../shared/sbrk.c startup/setvec.c \
../../shared/gnatinstallhandler.c
dlentry_SOURCES = dlentry/dlentry.S

View File

@@ -41,6 +41,8 @@ RTEMS_BSPOPTS_SET([RTEMS_XPPC_BASE],[*],[.])
RTEMS_BSPOPTS_HELP([RTEMS_XPPC_BASE],[Defines path to Xilinx XPS PPC libraries.])
#RSG End
RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION
# Explicitly list all Makefiles here
AC_CONFIG_FILES([Makefile])

View File

@@ -62,13 +62,6 @@ extern "C" {
#include <bsp/irq.h>
#include <bsp/vectors.h>
/* Constants */
extern uint32_t _HeapSize;
extern uint32_t _heap_start;
extern uint32_t _heap_end;
extern uint32_t _top_of_ram;
/* miscellaneous stuff assumed to exist */
/* Network Defines */

View File

@@ -1,5 +1,13 @@
/* include/bspopts.h.in. Generated from configure.ac by autoheader. */
/* BSP uses shared logic in bootcard.c */
#undef BSP_BOOTCARD_HANDLES_RAM_ALLOCATION
/* If defined, then PSIM will put a non-zero pattern into the RTEMS Workspace
and C program heap. This should assist in finding code that assumes memory
starts set to zero. */
#undef BSP_DIRTY_MEMORY
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT

View File

@@ -0,0 +1,39 @@
/*
* 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 <bsp/bootcard.h>
#include <stdint.h>
extern void *RamBase;
extern void *RamSize;
extern void *WorkSpaceStart;
/*
* 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_work_area(
void **work_area_start,
size_t *work_area_size,
void **heap_start,
size_t *heap_size
)
{
uintptr_t size;
size = (uintptr_t)&RamBase + (uintptr_t)&RamSize
- (uintptr_t)&WorkSpaceStart;
*work_area_start = (void *)&WorkSpaceStart;
*work_area_size = size;
*heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA;
*heap_size = BSP_BOOTCARD_HEAP_SIZE_DEFAULT;
}

View File

@@ -60,8 +60,6 @@
#include <fcntl.h>
#include <bsp.h>
#include <rtems/libio.h>
#include <rtems/libcsupport.h>
#include <bsp/irq.h>
#include <rtems/bspIo.h>
#include <libcpu/cpuIdent.h>
@@ -94,60 +92,16 @@ bool bsp_timer_internal_clock; /* TRUE, when timer runs with CPU clk */
*/
void bsp_XAssertHandler(const char* file, int line);
void bsp_libc_init( void *, uint32_t, int );
void bsp_XAssertHandler(const char* file, int line) {
printf("\n***\n*** XAssert Failed! File: %s, Line: %d\n***\n", file, line);
}
/*
* Function: bsp_pretasking_hook
* Created: 95/03/10
*
* Description:
* BSP pretasking hook. Called just before drivers are initialized.
* Used to setup libc and install any BSP extensions.
*
* NOTES:
* Must not use libc (to do io) from here, since drivers are
* not yet initialized.
*
*/
void bsp_pretasking_hook(void)
{
uint32_t heap_start;
uint32_t heap_size;
uint32_t heap_end;
/* round up from the top of workspace to next 64k boundary, get
* default heapsize from linker script */
heap_start = (((uint32_t)Configuration.work_space_start +
rtems_configuration_get_work_space_size()) + 0x18000) & 0xffff0000;
heap_end = _heap_start + (uint32_t)&_HeapSize;
heap_size = (heap_end - heap_start);
_heap_start = heap_start;
_heap_end = heap_end;
_top_of_ram = heap_end;
bsp_libc_init((void *) heap_start, heap_size, 0); /* 64 * 1024 */
}
/*
* bsp_start
*
* This routine does the bulk of the system initialization.
*/
void bsp_start( void )
{
extern unsigned char IntrStack_start[];
@@ -191,33 +145,6 @@ void bsp_start( void )
* Install our own set of exception vectors
*/
BSP_rtems_irq_mng_init(0);
/*
* Allocate the memory for the RTEMS Work Space. This can come from
* a variety of places: hard coded address, malloc'ed from outside
* RTEMS world (e.g. simulator or primitive memory manager), or (as
* typically done by stock BSPs) by subtracting the required amount
* of work space from the last physical address on the CPU board.
*/
/*
* Need to "allocate" the memory for the RTEMS Workspace and
* tell the RTEMS configuration where it is. This memory is
* not malloc'ed. It is just "pulled from the air".
*/
/* FIME: plan usage of RAM better:
- make top of ram dynamic,
- make rest of ram to heap...
-remove RAM_END from bsp.h, this cannot be valid...
or must be a function call
*/
{
extern int _end;
/* round _end up to next 64k boundary for start of workspace */
Configuration.work_space_start = (void *)((((uint32_t)&_end) + 0xffff) & 0xffff0000);
}
}
void BSP_ask_for_reset(void)

View File

@@ -17,14 +17,14 @@ OUTPUT_ARCH(powerpc)
ENTRY(download_entry)
_HeapSize = DEFINED(_HeapSize) ? _HeapSize : 8M;
RamBase = DEFINED(RamBase) ? RamBase : 0x0;
RamSize = DEFINED(RamSize) ? RamSize : 128M;
MEMORY
{
RAM : ORIGIN = 0, LENGTH = 128M
/*FLASH : ORIGIN = 0xFFE00000, LENGTH = 16M*/
}
{
RAM : ORIGIN = 0, LENGTH = 128M
/*FLASH : ORIGIN = 0xFFE00000, LENGTH = 16M*/
}
SECTIONS
{
.text 0x10000:
@@ -247,6 +247,7 @@ SECTIONS
IntrStack_end = .;
PROVIDE(_end = . );
WorkSpaceStart = .;
.gzipmalloc : {