forked from Imagelibrary/rtems
2008-09-14 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, configure.ac, console/rsPMCQ1.h, include/bsp.h, startup/bspstart.c: Create bsp_get_work_area() into its own file and use BSP Framework to perform more initialization. * startup/bspgetworkarea.c: New file.
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
2008-09-14 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||||
|
|
||||||
|
* Makefile.am, configure.ac, console/rsPMCQ1.h, include/bsp.h,
|
||||||
|
startup/bspstart.c: Create bsp_get_work_area() into its own file and
|
||||||
|
use BSP Framework to perform more initialization.
|
||||||
|
* startup/bspgetworkarea.c: New file.
|
||||||
|
|
||||||
2008-09-10 Joel Sherrill <joel.sherrill@oarcorp.com>
|
2008-09-10 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||||
|
|
||||||
* startup/bspstart.c: Review of all bsp_cleanup() implementations. In
|
* startup/bspstart.c: Review of all bsp_cleanup() implementations. In
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ dist_project_lib_DATA += startup/linkcmds
|
|||||||
|
|
||||||
startup_SOURCES = startup/bspstart.c ../../shared/bootcard.c \
|
startup_SOURCES = startup/bspstart.c ../../shared/bootcard.c \
|
||||||
../../shared/bsppost.c ../../shared/bsppredriverhook.c \
|
../../shared/bsppost.c ../../shared/bsppredriverhook.c \
|
||||||
../../shared/bsplibc.c ../../powerpc/shared/startup/sbrk.c \
|
startup/bspgetworkarea.c ../../shared/bsplibc.c \
|
||||||
|
../../powerpc/shared/startup/sbrk.c \
|
||||||
../../shared/bspclean.c ../../shared/gnatinstallhandler.c \
|
../../shared/bspclean.c ../../shared/gnatinstallhandler.c \
|
||||||
../../powerpc/shared/startup/pgtbl_setup.c \
|
../../powerpc/shared/startup/pgtbl_setup.c \
|
||||||
../../powerpc/shared/startup/pgtbl_activate.c \
|
../../powerpc/shared/startup/pgtbl_activate.c \
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ RTEMS_BSPOPTS_HELP([CONSOLE_USE_INTERRUPTS],
|
|||||||
RTEMS_CHECK_NETWORKING
|
RTEMS_CHECK_NETWORKING
|
||||||
AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")
|
AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")
|
||||||
|
|
||||||
|
RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION
|
||||||
|
|
||||||
# Explicitly list all Makefiles here
|
# Explicitly list all Makefiles here
|
||||||
AC_CONFIG_FILES([Makefile])
|
AC_CONFIG_FILES([Makefile])
|
||||||
|
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ extern unsigned int rsPMCQ1QuiccIntConnect(
|
|||||||
FUNCION_PTR routine,
|
FUNCION_PTR routine,
|
||||||
int arg
|
int arg
|
||||||
);
|
);
|
||||||
unsigned int rsPMCQ1Init();
|
unsigned int rsPMCQ1Init(void);
|
||||||
unsigned int rsPMCQ1MaIntConnect (
|
unsigned int rsPMCQ1MaIntConnect (
|
||||||
unsigned long busNo, /* Pci Bus number of PMCQ1 */
|
unsigned long busNo, /* Pci Bus number of PMCQ1 */
|
||||||
unsigned long slotNo, /* Pci Slot number of PMCQ1 */
|
unsigned long slotNo, /* Pci Slot number of PMCQ1 */
|
||||||
|
|||||||
@@ -202,6 +202,10 @@ void BSP_FLASH_set_page( uint8_t page );
|
|||||||
#define BSP_FLASH_DISABLE_WRITES(_area) BSP_FLASH_Disable_writes( _area )
|
#define BSP_FLASH_DISABLE_WRITES(_area) BSP_FLASH_Disable_writes( _area )
|
||||||
#define BSP_FLASH_SET_PAGE(_page) BSP_FLASH_set_page( _page )
|
#define BSP_FLASH_SET_PAGE(_page) BSP_FLASH_set_page( _page )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* system init stack
|
||||||
|
*/
|
||||||
|
#define BSP_INIT_STACK_SIZE 0x1000
|
||||||
|
|
||||||
/* clear hostbridge errors
|
/* clear hostbridge errors
|
||||||
*
|
*
|
||||||
|
|||||||
44
c/src/lib/libbsp/powerpc/ep1a/startup/bspgetworkarea.c
Normal file
44
c/src/lib/libbsp/powerpc/ep1a/startup/bspgetworkarea.c
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* 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 *RAM_END;
|
||||||
|
extern void *__rtems_end;
|
||||||
|
extern uint32_t _bsp_sbrk_init(uint32_t, uint32_t*);
|
||||||
|
|
||||||
|
unsigned int BSP_mem_size = (unsigned int)&RAM_END;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
uintptr_t reserve;
|
||||||
|
|
||||||
|
reserve = (uintptr_t)BSP_INIT_STACK_SIZE;
|
||||||
|
reserve += rtems_configuration_get_interrupt_stack_size();
|
||||||
|
size = (uintptr_t)&RAM_END - (uintptr_t)&__rtems_end + reserve;
|
||||||
|
|
||||||
|
*work_area_start = (void *)(&__rtems_end + reserve);
|
||||||
|
*work_area_size = size;
|
||||||
|
_bsp_sbrk_init( *work_area_start, work_area_size );
|
||||||
|
*heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA;
|
||||||
|
*heap_size = BSP_BOOTCARD_HEAP_SIZE_DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -19,7 +19,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <rtems/libio.h>
|
#include <rtems/libio.h>
|
||||||
#include <rtems/libcsupport.h>
|
|
||||||
#include <bsp/consoleIo.h>
|
#include <bsp/consoleIo.h>
|
||||||
#include <libcpu/spr.h>
|
#include <libcpu/spr.h>
|
||||||
#include <bsp/residual.h>
|
#include <bsp/residual.h>
|
||||||
@@ -83,15 +82,6 @@ printk("0x%x ==> %d\n", offset, data );
|
|||||||
|
|
||||||
uint32_t VME_Slot1 = FALSE;
|
uint32_t VME_Slot1 = FALSE;
|
||||||
|
|
||||||
/*
|
|
||||||
* Total memory.
|
|
||||||
* Note: RAM_END is defined in linkcmds. We want to verify that the application
|
|
||||||
* is only using 10M of memory, and we do this by only accounting for this
|
|
||||||
* much memory.
|
|
||||||
*/
|
|
||||||
extern int RAM_END;
|
|
||||||
unsigned int BSP_mem_size = (unsigned int)&RAM_END;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PCI Bus Frequency
|
* PCI Bus Frequency
|
||||||
*/
|
*/
|
||||||
@@ -107,11 +97,6 @@ unsigned int BSP_processor_frequency;
|
|||||||
*/
|
*/
|
||||||
unsigned int BSP_time_base_divisor = 1000; /* XXX - Just a guess */
|
unsigned int BSP_time_base_divisor = 1000; /* XXX - Just a guess */
|
||||||
|
|
||||||
/*
|
|
||||||
* system init stack
|
|
||||||
*/
|
|
||||||
#define INIT_STACK_SIZE 0x1000
|
|
||||||
|
|
||||||
void BSP_panic(char *s)
|
void BSP_panic(char *s)
|
||||||
{
|
{
|
||||||
printk("%s PANIC %s\n",_RTEMS_version, s);
|
printk("%s PANIC %s\n",_RTEMS_version, s);
|
||||||
@@ -164,48 +149,12 @@ void BSP_FLASH_set_page(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Use the shared implementations of the following routines
|
* bsp_pretasking_hook
|
||||||
|
*
|
||||||
|
* BSP pretasking hook. Called just before drivers are initialized.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void bsp_libc_init( void *, uint32_t, int );
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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)
|
void bsp_pretasking_hook(void)
|
||||||
{
|
{
|
||||||
uint32_t heap_start;
|
|
||||||
uint32_t heap_size;
|
|
||||||
uint32_t heap_sbrk_spared;
|
|
||||||
|
|
||||||
extern uint32_t _bsp_sbrk_init(uint32_t, uint32_t*);
|
|
||||||
|
|
||||||
heap_start = ((uint32_t) __rtems_end) +
|
|
||||||
INIT_STACK_SIZE + rtems_configuration_get_interrupt_stack_size();
|
|
||||||
if (heap_start & (CPU_ALIGNMENT-1))
|
|
||||||
heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
|
|
||||||
|
|
||||||
heap_size = (BSP_mem_size - heap_start) - rtems_configuration_get_work_space_size();
|
|
||||||
|
|
||||||
heap_sbrk_spared=_bsp_sbrk_init(heap_start, &heap_size);
|
|
||||||
|
|
||||||
#ifdef SHOW_MORE_INIT_SETTINGS
|
|
||||||
printk(" HEAP start %x size %x (%x bytes spared for sbrk)\n",
|
|
||||||
heap_start, heap_size, heap_sbrk_spared);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bsp_libc_init((void *) 0, heap_size, heap_sbrk_spared);
|
|
||||||
rsPMCQ1Init();
|
rsPMCQ1Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -329,14 +278,14 @@ void bsp_start( void )
|
|||||||
unsigned char *stack;
|
unsigned char *stack;
|
||||||
uint32_t intrStackStart;
|
uint32_t intrStackStart;
|
||||||
uint32_t intrStackSize;
|
uint32_t intrStackSize;
|
||||||
unsigned char *work_space_start;
|
|
||||||
ppc_cpu_id_t myCpu;
|
ppc_cpu_id_t myCpu;
|
||||||
ppc_cpu_revision_t myCpuRevision;
|
ppc_cpu_revision_t myCpuRevision;
|
||||||
Triv121PgTbl pt=0; /* R = e; */
|
Triv121PgTbl pt=0; /* R = e; */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get CPU identification dynamically. Note that the get_ppc_cpu_type() function
|
* Get CPU identification dynamically. Note that the get_ppc_cpu_type()
|
||||||
* store the result in global variables so that it can be used latter...
|
* function store the result in global variables so that it can be used
|
||||||
|
* latter...
|
||||||
*/
|
*/
|
||||||
BSP_Increment_Light();
|
BSP_Increment_Light();
|
||||||
myCpu = get_ppc_cpu_type();
|
myCpu = get_ppc_cpu_type();
|
||||||
@@ -367,7 +316,8 @@ ShowBATS();
|
|||||||
* so there is no need to set it in r1 again... It is just for info
|
* so there is no need to set it in r1 again... It is just for info
|
||||||
* so that It can be printed without accessing R1.
|
* so that It can be printed without accessing R1.
|
||||||
*/
|
*/
|
||||||
stack = ((unsigned char*) __rtems_end) + INIT_STACK_SIZE - PPC_MINIMUM_STACK_FRAME_SIZE;
|
stack = ((unsigned char*) __rtems_end) + BSP_INIT_STACK_SIZE
|
||||||
|
- PPC_MINIMUM_STACK_FRAME_SIZE;
|
||||||
|
|
||||||
/* tag the bottom (T. Straumann 6/36/2001 <strauman@slac.stanford.edu>) */
|
/* tag the bottom (T. Straumann 6/36/2001 <strauman@slac.stanford.edu>) */
|
||||||
*((uint32_t *)stack) = 0;
|
*((uint32_t *)stack) = 0;
|
||||||
@@ -375,7 +325,7 @@ ShowBATS();
|
|||||||
/*
|
/*
|
||||||
* Initialize the interrupt related settings.
|
* Initialize the interrupt related settings.
|
||||||
*/
|
*/
|
||||||
intrStackStart = (uint32_t) __rtems_end + INIT_STACK_SIZE;
|
intrStackStart = (uint32_t) __rtems_end + BSP_INIT_STACK_SIZE;
|
||||||
intrStackSize = rtems_configuration_get_interrupt_stack_size();
|
intrStackSize = rtems_configuration_get_interrupt_stack_size();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -418,21 +368,6 @@ ShowBATS();
|
|||||||
__asm__ __volatile ("sc");
|
__asm__ __volatile ("sc");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SHOW_MORE_INIT_SETTINGS
|
|
||||||
printk("rtems_configuration_get_work_space_size() = %x\n",
|
|
||||||
rtems_configuration_get_work_space_size());
|
|
||||||
#endif
|
|
||||||
work_space_start =
|
|
||||||
(unsigned char *)BSP_mem_size - rtems_configuration_get_work_space_size();
|
|
||||||
|
|
||||||
if ( work_space_start <= ((unsigned char *)__rtems_end) +
|
|
||||||
INIT_STACK_SIZE + rtems_configuration_get_interrupt_stack_size()) {
|
|
||||||
printk( "bspstart: Not enough RAM!!!\n" );
|
|
||||||
bsp_cleanup();
|
|
||||||
}
|
|
||||||
|
|
||||||
Configuration.work_space_start = work_space_start;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initalize RTEMS IRQ system
|
* Initalize RTEMS IRQ system
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user