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

* Makefile.am, configure.ac, startup/bspstart.c: Split out
	bsp_get_work_area() into its own file and user BSP Framework to
	perform more initialization.
	* startup/bspgetworkarea.c: New file.
This commit is contained in:
Joel Sherrill
2008-09-10 20:32:47 +00:00
parent e993f5b1ba
commit fe27e20ff2
5 changed files with 84 additions and 130 deletions

View File

@@ -1,3 +1,10 @@
2008-09-10 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, configure.ac, startup/bspstart.c: Split out
bsp_get_work_area() into its own file and user BSP Framework to
perform more initialization.
* startup/bspgetworkarea.c: New file.
2008-09-05 Ralf Corsepius <ralf.corsepius@rtems.org>
* timer/timer.c: Use "true" instead of "1" for "bool"s.

View File

@@ -27,10 +27,12 @@ project_lib_DATA = start.$(OBJEXT)
dist_project_lib_DATA += startup/linkcmds
include_HEADERS += ../../arm/shared/comm/uart.h
startup_SOURCES = ../../shared/bsplibc.c ../../shared/bsppost.c \
../../shared/bsppredriverhook.c \
startup/bspstart.c startup/bspclean.c ../../shared/bootcard.c \
../../shared/sbrk.c ../../shared/gnatinstallhandler.c
startup_SOURCES = ../../shared/bsppost.c ../../shared/bsplibc.c \
startup/bspgetworkarea.c ../../shared/bsppretaskinghook.c \
../../shared/bsppredriverhook.c startup/bspstart.c \
startup/bspclean.c ../../shared/bootcard.c ../../shared/sbrk.c \
../../shared/gnatinstallhandler.c
clock_SOURCES = clock/clockdrv.c
console_SOURCES = console/uart.c ../../shared/console.c
timer_SOURCES = timer/timer.c

View File

@@ -18,6 +18,8 @@ RTEMS_PROG_CCAS
RTEMS_CHECK_NETWORKING
AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")
RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION
# Explicitly list all Makefiles here
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

View File

@@ -0,0 +1,43 @@
/*
* 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 *_sdram_size;
extern void *_sdram_base;
extern void *_bss_free_start;
/*
* 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;
/*
* Old code had hard-coded heap size of 0x20000 and a comment indicating
* something about the undefined symbol MEM_NOCACHE_SIZE.
*/
size = (uintptr_t)&_sdram_base + (uintptr_t)&_sdram_size
- (uintptr_t)&_bss_free_start;
*work_area_start = (void *)&_bss_free_start;
*work_area_size = size;
*heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA;
*heap_size = BSP_BOOTCARD_HEAP_SIZE_DEFAULT;
}

View File

@@ -5,12 +5,10 @@
*
* 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 <rtems/libcsupport.h>
@@ -18,139 +16,41 @@
#include <ep7312.h>
#include <uart.h>
/*************************************************************/
/* Macros */
/*************************************************************/
/*************************************************************/
/* Data Structures */
/*************************************************************/
/*************************************************************/
/* Global Variables */
/*************************************************************/
extern void *_flash_size;
extern void *_flash_base;
extern void *_sdram_size;
extern void *_sdram_base;
extern void *_bss_free_start;
unsigned long free_mem_start;
unsigned long free_mem_end;
/*************************************************************/
/* Function prototypes */
/*************************************************************/
/*
* Function prototypes
*/
extern void rtems_irq_mngt_init(void);
void bsp_libc_init( void *, uint32_t, int );
/**************************************************************************/
/* */
/* NAME: bps_pretasking_hook - Function to setup system before startup */
/* */
/* DESCRIPTION: */
/* This function is called before drivers are initialized and used */
/* to setup libc and BSP extensions. It configures non cacheable */
/* SDRAM, SRAM, AIM, and ADM regions and sets up the CPU's memory */
/* protection unit. */
/* */
/* GLOBALS USED: */
/* free_mem_start */
/* free_mem_end */
/* */
/* RESTRICTIONS/LIMITATIONS: */
/* Since this function is setting up libc, it cannot use and libc */
/* functions. */
/* */
/**************************************************************************/
void bsp_pretasking_hook(void)
{
uint32_t heap_start;
uint32_t heap_size;
/*
* Set up the heap. It uses all free SDRAM except that reserved
* for non-cached uses.
*/
heap_start = free_mem_start;
/* heap_size = (free_mem_end - heap_start - MEM_NOCACHE_SIZE); */
heap_size = 0x200000;
bsp_libc_init((void *)heap_start, heap_size, 0);
} /* bsp_pretasking_hook */
/**************************************************************************/
/* */
/* NAME: bsp_start_default - BSP initialization function */
/* */
/* DESCRIPTION: */
/* This function is called before RTEMS is initialized and used */
/* adjust the kernel's configuration. */
/* */
/* This function also configures the CPU's memory protection unit. */
/* */
/* GLOBALS USED: */
/* CPU_table */
/* Configuration */
/* free_mem_start */
/* free_mem_end */
/* free_mem_nocache_start */
/* _bss_free_start */
/* mpu_region_tbl */
/* */
/* */
/* */
/* */
/* RESTRICTIONS/LIMITATIONS: */
/* Since RTEMS is not configured, no RTEMS functions can be called. */
/* */
/**************************************************************************/
/*
* NAME: bsp_start_default - BSP initialization function
*
* This function is called before RTEMS is initialized
* This function also configures the CPU's memory protection unit.
*
*
* RESTRICTIONS/LIMITATIONS:
* Since RTEMS is not configured, no RTEMS functions can be called.
*
*/
void bsp_start_default( void )
{
/* disable interrupts */
*EP7312_INTMR1 = 0;
*EP7312_INTMR2 = 0;
/* disable interrupts */
*EP7312_INTMR1 = 0;
*EP7312_INTMR2 = 0;
/* Place RTEMS workspace at beginning of free memory. */
Configuration.work_space_start = (void *)&_bss_free_start;
/*
* Init rtems exceptions management
*/
rtems_exception_init_mngt();
free_mem_start = ((uint32_t)&_bss_free_start +
rtems_configuration_get_work_space_size());
free_mem_end = ((uint32_t)&_sdram_base + (uint32_t)&_sdram_size);
/*
* Init rtems exceptions management
*/
rtems_exception_init_mngt();
/*
* Init rtems interrupt management
*/
rtems_irq_mngt_init();
/*
* The following information is very useful when debugging.
*/
#if 0
printk( "work_space_size = 0x%x\n",
rtems_configuration_get_work_space_size() );
printk( "microseconds_per_tick = 0x%x\n",
rtems_configuration_get_microseconds_per_tick() );
printk( "ticks_per_timeslice = 0x%x\n",
rtems_configuration_get_ticks_per_timeslice() );
/* printk( "_stack_size = 0x%x\n", _stack_size );*/
printk( "work_space_start = 0x%x\n", Configuration.work_space_start );
printk( "work_space_size = 0x%x\n", rtems_configuration_get_work_space_size() );
#endif
/*
* Init rtems interrupt management
*/
rtems_irq_mngt_init();
} /* bsp_start */
/*
* By making this a weak alias for bsp_start_default, a brave soul
* can override the actual bsp_start routine used.
*/
void bsp_start (void) __attribute__ ((weak, alias("bsp_start_default")));