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

* Makefile.am, configure.ac, startup/bspstart.c, startup/linkcmds:
	Split out bsp_get_work_area() into its own file and user BSP
	Framework to perform more initialization.
This commit is contained in:
Joel Sherrill
2008-09-10 20:32:27 +00:00
parent 03a85d3293
commit 018e3821cc
10 changed files with 84 additions and 174 deletions

View File

@@ -1,3 +1,9 @@
2008-09-10 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, configure.ac, startup/bspstart.c, startup/linkcmds:
Split out bsp_get_work_area() into its own file and user BSP
Framework to perform more initialization.
2008-08-15 Allan Hessenflow <allanh@kallisti.com>
* ChangeLog, Makefile.am, README, bsp_specs, configure.ac,

View File

@@ -30,7 +30,8 @@ noinst_PROGRAMS += startup.rel
startup_rel_SOURCES = ../../shared/bsplibc.c ../../shared/bsppost.c \
../../shared/bsppredriverhook.c startup/bspstart.c \
../../shared/bspclean.c ../../shared/sbrk.c ../../shared/setvec.c \
../../shared/bootcard.c ../../shared/gnatinstallhandler.c
../../shared/bootcard.c ../../shared/gnatinstallhandler.c \
../shared/bspgetworkarea.c
startup_rel_CPPFLAGS = $(AM_CPPFLAGS)
startup_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)

View File

@@ -24,6 +24,8 @@ RTEMS_BSPOPTS_SET([CONSOLE_USE_INTERRUPTS],[*],[0])
RTEMS_BSPOPTS_HELP([CONSOLE_USE_INTERRUPTS],
[The console driver can operate in either polled or interrupt mode.])
RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION
# Explicitly list all Makefiles here
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

View File

