forked from Imagelibrary/rtems
Changed bsp_get_workarea() to bsp_get_work_area() and
added support for an optional separate heap area.
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
2008-07-24 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* Makefile.am: Install shared/include/bootcard.h.
|
||||
|
||||
2008-01-16 Ralf Corsepius <ralf.corsepius@rtems.org>
|
||||
|
||||
* Makefile.am: Fix indentation.
|
||||
|
||||
@@ -32,5 +32,9 @@ EXTRA_DIST += shared/vmeUniverse/vmeUniverse.c \
|
||||
EXTRA_DIST += shared/include/coverhd.h
|
||||
EXTRA_DIST += shared/gdbstub/rtems-stub-glue.c
|
||||
|
||||
include_bspdir = $(includedir)/bsp
|
||||
include_bsp_HEADERS = shared/include/bootcard.h
|
||||
|
||||
include $(srcdir)/preinstall.am
|
||||
include $(top_srcdir)/automake/subdirs.am
|
||||
include $(top_srcdir)/automake/local.am
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2008-07-24 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* startup/start.c: Changed bsp_get_workarea() to bsp_get_work_area() and
|
||||
added support for an optional separate heap area.
|
||||
|
||||
2008-05-20 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* Makefile.am, configure.ac, startup/start.c: Use new framework
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
|
||||
#include <bsp.h>
|
||||
#include <bsp/bootcard.h>
|
||||
#include <nds.h>
|
||||
|
||||
/*
|
||||
@@ -24,18 +25,20 @@ extern unsigned int arm_cpu_mode;
|
||||
* 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
|
||||
void bsp_get_work_area(
|
||||
void **work_area_start,
|
||||
size_t *work_area_size,
|
||||
void **heap_start,
|
||||
size_t *heap_size
|
||||
)
|
||||
{
|
||||
extern uint8_t _end;
|
||||
extern uint8_t __ewram_end;
|
||||
|
||||
*workarea_base = &_end;
|
||||
*workarea_size = (void *)&__ewram_end - (void *)&_end;
|
||||
*requested_heap_size = 0;
|
||||
*work_area_start = &_end;
|
||||
*work_area_size = (void *)&__ewram_end - (void *)&_end;
|
||||
*heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA;
|
||||
*heap_size = BSP_BOOTCARD_HEAP_SIZE_DEFAULT;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
2008-07-24 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* shared/m68kbspgetworkarea.c: Changed bsp_get_workarea() to
|
||||
bsp_get_work_area() and added support for an optional separate heap
|
||||
area.
|
||||
|
||||
2008-07-16 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* acinclude.m4: Regeneration to add new BSPs.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* This routine is an implementation of the bsp_get_workarea()
|
||||
* This routine is an implementation of the bsp_get_work_area()
|
||||
* that can be used by all m68k BSPs following linkcmds conventions
|
||||
* regarding heap, stack, and workspace allocation.
|
||||
*
|
||||
@@ -14,16 +14,18 @@
|
||||
*/
|
||||
|
||||
#include <bsp.h>
|
||||
#include <bsp/bootcard.h>
|
||||
|
||||
/*
|
||||
* 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
|
||||
void bsp_get_work_area(
|
||||
void **work_area_start,
|
||||
size_t *work_area_size,
|
||||
void **heap_start,
|
||||
size_t *heap_size
|
||||
)
|
||||
{
|
||||
extern char _RamBase[];
|
||||
@@ -31,8 +33,9 @@ void bsp_get_workarea(
|
||||
extern char _HeapSize[];
|
||||
extern char _RamSize[];
|
||||
|
||||
*workarea_base = _WorkspaceBase;
|
||||
*workarea_size = (unsigned long)_RamBase + (unsigned long) _RamSize -
|
||||
*work_area_start = _WorkspaceBase;
|
||||
*work_area_size = (unsigned long)_RamBase + (unsigned long) _RamSize -
|
||||
(unsigned long)_WorkspaceBase;
|
||||
*requested_heap_size = (size_t) _HeapSize;
|
||||
*heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA;
|
||||
*heap_size = (size_t) _HeapSize;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
2008-07-24 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* startup/bspstart.c: Changed bsp_get_workarea() to
|
||||
bsp_get_work_area() and added support for an optional separate heap
|
||||
area.
|
||||
|
||||
2008-05-15 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
* configure.ac, startup/bspstart.c: Add capability for bootcard.c BSP
|
||||
|
||||
@@ -15,24 +15,27 @@
|
||||
*/
|
||||
|
||||
#include <bsp.h>
|
||||
#include <bsp/bootcard.h>
|
||||
|
||||
/*
|
||||
* 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
|
||||
void bsp_get_work_area(
|
||||
void **work_area_start,
|
||||
size_t *work_area_size,
|
||||
void **heap_start,
|
||||
size_t *heap_size
|
||||
)
|
||||
{
|
||||
extern int WorkspaceBase;
|
||||
extern int end;
|
||||
|
||||
*workarea_base = &WorkspaceBase;
|
||||
*workarea_size = (void *)&end - (void *)&WorkspaceBase;
|
||||
*requested_heap_size = 0;
|
||||
*work_area_start = &WorkspaceBase;
|
||||
*work_area_size = (void *)&end - (void *)&WorkspaceBase;
|
||||
*heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA;
|
||||
*heap_size = BSP_BOOTCARD_HEAP_SIZE_DEFAULT;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2008-07-24 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* configure.ac, include/bsp.h, startup/bspstart.c,
|
||||
startup/linkcmds.base: Support RAM allocation via bootcard.
|
||||
|
||||
2008-07-18 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* startup/bspstart.c: Enable cache after CPU initialization. Clear
|
||||
|
||||
@@ -31,6 +31,8 @@ AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")
|
||||
# Explicitly list all Makefiles here
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
|
||||
RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION
|
||||
|
||||
RTEMS_PPC_EXCEPTIONS
|
||||
|
||||
AC_OUTPUT
|
||||
|
||||
@@ -65,9 +65,8 @@ LINKER_SYMBOL( bsp_section_bss_size);
|
||||
LINKER_SYMBOL( bsp_interrupt_stack_start);
|
||||
LINKER_SYMBOL( bsp_interrupt_stack_end);
|
||||
LINKER_SYMBOL( bsp_interrupt_stack_size);
|
||||
LINKER_SYMBOL( bsp_interrupt_stack_pointer);
|
||||
|
||||
LINKER_SYMBOL( bsp_workspace_start);
|
||||
LINKER_SYMBOL( bsp_work_area_start);
|
||||
|
||||
LINKER_SYMBOL( IMMRBAR);
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <libcpu/powerpc-utility.h>
|
||||
|
||||
#include <bsp.h>
|
||||
#include <bsp/bootcard.h>
|
||||
#include <bsp/irq-generic.h>
|
||||
#include <bsp/ppc_exc_bspsupp.h>
|
||||
|
||||
@@ -51,8 +52,6 @@ unsigned int BSP_bus_frequency;
|
||||
/* Configuration parameters for clock driver, ... */
|
||||
uint32_t bsp_clicks_per_usec;
|
||||
|
||||
static char *BSP_heap_start, *BSP_heap_end;
|
||||
|
||||
/*
|
||||
* Use the shared implementations of the following routines.
|
||||
* Look in rtems/c/src/lib/libbsp/shared/bsplibc.c.
|
||||
@@ -87,8 +86,21 @@ void _BSP_Fatal_error( unsigned n)
|
||||
|
||||
void bsp_pretasking_hook( void)
|
||||
{
|
||||
/* Initialize libc including the heap */
|
||||
bsp_libc_init( BSP_heap_start, BSP_heap_end - BSP_heap_start, 0);
|
||||
/* Do noting */
|
||||
}
|
||||
|
||||
void bsp_get_work_area( void **work_area_start, size_t *work_area_size, void **heap_start, size_t *heap_size)
|
||||
{
|
||||
#ifdef HAS_UBOOT
|
||||
char *ram_end = (char *) mpc83xx_uboot_board_info.bi_memstart + mpc83xx_uboot_board_info.bi_memsize;
|
||||
#else /* HAS_UBOOT */
|
||||
char *ram_end = bsp_ram_end;
|
||||
#endif /* HAS_UBOOT */
|
||||
|
||||
*work_area_start = bsp_work_area_start;
|
||||
*work_area_size = ram_end - bsp_work_area_start;
|
||||
*heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA;
|
||||
*heap_size = BSP_BOOTCARD_HEAP_SIZE_DEFAULT;
|
||||
}
|
||||
|
||||
void bsp_start( void)
|
||||
@@ -99,8 +111,6 @@ void bsp_start( void)
|
||||
uint32_t interrupt_stack_start = (uint32_t) bsp_interrupt_stack_start;
|
||||
uint32_t interrupt_stack_size = (uint32_t) bsp_interrupt_stack_size;
|
||||
|
||||
size_t workspace_size = rtems_configuration_get_work_space_size();
|
||||
|
||||
/*
|
||||
* Get CPU identification dynamically. Note that the get_ppc_cpu_type() function
|
||||
* store the result in global variables so that it can be used latter...
|
||||
@@ -123,21 +133,6 @@ void bsp_start( void)
|
||||
rtems_cache_enable_data();
|
||||
#endif
|
||||
|
||||
/* Clear the workspace */
|
||||
Configuration.do_zero_of_workspace = 0;
|
||||
mpc83xx_zero_4( bsp_workspace_start, workspace_size);
|
||||
|
||||
/* Workspace start */
|
||||
Configuration.work_space_start = bsp_workspace_start;
|
||||
|
||||
/* Heap area */
|
||||
BSP_heap_start = (char *) Configuration.work_space_start + workspace_size;
|
||||
#ifdef HAS_UBOOT
|
||||
BSP_heap_end = mpc83xx_uboot_board_info.bi_memstart + mpc83xx_uboot_board_info.bi_memsize;
|
||||
#else /* HAS_UBOOT */
|
||||
BSP_heap_end = bsp_ram_end;
|
||||
#endif /* HAS_UBOOT */
|
||||
|
||||
/*
|
||||
* This is evaluated during runtime, so it should be ok to set it
|
||||
* before we initialize the drivers.
|
||||
|
||||
@@ -268,13 +268,12 @@ SECTIONS {
|
||||
bsp_interrupt_stack_start = .;
|
||||
bsp_interrupt_stack_end = bsp_interrupt_stack_start + 32k;
|
||||
bsp_interrupt_stack_size = bsp_interrupt_stack_end - bsp_interrupt_stack_start;
|
||||
bsp_interrupt_stack_pointer = bsp_interrupt_stack_end - 16;
|
||||
. = bsp_interrupt_stack_end;
|
||||
|
||||
/*
|
||||
* BSP: Workspace start
|
||||
* BSP: Work area start
|
||||
*/
|
||||
bsp_workspace_start = .;
|
||||
bsp_work_area_start = .;
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2008-07-24 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* configure.ac, startup/bspstart.c: Support RAM allocation via
|
||||
bootcard.
|
||||
|
||||
2008-07-17 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* configure.ac: Remove RTEMS_AMPOLISH3.
|
||||
|
||||
@@ -47,6 +47,8 @@ RTEMS_BSPOPTS_HELP([PRINTK_MINOR],
|
||||
AC_CONFIG_FILES([Makefile
|
||||
include/bspopts.h])
|
||||
|
||||
RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION
|
||||
|
||||
RTEMS_PPC_EXCEPTIONS
|
||||
|
||||
AC_OUTPUT
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <libcpu/powerpc-utility.h>
|
||||
|
||||
#include <bsp.h>
|
||||
#include <bsp/bootcard.h>
|
||||
#include <bsp/irq.h>
|
||||
#include <bsp/irq-generic.h>
|
||||
#include <bsp/ppc_exc_bspsupp.h>
|
||||
@@ -78,20 +79,19 @@ void _BSP_Fatal_error( unsigned n)
|
||||
}
|
||||
}
|
||||
|
||||
void bsp_get_work_area( void **work_area_start, size_t *work_area_size, void **heap_start, size_t *heap_size)
|
||||
{
|
||||
*work_area_start = bsp_section_bss_end;
|
||||
*work_area_size = bsp_ram_end - 2 * MPC55XX_INTERRUPT_STACK_SIZE - bsp_section_bss_end;
|
||||
*heap_start = bsp_external_ram_start;
|
||||
*heap_size = (size_t) bsp_external_ram_size;
|
||||
}
|
||||
|
||||
void bsp_pretasking_hook()
|
||||
{
|
||||
uint32_t heap_start = bsp_external_ram_start;
|
||||
uint32_t heap_size = bsp_external_ram_size;
|
||||
|
||||
bsp_libc_init( heap_start, heap_size, 0);
|
||||
|
||||
#ifdef STACK_CHECKER_ON
|
||||
Stack_check_Initialize();
|
||||
#endif
|
||||
|
||||
#ifdef RTEMS_DEBUG
|
||||
rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
|
||||
#endif
|
||||
}
|
||||
|
||||
void bsp_predriver_hook()
|
||||
@@ -167,12 +167,8 @@ void bsp_start(void)
|
||||
ppc_cpu_id_t myCpu;
|
||||
ppc_cpu_revision_t myCpuRevision;
|
||||
|
||||
uint32_t ram_start = bsp_ram_start;
|
||||
uint32_t ram_end = bsp_ram_end;
|
||||
uint32_t interrupt_stack_start = ram_end - 2 * MPC55XX_INTERRUPT_STACK_SIZE;
|
||||
uint32_t interrupt_stack_start = bsp_ram_end - 2 * MPC55XX_INTERRUPT_STACK_SIZE;
|
||||
uint32_t interrupt_stack_size = MPC55XX_INTERRUPT_STACK_SIZE;
|
||||
uint32_t work_space_start = bsp_section_bss_end;
|
||||
uint32_t work_space_end = work_space_start + rtems_configuration_get_work_space_size();
|
||||
|
||||
/* ESCI pad configuration */
|
||||
SIU.PCR [89].R = 0x400;
|
||||
@@ -180,25 +176,14 @@ void bsp_start(void)
|
||||
|
||||
DEBUG_PRINT( "BSP start ...\n");
|
||||
|
||||
/* Memory layout */
|
||||
|
||||
Configuration.work_space_start = work_space_start;
|
||||
|
||||
DEBUG_PRINT( "System clock : %i\n", mpc55xx_get_system_clock());
|
||||
DEBUG_PRINT( "Memory start : 0x%08x\n", ram_start);
|
||||
DEBUG_PRINT( "Memory end : 0x%08x\n", ram_end);
|
||||
DEBUG_PRINT( "Memory size : 0x%08x\n", ram_end - ram_start);
|
||||
DEBUG_PRINT( "Work space start : 0x%08x\n", work_space_start);
|
||||
DEBUG_PRINT( "Work space end : 0x%08x\n", work_space_end);
|
||||
DEBUG_PRINT( "Work space size : 0x%08x\n", work_space_end - work_space_start);
|
||||
DEBUG_PRINT( "Memory start : 0x%08x\n", bsp_ram_start);
|
||||
DEBUG_PRINT( "Memory end : 0x%08x\n", bsp_ram_end);
|
||||
DEBUG_PRINT( "Memory size : 0x%08x\n", bsp_ram_end - bsp_ram_start);
|
||||
DEBUG_PRINT( "Interrupt stack start : 0x%08x\n", interrupt_stack_start);
|
||||
DEBUG_PRINT( "Interrupt stack end : 0x%08x\n", interrupt_stack_start + interrupt_stack_size);
|
||||
DEBUG_PRINT( "Interrupt stack size : 0x%08x\n", interrupt_stack_size);
|
||||
|
||||
if (work_space_end > interrupt_stack_start) {
|
||||
BSP_panic( "Not enough memory for the work space");
|
||||
}
|
||||
|
||||
/*
|
||||
* Get CPU identification dynamically. Note that the get_ppc_cpu_type()
|
||||
* function store the result in global variables so that it can be used
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
2008-07-24 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* startup/bspstart.c: Changed bsp_get_workarea() to
|
||||
bsp_get_work_area() and added support for an optional separate heap
|
||||
area.
|
||||
|
||||
2008-07-18 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* startup/bspstart.c: This BSP is OK with SPRG0.
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <bsp.h>
|
||||
#include <bsp/irq.h>
|
||||
#include <bsp/bootcard.h>
|
||||
#include <rtems/libio.h>
|
||||
#include <rtems/libcsupport.h>
|
||||
#include <rtems/bspIo.h>
|
||||
@@ -70,15 +71,17 @@ void _BSP_Fatal_error(unsigned int v)
|
||||
* 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
|
||||
void bsp_get_work_area(
|
||||
void **work_area_start,
|
||||
size_t *work_area_size,
|
||||
void **heap_start,
|
||||
size_t *heap_size
|
||||
)
|
||||
{
|
||||
*workarea_base = &end;
|
||||
*workarea_size = (void *)&RAM_END - (void *)&end;
|
||||
*requested_heap_size = 0;
|
||||
*work_area_start = &end;
|
||||
*work_area_size = (void *)&RAM_END - (void *)&end;
|
||||
*heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA;
|
||||
*heap_size = BSP_BOOTCARD_HEAP_SIZE_DEFAULT;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
2008-07-24 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* include/bootcard.h: New file.
|
||||
|
||||
* bootcard.c: Changed bsp_get_workarea() to bsp_get_work_area() and
|
||||
added support for an optional separate heap area.
|
||||
|
||||
* bsppretaskinghook.c: Cleanup. Include bootcard.h.
|
||||
|
||||
* include/irq-generic.h, src/irq-generic.c, src/irq-legacy.c: Support
|
||||
for new rtems_interrupt_handler_iterate() function.
|
||||
|
||||
|
||||
@@ -43,57 +43,51 @@
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <rtems.h>
|
||||
|
||||
#include <bspopts.h> /* for BSP_BOOTCARD_HANDLES_RAM_ALLOCATION */
|
||||
#include <bsp/bootcard.h>
|
||||
|
||||
/*
|
||||
* Since there is a forward reference
|
||||
*/
|
||||
char *rtems_progname;
|
||||
|
||||
/*
|
||||
* Prototypes of external routines
|
||||
*/
|
||||
extern void bsp_start( void );
|
||||
extern void bsp_cleanup( void );
|
||||
extern void bsp_pretasking_hook(void);
|
||||
extern void bsp_libc_init( void *, uint32_t, int );
|
||||
extern void bsp_predriver_hook(void);
|
||||
extern void bsp_postdriver_hook(void);
|
||||
|
||||
/*
|
||||
* These are the prototypes and helper routines which are used
|
||||
* when the BSP lets the framework handle RAM allocation between
|
||||
* the RTEMS Workspace and C Program Heap.
|
||||
*/
|
||||
#if defined(BSP_BOOTCARD_HANDLES_RAM_ALLOCATION)
|
||||
extern void bsp_get_workarea( void **, size_t *, size_t *);
|
||||
|
||||
void bootcard_bsp_libc_helper(
|
||||
void *workarea_base,
|
||||
size_t workarea_size,
|
||||
size_t requested_heap_size
|
||||
static void bootcard_bsp_libc_helper(
|
||||
void *work_area_start,
|
||||
size_t work_area_size,
|
||||
void *heap_start,
|
||||
size_t heap_size
|
||||
)
|
||||
{
|
||||
uint32_t heap_start;
|
||||
uint32_t heap_size;
|
||||
if (heap_start == BSP_BOOTCARD_HEAP_USES_WORK_AREA) {
|
||||
/* Use the work area start as heap start */
|
||||
heap_start = work_area_start;
|
||||
|
||||
heap_start = (uint32_t) workarea_base;
|
||||
if (heap_start & (CPU_ALIGNMENT-1))
|
||||
heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
|
||||
|
||||
if ( requested_heap_size == 0 ) {
|
||||
heap_size = Configuration.work_space_start - workarea_base;
|
||||
heap_size &= 0xfffffff0; /* keep it as a multiple of 16 bytes */
|
||||
} else {
|
||||
heap_size = requested_heap_size;
|
||||
/* Ensure proper alignement */
|
||||
if ((uintptr_t) heap_start & (CPU_ALIGNMENT - 1)) {
|
||||
heap_start = (void *) (((uintptr_t) heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT - 1));
|
||||
}
|
||||
|
||||
bsp_libc_init((void *) heap_start, heap_size, 0);
|
||||
/*
|
||||
* Use the free space from the start of the work area up to the work
|
||||
* space start as heap area.
|
||||
*/
|
||||
if (heap_size == BSP_BOOTCARD_HEAP_SIZE_DEFAULT) {
|
||||
heap_size = (char *) Configuration.work_space_start
|
||||
- (char *) work_area_start;
|
||||
|
||||
/* Keep it as a multiple of 16 bytes */
|
||||
heap_size &= 0xfffffff0;
|
||||
}
|
||||
}
|
||||
|
||||
bsp_libc_init( heap_start, (uint32_t) heap_size, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -115,9 +109,10 @@ int boot_card(
|
||||
char **envp_p = &envp_pointer;
|
||||
rtems_interrupt_level bsp_isr_level;
|
||||
#if defined(BSP_BOOTCARD_HANDLES_RAM_ALLOCATION)
|
||||
void *workarea_base;
|
||||
size_t workarea_size;
|
||||
size_t heap_size;
|
||||
void *work_area_start = NULL;
|
||||
size_t work_area_size = 0;
|
||||
void *heap_start = NULL;
|
||||
size_t heap_size = 0;
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -156,14 +151,19 @@ int boot_card(
|
||||
*/
|
||||
#if defined(BSP_BOOTCARD_HANDLES_RAM_ALLOCATION)
|
||||
{
|
||||
unsigned char *work_space_start;
|
||||
void *work_space_start = NULL;
|
||||
|
||||
bsp_get_workarea( &workarea_base, &workarea_size, &heap_size );
|
||||
bsp_get_work_area(
|
||||
&work_area_start,
|
||||
&work_area_size,
|
||||
&heap_start,
|
||||
&heap_size
|
||||
);
|
||||
|
||||
work_space_start = workarea_base + workarea_size
|
||||
work_space_start = (char *) work_area_start + work_area_size
|
||||
- rtems_configuration_get_work_space_size();
|
||||
|
||||
if ( work_space_start <= (unsigned char *)workarea_base ) {
|
||||
if ((uintptr_t) work_space_start <= (uintptr_t) work_area_start) {
|
||||
printk( "bootcard: Not enough RAM!!!\n" );
|
||||
bsp_cleanup();
|
||||
return -1;
|
||||
@@ -172,7 +172,7 @@ int boot_card(
|
||||
Configuration.work_space_start = work_space_start;
|
||||
|
||||
#if (BSP_DIRTY_MEMORY == 1)
|
||||
memset(workarea_base, 0xCF, workarea_size);
|
||||
memset( work_area_start, 0xCF, work_area_size);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -193,7 +193,12 @@ int boot_card(
|
||||
* framework.
|
||||
*/
|
||||
#if defined(BSP_BOOTCARD_HANDLES_RAM_ALLOCATION)
|
||||
bootcard_bsp_libc_helper( workarea_base, workarea_size, heap_size );
|
||||
bootcard_bsp_libc_helper(
|
||||
work_area_start,
|
||||
work_area_size,
|
||||
heap_start,
|
||||
heap_size
|
||||
);
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This is a shared BSP pretasking hook which does nothing.
|
||||
* If all the BSP needs to do is initialize the C library,
|
||||
* then it can rely on bootcard.c and provide bsp_get_workarea().
|
||||
* then it can rely on bootcard.c and provide bsp_get_work_area().
|
||||
*
|
||||
* COPYRIGHT (c) 1989-2008.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
@@ -13,10 +13,9 @@
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/libio.h>
|
||||
#include <fcntl.h>
|
||||
#include <bsp/bootcard.h>
|
||||
|
||||
void bsp_pretasking_hook(void)
|
||||
{
|
||||
/* Do nothing */
|
||||
}
|
||||
|
||||
75
c/src/lib/libbsp/shared/include/bootcard.h
Normal file
75
c/src/lib/libbsp/shared/include/bootcard.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @ingroup bsp_shared
|
||||
*
|
||||
* @brief Header file for basic BSP startup functions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008
|
||||
* Embedded Brains GmbH
|
||||
* Obere Lagerstr. 30
|
||||
* D-82178 Puchheim
|
||||
* Germany
|
||||
* rtems@embedded-brains.de
|
||||
*
|
||||
* 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$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup bsp_shared Shared BSP Code
|
||||
*/
|
||||
|
||||
#ifndef LIBBSP_SHARED_BOOTCARD_H
|
||||
#define LIBBSP_SHARED_BOOTCARD_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <bspopts.h> /* for BSP_BOOTCARD_HANDLES_RAM_ALLOCATION */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void bsp_start( void);
|
||||
|
||||
void bsp_pretasking_hook( void);
|
||||
|
||||
void bsp_predriver_hook( void);
|
||||
|
||||
void bsp_postdriver_hook( void);
|
||||
|
||||
void bsp_cleanup( void);
|
||||
|
||||
#ifdef BSP_BOOTCARD_HANDLES_RAM_ALLOCATION
|
||||
#define BSP_BOOTCARD_HEAP_USES_WORK_AREA NULL
|
||||
|
||||
#define BSP_BOOTCARD_HEAP_SIZE_DEFAULT 0
|
||||
|
||||
void bsp_get_work_area(
|
||||
void **work_area_start,
|
||||
size_t *work_area_size,
|
||||
void **heap_start,
|
||||
size_t *heap_size
|
||||
);
|
||||
#endif
|
||||
|
||||
int boot_card( int argc, char **argv, char **envp);
|
||||
|
||||
/*
|
||||
* FIXME: Nearly every BSP declares this function in the BSP startup file
|
||||
* separately and uses the implementation in bsplibc.c.
|
||||
* Why differ the parameter types from RTEMS_Malloc_Initialize()?
|
||||
*/
|
||||
void bsp_libc_init( void *heap_start, uint32_t heap_size, int use_sbrk);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* LIBBSP_SHARED_BOOTCARD_H */
|
||||
@@ -1,3 +1,9 @@
|
||||
2008-07-24 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* shared/startup/bspstart.c: Changed bsp_get_workarea() to
|
||||
bsp_get_work_area() and added support for an optional separate heap
|
||||
area.
|
||||
|
||||
2008-05-15 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
* shared/bspstart.c, shared/start.S: Add capability for bootcard.c BSP
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
2008-07-24 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* startup/bspstart.c: Changed bsp_get_workarea() to
|
||||
bsp_get_work_area() and added support for an optional separate heap
|
||||
area.
|
||||
|
||||
2008-05-15 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
* Makefile.am, configure.ac, startup/bspstart.c: Add capability for
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <bsp.h>
|
||||
#include <bsp/bootcard.h>
|
||||
#include <rtems/bspIo.h>
|
||||
|
||||
/*
|
||||
@@ -74,10 +75,11 @@ void bsp_pretasking_hook(void)
|
||||
* 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
|
||||
void bsp_get_work_area(
|
||||
void **work_area_start,
|
||||
size_t *work_area_size,
|
||||
void **heap_start,
|
||||
size_t *heap_size
|
||||
)
|
||||
{
|
||||
/* Tells us where to put the workspace in case remote debugger is present. */
|
||||
@@ -85,9 +87,10 @@ void bsp_get_workarea(
|
||||
/* 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;
|
||||
*work_area_start = &end;
|
||||
*work_area_size = (void *)rdb_start - (void *)&end - STACK_SIZE;
|
||||
*heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA;
|
||||
*heap_size = BSP_BOOTCARD_HEAP_SIZE_DEFAULT;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <bsp.h>
|
||||
#include <bsp/bootcard.h>
|
||||
#include <rtems/libio.h>
|
||||
#include <rtems/libcsupport.h>
|
||||
#include <rtems/bspIo.h>
|
||||
@@ -65,10 +66,11 @@ void bsp_pretasking_hook(void)
|
||||
* 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
|
||||
void bsp_get_work_area(
|
||||
void **work_area_start,
|
||||
size_t *work_area_size,
|
||||
void **heap_start,
|
||||
size_t *heap_size
|
||||
)
|
||||
{
|
||||
/* Tells us where to put the workspace in case remote debugger is present. */
|
||||
@@ -76,9 +78,10 @@ void bsp_get_workarea(
|
||||
/* 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;
|
||||
*work_area_start = &end;
|
||||
*work_area_size = (void *)rdb_start - (void *)&end - STACK_SIZE;
|
||||
*heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA;
|
||||
*heap_size = BSP_BOOTCARD_HEAP_SIZE_DEFAULT;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user