diff options
Diffstat (limited to '')
-rw-r--r-- | c/src/lib/libbsp/powerpc/mpc8260ads/ChangeLog | 7 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/mpc8260ads/Makefile.am | 3 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/mpc8260ads/configure.ac | 2 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/mpc8260ads/startup/bspgetworkarea.c | 39 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/mpc8260ads/startup/bspstart.c | 58 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/mpc8260ads/startup/linkcmds | 74 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/ss555/ChangeLog | 7 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/ss555/Makefile.am | 3 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/ss555/configure.ac | 2 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/ss555/startup/bspgetworkarea.c | 33 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/ss555/startup/bspstart.c | 59 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/ss555/startup/linkcmds | 9 |
12 files changed, 126 insertions, 170 deletions
diff --git a/c/src/lib/libbsp/powerpc/mpc8260ads/ChangeLog b/c/src/lib/libbsp/powerpc/mpc8260ads/ChangeLog index 92318b0712..02eef4eb4e 100644 --- a/c/src/lib/libbsp/powerpc/mpc8260ads/ChangeLog +++ b/c/src/lib/libbsp/powerpc/mpc8260ads/ChangeLog @@ -1,3 +1,10 @@ +2008-09-15 Joel Sherrill <joel.sherrill@oarcorp.com> + + * Makefile.am, configure.ac, startup/bspstart.c, startup/linkcmds: Add + use of bsp_get_work_area() in its own file and rely on BSP Framework + to perform more initialization. + * 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 diff --git a/c/src/lib/libbsp/powerpc/mpc8260ads/Makefile.am b/c/src/lib/libbsp/powerpc/mpc8260ads/Makefile.am index 432700858d..8d708d300a 100644 --- a/c/src/lib/libbsp/powerpc/mpc8260ads/Makefile.am +++ b/c/src/lib/libbsp/powerpc/mpc8260ads/Makefile.am @@ -38,7 +38,8 @@ include_bsp_HEADERS += vectors/vectors.h startup_SOURCES = ../../shared/bspclean.c ../../shared/bsplibc.c \ ../../shared/bsppredriverhook.c ../../shared/bsppost.c \ startup/bspstart.c ../../shared/bootcard.c ../../shared/sbrk.c \ - ../../shared/gnatinstallhandler.c startup/cpuinit.c + ../../shared/gnatinstallhandler.c startup/cpuinit.c \ + startup/bspgetworkarea.c ../../shared/bsppretaskinghook.c vectors_SOURCES = vectors/vectors_init.c vectors/vectors.h \ vectors/vectors.S diff --git a/c/src/lib/libbsp/powerpc/mpc8260ads/configure.ac b/c/src/lib/libbsp/powerpc/mpc8260ads/configure.ac index 48f65ded7e..e8c3eb7be4 100644 --- a/c/src/lib/libbsp/powerpc/mpc8260ads/configure.ac +++ b/c/src/lib/libbsp/powerpc/mpc8260ads/configure.ac @@ -67,6 +67,8 @@ RTEMS_BSPOPTS_HELP([DISPATCH_HANDLER_STAT], RTEMS_CHECK_NETWORKING AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes") +RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION + # Explicitly list a Makefile here AC_CONFIG_FILES([Makefile]) diff --git a/c/src/lib/libbsp/powerpc/mpc8260ads/startup/bspgetworkarea.c b/c/src/lib/libbsp/powerpc/mpc8260ads/startup/bspgetworkarea.c new file mode 100644 index 0000000000..f77fbb85ad --- /dev/null +++ b/c/src/lib/libbsp/powerpc/mpc8260ads/startup/bspgetworkarea.c @@ -0,0 +1,39 @@ +/* + * 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 *RamBase; +extern void *RamSize; +extern void *WorkspaceBase; + +/* + * 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; + + size = (uintptr_t)&RamBase + (uintptr_t)&RamSize + - (uintptr_t)&WorkspaceBase; + + *work_area_start = (void *)&WorkspaceBase; + *work_area_size = size; + *heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA; + *heap_size = BSP_BOOTCARD_HEAP_SIZE_DEFAULT; +} + diff --git a/c/src/lib/libbsp/powerpc/mpc8260ads/startup/bspstart.c b/c/src/lib/libbsp/powerpc/mpc8260ads/startup/bspstart.c index 5302ba88c6..45794d4eab 100644 --- a/c/src/lib/libbsp/powerpc/mpc8260ads/startup/bspstart.c +++ b/c/src/lib/libbsp/powerpc/mpc8260ads/startup/bspstart.c @@ -44,8 +44,6 @@ */ #include <mpc8260.h> -#include <rtems/libio.h> -#include <rtems/libcsupport.h> #include <rtems/score/thread.h> #include <rtems/powerpc/powerpc.h> @@ -73,13 +71,6 @@ uint32_t bsp_timer_average_overhead; /* Average overhead of timer in ticks */ uint32_t bsp_timer_least_valid; /* Least valid number from timer */ bool bsp_timer_internal_clock; /* TRUE, when timer runs with CPU clk */ -/* - * Use the shared implementations of the following routines. - * Look in rtems/c/src/lib/libbsp/shared/bsppost.c and - * rtems/c/src/lib/libbsp/shared/bsplibc.c. - */ -void bsp_libc_init( void *, uint32_t, int ); - void _BSP_GPLED1_on(void); void _BSP_GPLED0_on(void); void cpu_init(void); @@ -157,39 +148,6 @@ void _BSP_Uart2_disable() } -/* - * 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) -{ - /* - * These are assigned addresses in the linkcmds file for the BSP. This - * approach is better than having these defined as manifest constants and - * compiled into the kernel, but it is still not ideal when dealing with - * multiprocessor configuration in which each board as a different memory - * map. A better place for defining these symbols might be the makefiles. - * Consideration should also be given to developing an approach in which - * the kernel and the application can be linked and burned into ROM - * independently of each other. - */ - extern unsigned char _HeapStart; - extern unsigned char _HeapEnd; - - bsp_libc_init( &_HeapStart, &_HeapEnd - &_HeapStart, 0 ); -} - void bsp_start(void) { extern void *_WorkspaceBase; @@ -246,22 +204,6 @@ void bsp_start(void) #endif /* - * 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; - - /* * initialize the device driver parameters */ bsp_clicks_per_usec = 10; /* for 40MHz extclk */ diff --git a/c/src/lib/libbsp/powerpc/mpc8260ads/startup/linkcmds b/c/src/lib/libbsp/powerpc/mpc8260ads/startup/linkcmds index 2313dad46e..97a10de45a 100644 --- a/c/src/lib/libbsp/powerpc/mpc8260ads/startup/linkcmds +++ b/c/src/lib/libbsp/powerpc/mpc8260ads/startup/linkcmds @@ -8,7 +8,7 @@ OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") OUTPUT_ARCH(powerpc) - + ENTRY(start) /* @@ -17,27 +17,28 @@ ENTRY(start) * number used there is not constant. If this happens to you, edit * the lines marked XXX below to use a constant value. */ -HeapSize = DEFINED(HeapSize) ? HeapSize : 0x400000; /* 4M Heap */ -StackSize = DEFINED(StackSize) ? StackSize : 0x8000; -WorkSpaceSize = DEFINED(WorkSpaceSize) ? WorkSpaceSize : 0x80000; /* 512k */ +StackSize = DEFINED(StackSize) ? StackSize : 0x8000; +RamBase = DEFINED(RamBase) ? RamBase : 0x0; +RamSize = DEFINED(RamSize) ? RamDiskSize : 0x0800000; /* 8M program ram */ +RamDiskBase = DEFINED(RamDiskBase) ? RamDiskBase : 0x0800000; RamDiskSize = DEFINED(RamDiskSize) ? RamDiskSize : 0x0800000; /* 8M ram disk */ - + MEMORY - { - ram : org = 0x0, l = 16M - dpram : org = 0x04700000, l = 128K - flash : org = 0xff800000, l = 8M - } +{ + ram : org = 0x0, l = 8M + ramdisk : org = 0x0800000, l = 8M + dpram : org = 0x04700000, l = 128K + flash : org = 0xff800000, l = 8M +} SECTIONS { - - /* + /* * The stack will live in this area - between the vectors and * the text section. */ - + .text 0x10000: { _textbase = .; @@ -80,33 +81,33 @@ SECTIONS * doesn't matter if the user does not actually link against ecrti.o and * ecrtn.o; the linker won't look for a file to match a wildcard. The * wildcard also means that it doesn't matter which directory ecrti.o - * and ecrtn.o are in. + * and ecrtn.o are in. */ PROVIDE (_init = .); *ecrti.o(.init) *(.init) *ecrtn.o(.init) - + PROVIDE (_fini = .); *ecrti.o(.fini) *(.fini) *ecrtn.o(.init) - /* + /* * C++ constructors and destructors for static objects. * PowerPC EABI does not use crtstuff yet, so we build "old-style" * constructor and destructor lists that begin with the list lenght * end terminate with a NULL entry. */ - - PROVIDE (__CTOR_LIST__ = .); + + PROVIDE (__CTOR_LIST__ = .); /* LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) */ *crtbegin.o(.ctors) *(.ctors) *crtend.o(.ctors) LONG(0) PROVIDE (__CTOR_END__ = .); - + PROVIDE (__DTOR_LIST__ = .); /* LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) */ *crtbegin.o(.dtors) @@ -114,7 +115,7 @@ SECTIONS *crtend.o(.dtors) LONG(0) PROVIDE (__DTOR_END__ = .); - + /* Exception frame info */ *(.eh_frame) @@ -137,7 +138,7 @@ SECTIONS text.end = .; PROVIDE (etext = .); PROVIDE (__etext = .); - + } > ram @@ -193,28 +194,28 @@ SECTIONS *(.got.plt) *(.got) } > ram __GOT_END__ = .; - + .got1 : { *(.got1) } >ram PROVIDE (__GOT2_START__ = .); PROVIDE (_GOT2_START_ = .); .got2 : { *(.got2) } >ram PROVIDE (__GOT2_END__ = .); PROVIDE (_GOT2_END_ = .); - + PROVIDE (__FIXUP_START__ = .); PROVIDE (_FIXUP_START_ = .); .fixup : { *(.fixup) } >ram PROVIDE (_FIXUP_END_ = .); PROVIDE (__FIXUP_END__ = .); - + PROVIDE (__SDATA2_START__ = .); .sdata2 : { *(.sdata2) *(.gnu.linkonce.s2.*) } >ram .sbss2 : { *(.sbss2) *(.gnu.linkonce.sb2.*) } >ram PROVIDE (__SBSS2_END__ = .); - + .sbss2 : { *(.sbss2) } >ram PROVIDE (__SBSS2_END__ = .); - + __SBSS_START__ = .; .bss : { @@ -256,7 +257,7 @@ SECTIONS . = ALIGN (16); _startmalloc = .; } >ram - + /* * Interrupt stack setup @@ -267,26 +268,9 @@ SECTIONS PROVIDE(intrStackPtr = intrStack); - _HeapStart = .; - __HeapStart = .; - . += HeapSize; - _HeapEnd = .; - __HeapEnd = .; - clear_end = .; - - _WorkspaceBase = .; - __WorkspaceBase = .; - . += WorkSpaceSize; - - - _RamDiskBase = .; - __RamDiskBase = .; - . += RamDiskSize; - _RamDiskEnd = .; - __RamDiskEnd = .; - PROVIDE( _RamDiskSize = _RamDiskEnd - _RamDiskBase ); + WorkspaceBase = .; /* Sections for compressed .text and .data */ /* after the .datarom section is an int specifying */ diff --git a/c/src/lib/libbsp/powerpc/ss555/ChangeLog b/c/src/lib/libbsp/powerpc/ss555/ChangeLog index fa832a8579..fea4b66abd 100644 --- a/c/src/lib/libbsp/powerpc/ss555/ChangeLog +++ b/c/src/lib/libbsp/powerpc/ss555/ChangeLog @@ -1,3 +1,10 @@ +2008-09-15 Joel Sherrill <joel.sherrill@oarcorp.com> + + * Makefile.am, configure.ac, startup/bspstart.c, startup/linkcmds: Add + use of bsp_get_work_area() in its own file and rely on BSP Framework + to perform more initialization. + * 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 diff --git a/c/src/lib/libbsp/powerpc/ss555/Makefile.am b/c/src/lib/libbsp/powerpc/ss555/Makefile.am index 0620a1da6f..4553cf9707 100644 --- a/c/src/lib/libbsp/powerpc/ss555/Makefile.am +++ b/c/src/lib/libbsp/powerpc/ss555/Makefile.am @@ -31,7 +31,8 @@ console_SOURCES = console/console.c startup_SOURCES = ../../shared/bspclean.c ../../shared/bsplibc.c \ ../../shared/bsppost.c ../../shared/bsppredriverhook.c \ startup/bspstart.c ../../shared/bootcard.c startup/iss555.c \ - ../../shared/sbrk.c ../../shared/gnatinstallhandler.c startup/start.S + ../../shared/sbrk.c ../../shared/gnatinstallhandler.c startup/start.S \ + ../../shared/bsppretaskinghook.c startup/bspgetworkarea.c tm27supp_SOURCES = startup/tm27supp.c noinst_LIBRARIES = libbsp.a diff --git a/c/src/lib/libbsp/powerpc/ss555/configure.ac b/c/src/lib/libbsp/powerpc/ss555/configure.ac index 1150f4cfe9..a4da64c45d 100644 --- a/c/src/lib/libbsp/powerpc/ss555/configure.ac +++ b/c/src/lib/libbsp/powerpc/ss555/configure.ac @@ -44,6 +44,8 @@ RTEMS_BSPOPTS_HELP([PRINTK_MINOR], I/O. Don't open the printk port from RTEMS unless also using polled I/O for the SCI ports.]) +RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION + # Explicitly list a Makefile here AC_CONFIG_FILES([Makefile]) diff --git a/c/src/lib/libbsp/powerpc/ss555/startup/bspgetworkarea.c b/c/src/lib/libbsp/powerpc/ss555/startup/bspgetworkarea.c new file mode 100644 index 0000000000..fad31053c8 --- /dev/null +++ b/c/src/lib/libbsp/powerpc/ss555/startup/bspgetworkarea.c @@ -0,0 +1,33 @@ +/* + * 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 *RamEnd; +extern void *WorkspaceBase; + +/* + * 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 = (void *)&WorkspaceBase; + *work_area_size = (uintptr_t)&RamEnd - (uintptr_t)&WorkspaceBase; + *heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA; + *heap_size = BSP_BOOTCARD_HEAP_SIZE_DEFAULT; +} + diff --git a/c/src/lib/libbsp/powerpc/ss555/startup/bspstart.c b/c/src/lib/libbsp/powerpc/ss555/startup/bspstart.c index 0949bccca2..df2c17dc57 100644 --- a/c/src/lib/libbsp/powerpc/ss555/startup/bspstart.c +++ b/c/src/lib/libbsp/powerpc/ss555/startup/bspstart.c @@ -25,10 +25,6 @@ #warning The interrupt disable mask is now stored in SPRG0, please verify that this is compatible to this BSP (see also bootcard.c). -#include <string.h> - -#include <rtems/libio.h> -#include <rtems/libcsupport.h> #include <rtems/bspIo.h> #include <rtems/powerpc/powerpc.h> @@ -50,12 +46,6 @@ uint32_t bsp_clock_speed; /* Serial clocks per second */ uint32_t bsp_timer_least_valid; uint32_t bsp_timer_average_overhead; -/* - * Use the shared implementations of the following routines. - * Look in rtems/c/src/lib/libbsp/shared/bsplibc.c. - */ -void bsp_libc_init( void *, uint32_t, int ); - void BSP_panic(char *s) { printk("%s PANIC %s\n",_RTEMS_version, s); @@ -69,41 +59,6 @@ void _BSP_Fatal_error(unsigned int v) } /* - * bsp_pretasking_hook - * - * Called when RTEMS initialization is complete but before interrupts and - * tasking are enabled. Used to setup libc and install any BSP extensions. - * - * Must not use libc (to do io) from here, since drivers are not yet - * initialized. - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * Return values: NONE - */ -void bsp_pretasking_hook(void) -{ - /* - * These are assigned addresses in the linkcmds file for the BSP. This - * approach is better than having these defined as manifest constants and - * compiled into the kernel, but it is still not ideal when dealing with - * multiprocessor configuration in which each board as a different memory - * map. A better place for defining these symbols might be the makefiles. - * Consideration should also be given to developing an approach in which - * the kernel and the application can be linked and burned into ROM - * independently of each other. - */ - uint8_t *_HeapStart = - (uint8_t *)Configuration.work_space_start - + rtems_configuration_get_work_space_size(); - extern uint8_t _HeapEnd[]; - - bsp_libc_init( _HeapStart, _HeapEnd - _HeapStart, 0 ); -} - -/* * bsp_start() * * Board-specific initialization code. Called from the generic boot_card() @@ -125,8 +80,6 @@ void bsp_pretasking_hook(void) */ void bsp_start(void) { - extern char _WorkspaceBase[]; - ppc_cpu_id_t myCpu; ppc_cpu_revision_t myCpuRevision; register unsigned char* intrStack; @@ -151,18 +104,6 @@ void bsp_start(void) initialize_exceptions(); /* - * 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. - * - * In this case, the memory is not malloc'ed. It is just - * "pulled from the air". - */ - Configuration.work_space_start = _WorkspaceBase; - - /* * initialize the device driver parameters */ bsp_clicks_per_usec = BSP_CRYSTAL_HZ / 4 / 1000000; diff --git a/c/src/lib/libbsp/powerpc/ss555/startup/linkcmds b/c/src/lib/libbsp/powerpc/ss555/startup/linkcmds index 1f79cf0eea..3ed886c36c 100644 --- a/c/src/lib/libbsp/powerpc/ss555/startup/linkcmds +++ b/c/src/lib/libbsp/powerpc/ss555/startup/linkcmds @@ -235,9 +235,8 @@ SECTIONS intrStack = .; PROVIDE(intrStackPtr = intrStack); - _WorkspaceBase = .; - __WorkspaceBase = .; - + WorkspaceBase = .; + /* * Heap * @@ -246,10 +245,8 @@ SECTIONS * the external RAM. */ . = DEFINED(RTEMS_DEBUG) ? 0 + ext_ram_size : int_ram_top + ext_ram_size; - _HeapEnd = .; - __HeapEnd = .; + RamEnd = .; - /* * Internal I/O devices */ |