@@ -33,11 +33,6 @@ static bfin_mmu_region_t mmuRegions[] = {
};
#endif
/*
* Use the shared implementations of the following routines
*/
void bsp_postdriver_hook(void);
void bsp_libc_init(void *, uint32_t, int);
void Init_RTC(void);
@@ -47,46 +42,20 @@ static void initEBIU(void);
static void initGPIO(void);
/*
* 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.
*
* BSP pretasking hook.
*/
void bsp_pretasking_hook(void) {
extern int HeapBase;
extern int RamBase;
extern int RamSize;
unsigned long heapSize;
void *heapStart;
void bsp_pretasking_hook(void)
{
bfin_interrupt_init();
heapStart = &HeapBase;
heapSize = (unsigned long) &RamBase;
heapSize += (unsigned long) &RamSize;
heapSize -= (unsigned long) &HeapBase;
bsp_libc_init(heapStart, heapSize, 0);
}
/*
* bsp_start
*
* This routine does the bulk of the system initialization.
* This routine does the bulk of the BSP initialization.
*/
void bsp_start(void) {
extern void *_WorkspaceBase;
void bsp_start(void)
{
/* BSP Hardware Initialization*/
/*bfin_mmu_init(sizeof(mmuRegions) / sizeof(mmuRegions[0]), mmuRegions);*/
@@ -96,23 +65,6 @@ void bsp_start(void) {
initPLL(); /* PLL initialization */
initEBIU(); /* EBIU initialization */
initGPIO(); /* GPIO initialization */
/*
* 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".
*/
Configuration.work_space_start = (void *) &_WorkspaceBase;
}
/*

View File

@@ -13,7 +13,6 @@ ENTRY(__start)
*/
_RamBase = DEFINED(_RamBase) ? _RamBase : 0x0;
_RamSize = DEFINED(_RamSize) ? _RamSize : 0x04000000;
/*_HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x0200000;*/
_StackSize = DEFINED(_StackSize) ? _StackSize : 0x1000;
MEMORY
@@ -112,12 +111,7 @@ SECTIONS
_stack_init = .;
. += _StackSize;
_clear_end = .;
_WorkspaceBase = .;
. += 512K; /* reserve some memory for workspace */
_HeapBase = .;
/*
. += _HeapSize;
*/
_WorkArea = .;
_end = .;
__end = .;
} > sdram
@@ -164,7 +158,5 @@ SECTIONS
__RamBase = _RamBase;
__RamSize = _RamSize;
__HeapBase = _HeapBase;
/*__HeapSize = _HeapSize;*/
__WorkspaceBase = _WorkspaceBase;
__edata = _edata;
__etext = _etext;

View File

@@ -1,3 +1,9 @@
2008-09-10 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, configure.ac, startup/bspstart.c, startup/linkcmds:
Split out bsp_get_work_area() into its own file and user BSP
Framework to perform more initialization.
2008-08-18 Allan Hessenflow <allanh@kallisti.com>
* Makefile.am, console/console-io.c, startup/bspstart.c: Update to use

View File

@@ -31,7 +31,8 @@ noinst_PROGRAMS += startup.rel
startup_rel_SOURCES = ../../shared/bsplibc.c ../../shared/bsppost.c \
../../shared/bsppredriverhook.c startup/bspstart.c \
../../shared/bspclean.c ../../shared/sbrk.c ../../shared/setvec.c \
../../shared/bootcard.c ../../shared/gnatinstallhandler.c
../../shared/bootcard.c ../../shared/gnatinstallhandler.c \
../shared/bspgetworkarea.c
startup_rel_CPPFLAGS = $(AM_CPPFLAGS)
startup_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)

View File

@@ -20,6 +20,8 @@ RTEMS_BSPOPTS_SET([CONSOLE_USE_INTERRUPTS],[*],[0])
RTEMS_BSPOPTS_HELP([CONSOLE_USE_INTERRUPTS],
[The console driver can operate in either polled or interrupt mode.])
RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION
# Explicitly list all Makefiles here
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

View File

@@ -26,56 +26,49 @@
#include <libcpu/interrupt.h>
const unsigned int dcplbs_table[16][2] = {
{ 0xFFA00000, (PAGE_SIZE_1MB | CPLB_D_PAGE_MGMT | CPLB_WT) },
{ 0xFF900000, (PAGE_SIZE_1MB | CPLB_D_PAGE_MGMT | CPLB_WT) }, /* L1 Data B */
{ 0xFF800000, (PAGE_SIZE_1MB | CPLB_D_PAGE_MGMT | CPLB_WT) }, /* L1 Data A */
{ 0xFFB00000, (PAGE_SIZE_1MB | CPLB_DNOCACHE) },
{ 0xFFA00000, (PAGE_SIZE_1MB | CPLB_D_PAGE_MGMT | CPLB_WT) },
{ 0xFF900000, (PAGE_SIZE_1MB | CPLB_D_PAGE_MGMT | CPLB_WT) }, /* L1 Data B */
{ 0xFF800000, (PAGE_SIZE_1MB | CPLB_D_PAGE_MGMT | CPLB_WT) }, /* L1 Data A */
{ 0xFFB00000, (PAGE_SIZE_1MB | CPLB_DNOCACHE) },
{ 0x20300000, (PAGE_SIZE_1MB | CPLB_DNOCACHE) }, /* Async Memory Bank 3 */
{ 0x20200000, (PAGE_SIZE_1MB | CPLB_DNOCACHE) }, /* Async Memory Bank 2 (Secnd) */
{ 0x20100000, (PAGE_SIZE_1MB | CPLB_DNOCACHE) }, /* Async Memory Bank 1 (Prim B) */
{ 0x20000000, (PAGE_SIZE_1MB | CPLB_DNOCACHE) }, /* Async Memory Bank 0 (Prim A) */
{ 0x20300000, (PAGE_SIZE_1MB | CPLB_DNOCACHE) }, /* Async Memory Bank 3 */
{ 0x20200000, (PAGE_SIZE_1MB | CPLB_DNOCACHE) }, /* Async Memory Bank 2 (Secnd) */
{ 0x20100000, (PAGE_SIZE_1MB | CPLB_DNOCACHE) }, /* Async Memory Bank 1 (Prim B) */
{ 0x20000000, (PAGE_SIZE_1MB | CPLB_DNOCACHE) }, /* Async Memory Bank 0 (Prim A) */
{ 0x02400000, (PAGE_SIZE_4MB | CPLB_DNOCACHE) },
{ 0x02000000, (PAGE_SIZE_4MB | CPLB_DNOCACHE) },
{ 0x00C00000, (PAGE_SIZE_4MB | CPLB_DNOCACHE) },
{ 0x00800000, (PAGE_SIZE_4MB | CPLB_DNOCACHE) },
{ 0x00400000, (PAGE_SIZE_4MB | CPLB_DNOCACHE) },
{ 0x00000000, (PAGE_SIZE_4MB | CPLB_DNOCACHE) },
{ 0xffffffff, 0xffffffff } /* end of section - termination */
{ 0x02400000, (PAGE_SIZE_4MB | CPLB_DNOCACHE) },
{ 0x02000000, (PAGE_SIZE_4MB | CPLB_DNOCACHE) },
{ 0x00C00000, (PAGE_SIZE_4MB | CPLB_DNOCACHE) },
{ 0x00800000, (PAGE_SIZE_4MB | CPLB_DNOCACHE) },
{ 0x00400000, (PAGE_SIZE_4MB | CPLB_DNOCACHE) },
{ 0x00000000, (PAGE_SIZE_4MB | CPLB_DNOCACHE) },
{ 0xffffffff, 0xffffffff } /* end of section - termination */
}
;
};
const unsigned int _icplbs_table[16][2] = {
{ 0xFFA00000, (PAGE_SIZE_1MB | CPLB_I_PAGE_MGMT | CPLB_I_PAGE_MGMT | 0x4) }, /* L1 Code */
{ 0xEF000000, (PAGE_SIZE_1MB | CPLB_INOCACHE) }, /* AREA DE BOOT */
{ 0xFFB00000, (PAGE_SIZE_1MB | CPLB_INOCACHE) },
{ 0xFFA00000, (PAGE_SIZE_1MB | CPLB_I_PAGE_MGMT | CPLB_I_PAGE_MGMT | 0x4) }, /* L1 Code */
{ 0xEF000000, (PAGE_SIZE_1MB | CPLB_INOCACHE) }, /* AREA DE BOOT */
{ 0xFFB00000, (PAGE_SIZE_1MB | CPLB_INOCACHE) },
{ 0x20300000, (PAGE_SIZE_1MB | CPLB_INOCACHE) }, /* Async Memory Bank 3 */
{ 0x20200000, (PAGE_SIZE_1MB | CPLB_INOCACHE) }, /* Async Memory Bank 2 (Secnd) */
{ 0x20100000, (PAGE_SIZE_1MB | CPLB_INOCACHE) }, /* Async Memory Bank 1 (Prim B) */
{ 0x20000000, (PAGE_SIZE_1MB | CPLB_INOCACHE) }, /* Async Memory Bank 0 (Prim A) */
{ 0x20300000, (PAGE_SIZE_1MB | CPLB_INOCACHE) }, /* Async Memory Bank 3 */
{ 0x20200000, (PAGE_SIZE_1MB | CPLB_INOCACHE) }, /* Async Memory Bank 2 (Secnd) */
{ 0x20100000, (PAGE_SIZE_1MB | CPLB_INOCACHE) }, /* Async Memory Bank 1 (Prim B) */
{ 0x20000000, (PAGE_SIZE_1MB | CPLB_INOCACHE) }, /* Async Memory Bank 0 (Prim A) */
{ 0x02400000, (PAGE_SIZE_4MB | CPLB_INOCACHE) },
{ 0x02000000, (PAGE_SIZE_4MB | CPLB_INOCACHE) },
{ 0x00C00000, (PAGE_SIZE_4MB | CPLB_INOCACHE) },
{ 0x00800000, (PAGE_SIZE_4MB | CPLB_INOCACHE) },
{ 0x00400000, (PAGE_SIZE_4MB | CPLB_INOCACHE) },
{ 0x00000000, (PAGE_SIZE_4MB | CPLB_INOCACHE) },
{ 0xffffffff, 0xffffffff } /* end of section - termination */
{ 0x02400000, (PAGE_SIZE_4MB | CPLB_INOCACHE) },
{ 0x02000000, (PAGE_SIZE_4MB | CPLB_INOCACHE) },
{ 0x00C00000, (PAGE_SIZE_4MB | CPLB_INOCACHE) },
{ 0x00800000, (PAGE_SIZE_4MB | CPLB_INOCACHE) },
{ 0x00400000, (PAGE_SIZE_4MB | CPLB_INOCACHE) },
{ 0x00000000, (PAGE_SIZE_4MB | CPLB_INOCACHE) },
{ 0xffffffff, 0xffffffff } /* end of section - termination */
}
;
};
/*
* Use the shared implementations of the following routines
*/
void bsp_libc_init( void *, uint32_t, int );
void Init_PLL (void);
void Init_EBIU (void);
void Init_Flags(void);
@@ -84,29 +77,13 @@ void Init_RTC (void);
void null_isr(void);
/*
* 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)
{
extern int HeapBase;
extern int HeapSize;
void *heapStart = &HeapBase;
unsigned long heapSize = (unsigned long)&HeapSize;
bfin_interrupt_init();
bsp_libc_init(heapStart, heapSize, 0);
bfin_interrupt_init();
}
/*
@@ -117,48 +94,26 @@ void bsp_pretasking_hook(void)
void bsp_start( void )
{
extern void * _WorkspaceBase;
/* BSP Hardware Initialization*/
Init_RTC(); /* Blackfin Real Time Clock initialization */
Init_PLL(); /* PLL initialization */
Init_EBIU(); /* EBIU initialization */
Init_Flags(); /* GPIO initialization */
/*
* 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".
*/
Configuration.work_space_start = (void *) &_WorkspaceBase;
int i=0;
for (i=5;i<16;i++) {
set_vector((rtems_isr_entry)null_isr, i, 1);
}
}
/*
* Init_PLL
*
* Routine to initialize the PLL. The Ezkit uses a 27 Mhz XTAL.
* See "../eZKit533/include/bsp.h" for more information.
*/
/*
* Init_PLL
*
* Routine to initialize the PLL. The Ezkit uses a 27 Mhz XTAL.
* See "../eZKit533/include/bsp.h" for more information.
*/
void Init_PLL (void)
{
unsigned int n;
/* Configure PLL registers */
@@ -173,7 +128,6 @@ void Init_PLL (void)
/* Delay for PLL stabilization */
for (n=0; n<200; n++) {}
}
/*
@@ -196,11 +150,11 @@ void Init_EBIU (void)
*/
}
/*
* Init_Flags
*
* Enable LEDs port
*/
/*
* Init_Flags
*
* Enable LEDs port
*/
void Init_Flags(void)
{
*((uint16_t*)FIO_INEN) = 0x0100;
@@ -229,20 +183,19 @@ uint8_t getLED (void)
return *((uint8_t*)FlashA_PortB_Data);
}
void initCPLB() {
int i = 0;
unsigned int *addr;
unsigned int *data;
void initCPLB()
{
int i = 0;
unsigned int *addr;
unsigned int *data;
addr = (unsigned int *)0xffe00100;
data = (unsigned int *)0xffe00200;
addr = (unsigned int *)0xffe00100;
data = (unsigned int *)0xffe00200;
while ( dcplbs_table[i][0] != 0xffffffff ) {
*addr = dcplbs_table[i][0];
*data = dcplbs_table[i][1];
addr++;
data++;
}
while ( dcplbs_table[i][0] != 0xffffffff ) {
*addr = dcplbs_table[i][0];
*data = dcplbs_table[i][1];
addr++;
data++;
}
}

View File

@@ -101,10 +101,7 @@ SECTIONS
_stack_init = .;
. += _StackSize;
_clear_end = .;
_WorkspaceBase = .;
. += 512K; /* reserve some memory for workspace */
_HeapBase = .;
. += _HeapSize; /* reserve some memory for heap */
_WorkArea = .;
_end = .;
__end = .;
} > sdram
@@ -148,8 +145,6 @@ SECTIONS
/* These must appear regardless of . */
}
__HeapBase = _HeapBase;
__HeapSize = _HeapSize;
__WorkspaceBase = _WorkspaceBase;
__edata = _edata;
__etext = _etext;