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

* Makefile.am, startup/bspstart.c: Add use of bsp_get_work_area() in
	its own file and rely on BSP Framework to perform more
	initialization. Remove unnecessary includes of rtems/libio.h and
	rtems/libcsupport.h.
	* startup/bspgetworkarea.c: New file.
This commit is contained in:
Joel Sherrill
2008-09-16 19:06:45 +00:00
parent a196084919
commit e76068d31f
12 changed files with 174 additions and 63 deletions

View File

@@ -1,3 +1,11 @@
2008-09-16 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, startup/bspstart.c: Add use of bsp_get_work_area() in
its own file and rely on BSP Framework to perform more
initialization. Remove unnecessary includes of rtems/libio.h and
rtems/libcsupport.h.
* startup/bspgetworkarea.c: New file.
2008-09-10 Joel Sherrill <joel.sherrill@oarcorp.com>
* include/bsp.h: Review of all bsp_cleanup() implementations. In this

View File

@@ -54,6 +54,7 @@ startup_SOURCES = ../../shared/bsplibc.c \
startup/cpuinit.c \
startup/bspstart.c \
startup/bspclean.c \
startup/bspgetworkarea.c \
startup/uboot_support.c \
../shared/uboot_getenv.c

View File

@@ -0,0 +1,47 @@
/**
* @file
*
* @ingroup mpc83xx
*
* @brief Source for BSP startup code.
*/
/*
* 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$
*/
#include <bsp.h>
#include <bsp/bootcard.h>
#ifdef HAS_UBOOT
extern bd_t mpc83xx_uboot_board_info;
#endif /* HAS_UBOOT */
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;
}

View File

@@ -20,12 +20,6 @@
* $Id$
*/
#include <string.h>
#include <rtems/libio.h>
#include <rtems/libcsupport.h>
#include <rtems/score/thread.h>
#include <libcpu/powerpc-utility.h>
#include <libcpu/raw_exception.h>
@@ -87,25 +81,6 @@ 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)
{
#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)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;

View File

@@ -1,3 +1,11 @@
2008-09-16 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, startup/bspstart.c: Add use of bsp_get_work_area() in
its own file and rely on BSP Framework to perform more
initialization. Remove unnecessary includes of rtems/libio.h and
rtems/libcsupport.h.
* startup/bspgetworkarea.c: New file.
2008-09-10 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am: Review of all bsp_cleanup() implementations. In this

View File

@@ -42,7 +42,7 @@ include_bsp_HEADERS = include/mpc55xxevb.h \
startup_SOURCES = ../../shared/bsplibc.c ../../shared/bsppost.c \
../../shared/bootcard.c ../shared/src/tictac.c ../../shared/bspclean.c \
startup/bspstart.c ../../shared/bsppretaskinghook.c
startup/bspstart.c startup/bspgetworkarea.c ../../shared/bsppretaskinghook.c
clock_SOURCES = ../shared/clock/clock.c

View File

@@ -0,0 +1,46 @@
/**
* @file
*
* @ingroup mpc55xx
*
* @brief BSP Get Work Area of Memory.
*/
/*
* 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.
*/
#include <bsp.h>
#include <bsp/bootcard.h>
#include <libcpu/powerpc-utility.h>
#define MPC55XX_INTERRUPT_STACK_SIZE 0x1000
/* Symbols defined in linker command file */
LINKER_SYMBOL(bsp_ram_start);
LINKER_SYMBOL(bsp_ram_end);
LINKER_SYMBOL(bsp_external_ram_start);
LINKER_SYMBOL(bsp_external_ram_size);
LINKER_SYMBOL(bsp_section_bss_end);
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;
}

View File

@@ -23,8 +23,6 @@
#include <mpc55xx/edma.h>
#include <rtems.h>
#include <rtems/bspIo.h>
#include <rtems/libcsupport.h>
#include <libcpu/powerpc-utility.h>
@@ -43,11 +41,11 @@
#define MPC55XX_INTERRUPT_STACK_SIZE 0x1000
/* Symbols defined in linker command file */
LINKER_SYMBOL( bsp_ram_start);
LINKER_SYMBOL( bsp_ram_end);
LINKER_SYMBOL( bsp_external_ram_start);
LINKER_SYMBOL( bsp_external_ram_size);
LINKER_SYMBOL( bsp_section_bss_end);
LINKER_SYMBOL(bsp_ram_start);
LINKER_SYMBOL(bsp_ram_end);
LINKER_SYMBOL(bsp_external_ram_start);
LINKER_SYMBOL(bsp_external_ram_size);
LINKER_SYMBOL(bsp_section_bss_end);
unsigned int bsp_clock_speed = 0;
@@ -79,14 +77,6 @@ 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_predriver_hook()
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
@@ -193,7 +183,11 @@ void bsp_start(void)
/* Initialize exceptions */
DEBUG_PRINT( "Initialize exceptions ...\n");
ppc_exc_initialize( PPC_INTERRUPT_DISABLE_MASK_DEFAULT, interrupt_stack_start, interrupt_stack_size);
ppc_exc_initialize(
PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
interrupt_stack_start,
interrupt_stack_size
);
DEBUG_DONE();
/* Initialize interrupts */

View File

@@ -1,3 +1,11 @@
2008-09-16 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, startup/bspstart.c: Add use of bsp_get_work_area() in
its own file and rely on BSP Framework to perform more
initialization. Remove unnecessary includes of rtems/libio.h and
rtems/libcsupport.h.
* startup/bspgetworkarea.c: New file.
2008-09-10 Joel Sherrill <joel.sherrill@oarcorp.com>
* include/bsp.h: Review of all bsp_cleanup() implementations. In this

View File

@@ -42,7 +42,8 @@ noinst_LIBRARIES = libbsp.a
startup_SOURCES = startup/bspclean.c ../../shared/bsplibc.c \
../../shared/bsppost.c ../../shared/bsppretaskinghook.c \
../../shared/bsppredriverhook.c startup/bspstart.c ../../shared/bootcard.c \
../../shared/bsppredriverhook.c startup/bspstart.c \
startup/bspgetworkarea.c ../../shared/bootcard.c \
../../shared/sbrk.c ../../shared/gnatinstallhandler.c \
startup/psim_registers.c

View File

@@ -0,0 +1,43 @@
/*
* This set of routines starts the application. It includes application,
* board, and monitor specific initialization and configuration.
* The generic CPU dependent initialization has been performed
* before any of these are invoked.
*
* COPYRIGHT (c) 1989-2008.
* On-Line Applications Research Corporation (OAR).
*
* 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 <string.h>
#include <fcntl.h>
#include <bsp.h>
#include <bsp/bootcard.h>
/*
* system init stack
*/
#define INIT_STACK_SIZE 0x1000
/*
* 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
)
{
*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;
}

View File

@@ -19,8 +19,6 @@
#include <bsp.h>
#include <bsp/irq.h>
#include <bsp/bootcard.h>
#include <rtems/libio.h>
#include <rtems/libcsupport.h>
#include <rtems/bspIo.h>
#include <rtems/powerpc/powerpc.h>
@@ -66,24 +64,6 @@ void _BSP_Fatal_error(unsigned int v)
__asm__ __volatile ("sc");
}
/*
* 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
)
{
*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;
}
/*
* bsp_start
*