diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-09-15 22:05:14 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-09-15 22:05:14 +0000 |
commit | 0f70711148e464d5e2e09b44e6c2f82909c083e3 (patch) | |
tree | 8a618540fbeaacf1ddc3a016a0b48a22f03fb5bb /c/src/lib/libbsp/powerpc/mpc8260ads | |
parent | 2008-09-15 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-0f70711148e464d5e2e09b44e6c2f82909c083e3.tar.bz2 |
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.
Diffstat (limited to 'c/src/lib/libbsp/powerpc/mpc8260ads')
6 files changed, 79 insertions, 104 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 */ |