diff options
author | Thomas Doerfler <Thomas.Doerfler@embedded-brains.de> | 2009-10-16 12:53:50 +0000 |
---|---|---|
committer | Thomas Doerfler <Thomas.Doerfler@embedded-brains.de> | 2009-10-16 12:53:50 +0000 |
commit | a9d0c6ecd8b8d87eb27fbc2050d5e0bd77e6ad8e (patch) | |
tree | 0ec97124fe2d40368085735c188694d8dcba8b60 /c/src/lib/libbsp/m68k/genmcf548x/startup | |
parent | 2009-10-16 Ralf Corsépius <ralf.corsepius@rtems.org> (diff) | |
download | rtems-a9d0c6ecd8b8d87eb27fbc2050d5e0bd77e6ad8e.tar.bz2 |
added support for COBRA5475 board
Diffstat (limited to 'c/src/lib/libbsp/m68k/genmcf548x/startup')
4 files changed, 239 insertions, 4 deletions
diff --git a/c/src/lib/libbsp/m68k/genmcf548x/startup/init548x.c b/c/src/lib/libbsp/m68k/genmcf548x/startup/init548x.c index 342cd3e9f8..7c4a83605a 100644 --- a/c/src/lib/libbsp/m68k/genmcf548x/startup/init548x.c +++ b/c/src/lib/libbsp/m68k/genmcf548x/startup/init548x.c @@ -46,6 +46,7 @@ #include <rtems.h> #include <bsp.h> +#if defined(HAS_LOW_LEVEL_INIT) #define SYSTEM_PERIOD 10 /* system bus period in ns */ /* SDRAM Timing Parameters */ @@ -55,6 +56,7 @@ #define SDRAM_TRP 20 /* in ns */ #define SDRAM_TRFC 75 /* in ns */ #define SDRAM_TREFI 7800 /* in ns */ +#endif /* defined(HAS_LOW_LEVEL_INIT) */ extern uint8_t _DataRom[]; extern uint8_t _DataRam[]; @@ -78,8 +80,7 @@ void mcf548x_init(void) uint32_t n; uint8_t *dp, *sp; - /* set XLB arbiter timeouts */ -#ifdef M5484FIREENGINE +#if defined(HAS_LOW_LEVEL_INIT) /* set XLB arbiter timeouts */ MCF548X_XLB_ADRTO = 0x00000100; MCF548X_XLB_DATTO = 0x00000100; @@ -87,8 +88,10 @@ void mcf548x_init(void) #endif gpio_init(); +#if defined(HAS_LOW_LEVEL_INIT) fbcs_init(); sdramc_init(); +#endif /* defined(HAS_LOW_LEVEL_INIT) */ /* Copy the vector table to RAM */ if (_VectorRam != InterruptVectorTable) @@ -122,6 +125,7 @@ void mcf548x_init(void) } /********************************************************************/ +#if defined(HAS_LOW_LEVEL_INIT) void fbcs_init (void) { @@ -184,8 +188,10 @@ if(!(MCF548X_FBCS_CSMR1 & MCF548X_FBCS_CSMR_V)) #endif } +#endif defined(HAS_LOW_LEVEL_INIT) /********************************************************************/ +#if defined(HAS_LOW_LEVEL_INIT) void sdramc_init (void) { @@ -287,6 +293,7 @@ sdramc_init (void) } } +#endif /* defined(HAS_LOW_LEVEL_INIT) */ /********************************************************************/ void diff --git a/c/src/lib/libbsp/m68k/genmcf548x/startup/linkcmds b/c/src/lib/libbsp/m68k/genmcf548x/startup/linkcmds index 0fe1616550..a2e92a8cb0 100644 --- a/c/src/lib/libbsp/m68k/genmcf548x/startup/linkcmds +++ b/c/src/lib/libbsp/m68k/genmcf548x/startup/linkcmds @@ -70,7 +70,6 @@ _DataEnd = DEFINED(_DataEnd) ? _DataEnd : _data_dest_end; _BssStart = DEFINED(_BssStart) ? _BssStart : _clear_start; _BssEnd = DEFINED(_BssEnd) ? _BssEnd : _clear_end; _SpInit = DEFINED(_SpInit) ? _SpInit : _EndInitStackSpace; -_InitPc = DEFINED(_InitPc) ? _InitPc : _SdramBase + 0x400; _InitStackSize = DEFINED(StackSize) ? StackSize : 0x800; /* 2 kB */ _TopRamReserved = DEFINED(_TopRamReserved) ? _TopRamReserved : 0; diff --git a/c/src/lib/libbsp/m68k/genmcf548x/startup/linkcmds.COBRA5475 b/c/src/lib/libbsp/m68k/genmcf548x/startup/linkcmds.COBRA5475 new file mode 100644 index 0000000000..468c41abb4 --- /dev/null +++ b/c/src/lib/libbsp/m68k/genmcf548x/startup/linkcmds.COBRA5475 @@ -0,0 +1,230 @@ +/*===============================================================*\ +| Project: RTEMS generic mcf548x BSP | ++-----------------------------------------------------------------+ +| File: linkcmds.COBRA5475 | ++-----------------------------------------------------------------+ +| The file contains the linker directives for the generic MCF548x | +| BSP to be used with an COBRA5475 board to load and execute | +| code in the RAM. | ++-----------------------------------------------------------------+ +| Copyright (c) 2007 | +| Embedded Brains GmbH | +| Obere Lagerstr. 30 | +| D-82178 Puchheim | +| Germany | +| rtems@embedded-brains.de | ++-----------------------------------------------------------------+ +| | +| Parts of the code has been derived from the "dBUG source code" | +| package Freescale is providing for M548X EVBs. The usage of | +| the modified or unmodified code and it's integration into the | +| generic mcf548x BSP has been done according to the Freescale | +| license terms. | +| | +| The Freescale license terms can be reviewed in the file | +| | +| Freescale_license.txt | +| | ++-----------------------------------------------------------------+ +| | +| The generic mcf548x BSP has been developed on the basic | +| structures and modules of the av5282 BSP. | +| | ++-----------------------------------------------------------------+ +| | +| 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. | +| | ++-----------------------------------------------------------------+ +| | +| date history ID | +| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | +| 12.11.07 1.0 ras | +| 15.10.09 1.1, adapted to COBRA5475 doe | +| | +\*===============================================================*/ + +/* + * Location and size of on-chip devices + */ +_SdramBase = DEFINED(_SdramBase) ? _SdramBase : 0xf0000000; +_SdramSize = DEFINED(_SdramSize) ? _SdramSize : (128 * 1024*1024); +_SysSramBase = DEFINED(_SysSramBase) ? _SysSramBase : __MBAR + 0x00010000; +_SysSramSize = DEFINED(_SysSramSize) ? _SysSramSize : (32 * 1024); +_McdapiBase = DEFINED(_McdapiBase) ? _McdapiBase : _SysSramBase; +_McdapiSize = DEFINED(_McdapiSize) ? _McdapiSize : (12 * 1024); +_CoreSramBase0 = DEFINED(_CoreSramBase0) ? _CoreSramBase0 : 0xFF000000; +_CoreSramBase1 = DEFINED(_CoreSramBase1) ? _CoreSramBase1 : 0xFF001000; +_CoreSramSize0 = DEFINED(_CoreSramSize0) ? _CoreSramSize0 : (4 * 1024); +_CoreSramSize1 = DEFINED(_CoreSramSize1) ? _CoreSramSize1 : (4 * 1024); +_BootFlashBase = DEFINED(_BootFlashBase) ? _BootFlashBase : 0xFC000000; +_BootFlashSize = DEFINED(_BootFlashSize) ? _BootFlashSize : (32 * 1024*1024); + +_VectorRam = DEFINED(_VectorRam) ? _VectorRam : _SdramBase; +_DataRam = DEFINED(_DataRam) ? _DataRam : _data_dest_start; +_DataRom = DEFINED(_DataRom) ? _DataRom : _data_src_start; +_DataEnd = DEFINED(_DataEnd) ? _DataEnd : _data_dest_end; +_BssStart = DEFINED(_BssStart) ? _BssStart : _clear_start; +_BssEnd = DEFINED(_BssEnd) ? _BssEnd : _clear_end; +_SpInit = DEFINED(_SpInit) ? _SpInit : _EndInitStackSpace; + +_InitStackSize = DEFINED(StackSize) ? StackSize : 0x800; /* 2 kB */ +_TopRamReserved = DEFINED(_TopRamReserved) ? _TopRamReserved : 0; + +RamBase = DEFINED(_SdramBase) ? _SdramBase : _SdramBase; +RamSize = DEFINED(_SdramSize) ? _SdramSize : _SdramSize; +HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0; +_VBR = DEFINED(_VBR) ? _VBR : RamBase; + +__MBAR = DEFINED(__MBAR) ? __MBAR : 0xFE000000; + +ENTRY(start) +MEMORY +{ + sdram : ORIGIN = 0xF0040000, LENGTH = 128M - 256K + boot_flash : ORIGIN = 0xFC000000, LENGTH = 32M +} + +SECTIONS +{ + + _header_offset = 0; + + /* + * Text, data and bss segments .vectors + */ + .vectors : { + *(.vectors*) + } >sdram + .text : { + + *(.text*) + *(.ram_code) + + /* + * C++ constructors/destructors + */ + *(.gnu.linkonce.t.*) + + /* + * Initialization and finalization code. + * + * Various files can provide initialization and finalization + * functions. crtbegin.o and crtend.o are two instances. The + * body of these functions are in .init and .fini sections. We + * accumulate the bodies here, and prepend function prologues + * from crti.o and function epilogues from crtn.o. crti.o must + * be linked first; crtn.o must be linked last. Because these + * are wildcards, it doesn't matter if the user does not + * actually link against crti.o and crtn.o; the linker won't + * look for a file to match a wildcard. The wildcard also + * means that it doesn't matter which directory crti.o and + * crtn.o are in. + */ + PROVIDE (_init = .); + *crti.o(.init) + *(.init) + *crtn.o(.init) + PROVIDE (_fini = .); + *crti.o(.fini) + *(.fini) + *crtn.o(.fini) + + /* + * Special FreeBSD sysctl sections. + */ + . = ALIGN (16); + __start_set_sysctl_set = .; + *(set_sysctl_*); + __stop_set_sysctl_set = ABSOLUTE(.); + *(set_domain_*); + *(set_pseudo_*); + + + /* + * C++ constructors/destructors + * + * gcc uses crtbegin.o to find the start of the constructors + * and destructors so we make sure it is first. Because this + * is a wildcard, it doesn't matter if the user does not + * actually link against crtbegin.o; the linker won't look for + * a file to match a wildcard. The wildcard also means that + * it doesn't matter which directory crtbegin.o is in. The + * constructor and destructor list are terminated in + * crtend.o. The same comments apply to it. + */ + . = ALIGN (16); + *crtbegin.o(.ctors) + *(.ctors) + *crtend.o(.ctors) + *crtbegin.o(.dtors) + *(.dtors) + *crtend.o(.dtors) + + /* + * Exception frame info + */ + . = ALIGN (16); + *(.eh_frame) + + /* + * Read-only data + */ + . = ALIGN (16); + _rodata_start = . ; + *(.rodata*) + *(.gnu.linkonce.r*) + + . = ALIGN (16); + + *(.console_gdb_xfer) + *(.bootstrap_data) + . = ALIGN(16); + _estuff = .; + PROVIDE (_etext = .); + } >sdram + + .data : { + /*.data : {*/ + PROVIDE( _data_dest_start = . ); + PROVIDE( _copy_start = .); + *(.data*) + *(.gnu.linkonce.d*) + *(.gcc_except_table*) + *(.jcr) + . = ALIGN (16); + PROVIDE (_edata = .); + PROVIDE (_copy_end = .); + PROVIDE (_data_dest_end = . ); + } >sdram + + _data_src_start = _etext; /*LOADADDR(.data);*/ + _data_src_end = _data_src_start + SIZEOF(.data); + + .bss : { + PROVIDE (_clear_start = .); + *(.bss*) + *(COMMON) + . = ALIGN (16); + PROVIDE (end = .); + PROVIDE (_clear_end = .); + . = ALIGN (4); + PROVIDE (_StartInitStackSpace = .); + /*. = _StartInitStackSpace + _InitStackSize;*/ + . += _InitStackSize; + PROVIDE (_EndInitStackSpace = .); + PROVIDE (WorkAreaBase = .); + } >sdram + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + +PROVIDE (end_of_all = .); +} diff --git a/c/src/lib/libbsp/m68k/genmcf548x/startup/linkcmds.m5484FireEngine.flash b/c/src/lib/libbsp/m68k/genmcf548x/startup/linkcmds.m5484FireEngine.flash index a0ee240c75..d08470730f 100644 --- a/c/src/lib/libbsp/m68k/genmcf548x/startup/linkcmds.m5484FireEngine.flash +++ b/c/src/lib/libbsp/m68k/genmcf548x/startup/linkcmds.m5484FireEngine.flash @@ -70,7 +70,6 @@ _DataEnd = DEFINED(_DataEnd) ? _DataEnd : _data_dest_end; _BssStart = DEFINED(_BssStart) ? _BssStart : _clear_start; _BssEnd = DEFINED(_BssEnd) ? _BssEnd : _clear_end; _SpInit = DEFINED(_SpInit) ? _SpInit : _EndInitStackSpace; -_InitPc = DEFINED(_InitPc) ? _InitPc : _SdramBase + 0x400; _InitStackSize = DEFINED(StackSize) ? StackSize : 0x2000; /* 8 kB */ _TopRamReserved= DEFINED(_TopRamReserved) ? _TopRamReserved : 0; |