diff options
author | Thomas Doerfler <Thomas.Doerfler@embedded-brains.de> | 2010-04-07 06:44:41 +0000 |
---|---|---|
committer | Thomas Doerfler <Thomas.Doerfler@embedded-brains.de> | 2010-04-07 06:44:41 +0000 |
commit | 08013e8612a80079dac6d4c3f800fbd1438847ac (patch) | |
tree | feb049daa72f878a65976fd42cfd787e58778e8e /c/src/lib/libbsp/powerpc/mpc55xxevb/startup | |
parent | Regenerate. (diff) | |
download | rtems-08013e8612a80079dac6d4c3f800fbd1438847ac.tar.bz2 |
fixed to support GW_LCFM
Diffstat (limited to 'c/src/lib/libbsp/powerpc/mpc55xxevb/startup')
8 files changed, 469 insertions, 335 deletions
diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspgetworkarea.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspgetworkarea.c index 3d7aba56dd..f7d2eca157 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspgetworkarea.c +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspgetworkarea.c @@ -25,11 +25,9 @@ #define MPC55XX_INTERRUPT_STACK_SIZE 0x1000 /* Symbols defined in linker command file */ -LINKER_SYMBOL(bsp_ram_start); -LINKER_SYMBOL(bsp_ram_end); -LINKER_SYMBOL(bsp_external_ram_start); -LINKER_SYMBOL(bsp_external_ram_size); -LINKER_SYMBOL(bsp_section_bss_end); +LINKER_SYMBOL(bsp_workspace_start); +LINKER_SYMBOL(bsp_workspace_end); +LINKER_SYMBOL(bsp_external_ram_end); void bsp_get_work_area( void **work_area_start, @@ -38,9 +36,11 @@ void bsp_get_work_area( uintptr_t *heap_size ) { - *work_area_start = bsp_section_bss_end; - *work_area_size = bsp_ram_end - 2 * - MPC55XX_INTERRUPT_STACK_SIZE - bsp_section_bss_end; - *heap_start = bsp_external_ram_start; - *heap_size = (uintptr_t) bsp_external_ram_size; + size_t free_ram_size; + *work_area_start = bsp_workspace_start; + + free_ram_size = (uint8_t *)bsp_external_ram_end - (uint8_t *)*work_area_start; + *work_area_size = (free_ram_size / 2); + *heap_start = (void *)((uint8_t *)*work_area_start + *work_area_size); + *heap_size = (free_ram_size / 2); } diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspstart.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspstart.c index 76cb8fef2e..4835c93ddf 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspstart.c +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspstart.c @@ -159,7 +159,7 @@ const struct fmpll_syncr_vals_t { #endif /* ((MPC55XX_CHIP_DERIVATE>=5510) && (MPC55XX_CHIP_DERIVATE<=5517)) */ -#if defined(GWLCFM) +#if defined(BOARD_GWLCFM) static const mpc55xx_siu_pcr_entry_t siu_pcr_list[] = { { 0,16,{.B.PA = 1, .B.WPE = 0}}, /* PA[ 0..15] analog input */ { 16, 4,{.B.PA = 0,.B.OBE = 1,.B.WPE = 0}}, /* PB[ 0.. 4] LED/CAN_STBN out */ @@ -195,15 +195,19 @@ static const mpc55xx_siu_pcr_entry_t siu_pcr_list[] = { { 58, 4,{.B.PA = 0,.B.OBE = 1,.B.WPE = 0}}, /* PD[10..13] LS_CAN_EN/LED out*/ { 62, 4,{.B.PA = 0,.B.IBE = 1,.B.WPE = 0}}, /* PD[14..15] USB_FLGA/B in */ - { 64, 3,{.B.PA = 3,.B.IBE = 1,.B.WPE = 0}}, /* PE[ 0.. 2] MLBCLK/SI/DI in */ - { 67, 2,{.B.PA = 3,.B.OBE = 1,.B.WPE = 0}}, /* PE[ 3.. 4] MLBSO/DO out*/ - { 69, 1,{.B.PA = 3,.B.IBE = 1,.B.WPE = 0}}, /* PE[ 5.. 5] MLBSLOT in */ - { 70, 1,{.B.PA = 1,.B.OBE = 1,.B.WPE = 0}}, /* PE[ 6.. 6] CLKOUT out*/ - { 80, 1,{.B.PA = 1,.B.OBE = 1,.B.WPE = 0}}, /* PF[ 0.. 0] RD_WR out*/ - { 81, 1,{.B.PA = 0,.B.IBE = 1,.B.WPE = 0}}, /* PF[ 1.. 1] (nc) in */ - { 82,14,{.B.PA = 1,.B.OBE = 1,.B.WPE = 0}}, /* PF[ 2..14] ADDR/CS/... out*/ - { 96,16,{.B.PA = 1,.B.IBE = 1,.B.OBE = 1,.B.WPE = 0}}, - /* PG[ 0..15] AD16..31 in/out*/ + { 64, 3,{.B.PA = 3,.B.SRC = 1,.B.WPE = 0}}, /* PE[ 0.. 2] MLBCLK/SI/DI in */ + { 67, 2,{.B.PA = 3,.B.SRC = 1,.B.WPE = 0}}, /* PE[ 3.. 4] MLBSO/DO out*/ + { 69, 1,{.B.PA = 3,.B.SRC = 1,.B.WPE = 0}}, /* PE[ 5.. 5] MLBSLOT in */ + { 70, 1,{.B.PA = 1,.B.SRC = 3,.B.WPE = 0}}, /* PE[ 6.. 6] CLKOUT out*/ + + { 80, 1,{.B.PA = 1,.B.SRC = 1,.B.WPE = 0}}, /* PF[ 0.. 0] RD_WR out*/ + { 81, 1,{.B.PA = 0,.B.SRC = 0,.B.WPE = 0}}, /* PF[ 1.. 1] (nc) in */ + { 82, 8,{.B.PA = 2,.B.SRC = 1,.B.WPE = 0}}, /* PF[ 2..11] ADDR[8..15] out*/ + { 90, 2,{.B.PA = 1,.B.SRC = 1,.B.WPE = 0}}, /* PF[ 2..11] CS[0..1] out*/ + { 92, 1,{.B.PA = 3,.B.SRC = 3,.B.WPE = 0}}, /* PF[ 12] ALE out*/ + { 93, 3,{.B.PA = 1,.B.SRC = 1,.B.WPE = 0}}, /* PF[13..15] OE/WE out*/ + + { 96,16,{.B.PA = 1,.B.SRC = 1,.B.WPE = 0}}, /* PG[ 0..15] AD16..31 in/out*/ {112, 3,{.B.PA = 0,.B.OBE = 1,.B.WPE = 0}}, /* PH[ 0.. 2] LED_EXT1-3. out*/ {115, 1,{.B.PA = 3,.B.OBE = 1,.B.WPE = 0}}, /* PH[ 3.. 3] CS2_ETH out*/ @@ -228,7 +232,7 @@ static const mpc55xx_siu_pcr_entry_t siu_pcr_list[] = { {0,0} }; -#endif /* GWLCFM */ +#endif /* BOARD_GWLCFM */ static void mpc55xx_ebi_init(void) { @@ -240,6 +244,71 @@ static void mpc55xx_ebi_init(void) */ mpc55xx_siu_pcr_init(&SIU, siu_pcr_list); + +#if defined(BOARD_GWLCFM) + /* + * init EBI for Muxed AD bus + */ + EBI.MCR.B.DBM = 1; + EBI.MCR.B.ADMUX = 1; /* use multiplexed bus */ + EBI.MCR.B.D16_32 = 1; /* use lower AD bus */ + + SIU.ECCR.B.EBDF = 3; /* use CLK/4 as bus clock */ + + /* External SRAM (16 bit, 2 wait states, 512kB, no burst) */ + + cs.BR.B.BA = 0; + cs.BR.B.PS = 1; + cs.BR.B.AD_MUX = 1; + cs.BR.B.WEBS = 1; + cs.BR.B.TBDIP = 0; + cs.BR.B.BI = 1; + cs.BR.B.V = 1; + + cs.OR.B.AM = 0x1fff0; + cs.OR.B.SCY = 0; + cs.OR.B.BSCY = 0; + + EBI.CS [0] = cs; + + /* External Ethernet Controller (3 wait states, 64kB) */ + + mmu.MAS0.B.ESEL = 5; + mmu.MAS1.B.VALID = 1; + mmu.MAS1.B.IPROT = 1; + mmu.MAS1.B.TSIZ = 1; + mmu.MAS2.B.EPN = 0x3fff8; + mmu.MAS2.B.I = 1; + mmu.MAS2.B.G = 1; + mmu.MAS3.B.RPN = 0x3fff8; + mmu.MAS3.B.UW = 1; + mmu.MAS3.B.SW = 1; + mmu.MAS3.B.UR = 1; + mmu.MAS3.B.SR = 1; + + PPC_SET_SPECIAL_PURPOSE_REGISTER( FREESCALE_EIS_MAS0, mmu.MAS0.R); + PPC_SET_SPECIAL_PURPOSE_REGISTER( FREESCALE_EIS_MAS1, mmu.MAS1.R); + PPC_SET_SPECIAL_PURPOSE_REGISTER( FREESCALE_EIS_MAS2, mmu.MAS2.R); + PPC_SET_SPECIAL_PURPOSE_REGISTER( FREESCALE_EIS_MAS3, mmu.MAS3.R); + + asm volatile ("tlbwe"); + + cs.BR.B.BA = 0x7fff; + cs.BR.B.PS = 1; + cs.BR.B.BL = 0; + cs.BR.B.AD_MUX = 1; + cs.BR.B.WEBS = 0; + cs.BR.B.TBDIP = 0; + cs.BR.B.BI = 1; + cs.BR.B.V = 1; + + cs.OR.B.AM = 0x1ffff; + cs.OR.B.SCY = 1; + cs.OR.B.BSCY = 0; + + EBI.CS [3] = cs; +#else /* defined(BOARD_GWLCFM) */ + /* External SRAM (2 wait states, 512kB, 4 word burst) */ cs.BR.B.BA = 0; @@ -291,11 +360,18 @@ static void mpc55xx_ebi_init(void) cs.OR.B.BSCY = 0; EBI.CS [3] = cs; +#endif /* defined(BOARD_GWLCFM) */ } /** * @brief Start BSP. */ +LINKER_SYMBOL(bsp_section_bss_start); +LINKER_SYMBOL(bsp_section_bss_end); +LINKER_SYMBOL(bsp_section_sbss_start); +LINKER_SYMBOL(bsp_section_sbss_end); +LINKER_SYMBOL(bsp_section_vector_start); + void bsp_start(void) { rtems_status_code sc = RTEMS_SUCCESSFUL; @@ -305,6 +381,20 @@ void bsp_start(void) uintptr_t interrupt_stack_start = (uintptr_t)bsp_ram_end - 2 * MPC55XX_INTERRUPT_STACK_SIZE; uint32_t interrupt_stack_size = MPC55XX_INTERRUPT_STACK_SIZE; + + /* Initialize External Bus Interface */ + mpc55xx_ebi_init(); + + /* + * make sure BSS/SBSS is cleared + */ + memset(bsp_section_bss_start,0, + bsp_section_bss_end-bsp_section_bss_start); + memset(bsp_section_sbss_start,0, + bsp_section_sbss_end-bsp_section_sbss_start); + + ppc_exc_vector_base = bsp_section_vector_start; + RTEMS_DEBUG_PRINT( "BSP start ...\n"); RTEMS_DEBUG_PRINT( "System clock : %i\n", mpc55xx_get_system_clock()); @@ -326,8 +416,10 @@ void bsp_start(void) /* Time reference value */ bsp_clicks_per_usec = bsp_clock_speed / 1000000; - /* Initialize External Bus Interface */ - mpc55xx_ebi_init(); + /* + * determine clock speed + */ + bsp_clock_speed = mpc55xx_get_system_clock(); /* Initialize exceptions */ RTEMS_DEBUG_PRINT( "Initialize exceptions ...\n"); @@ -354,9 +446,8 @@ void bsp_start(void) /* Initialize eMIOS */ mpc55xx_emios_initialize( 1); - return; + mpc55xx_emios_set_global_prescaler(MPC55XX_EMIOS_PRESCALER); - /* TODO */ /* * Enable instruction and data caches. Do not force writethrough mode. */ diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds index c9109d2c1f..5c2161deba 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds @@ -1,278 +1 @@ -/** - * @file - * - * Derived from internal linker script of GNU ld (GNU Binutils) 2.18 for elf32ppc emulation. - */ - -OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") -OUTPUT_ARCH(powerpc) -ENTRY(start) - -INCLUDE linkcmds.memory - -SECTIONS -{ - .text : { - /* - * BSP: Start of text section - */ - bsp_section_text_start = .; - - /* - * BSP: System startup entry - */ - KEEP (*(.entry)) - - /* - * BSP: Moved into .text from .init - */ - KEEP (*(.init)) - - *(.text .stub .text.* .gnu.linkonce.t.*) - KEEP (*(.text.*personality*)) - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - *(.glink) - - /* - * BSP: Special FreeBSD sysctl sections - */ - . = ALIGN (16); - __start_set_sysctl_set = .; - *(set_sysctl_*); - __stop_set_sysctl_set = ABSOLUTE(.); - *(set_domain_*); - *(set_pseudo_*); - - /* - * BSP: Moved into .text from .* - */ - *(.rodata .rodata.* .gnu.linkonce.r.*) - *(.rodata1) - *(.interp) - *(.note.gnu.build-id) - *(.hash) - *(.gnu.hash) - *(.dynsym) - *(.dynstr) - *(.gnu.version) - *(.gnu.version_d) - *(.gnu.version_r) - *(.eh_frame_hdr) - - /* - * BSP: Magic PPC stuff - */ - *(.PPC.*) - - /* - * BSP: Required by cpukit/score/src/threadhandler.c - */ - PROVIDE (_fini = .); - - /* - * BSP: Moved into .text from .fini - */ - KEEP (*(.fini)) - - . = ALIGN (bsp_section_align); - - PROVIDE (__etext = .); - PROVIDE (_etext = .); - PROVIDE (etext = .); - } > ROM =0 - - .sdata2 : { - PROVIDE (_SDA2_BASE_ = 32768); - - *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) - - . = ALIGN (bsp_section_align); - } > ROM =0 - - .sbss2 : { - *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) - - . = ALIGN (bsp_section_align); - - /* - * BSP: End of text section - */ - bsp_section_text_end = .; - } > ROM =0 - - .data : AT (bsp_section_text_end) { - /* - * BSP: Start of data section - */ - bsp_section_data_start = .; - - /* - * BSP: Reserve space for exception handler - */ - . = . + 0x180; - - /* - * BSP: Moved into .data from .ctors - */ - /* gcc uses crtbegin.o to find the start of - the constructors, 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. */ - KEEP (*crtbegin.o(.ctors)) - KEEP (*crtbegin?.o(.ctors)) - /* We don't want to include the .ctor section from - the crtend.o file until after the sorted ctors. - The .ctor section from the crtend file contains the - end of ctors marker and it must be last */ - KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) - KEEP (*(SORT(.ctors.*))) - KEEP (*(.ctors)) - - /* - * BSP: Moved into .data from .dtors - */ - KEEP (*crtbegin.o(.dtors)) - KEEP (*crtbegin?.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - - /* - * BSP: Moved into .data from .* - */ - *(.tdata .tdata.* .gnu.linkonce.td.*) - *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) - *(.data1) - KEEP (*(.eh_frame)) - *(.gcc_except_table .gcc_except_table.*) - KEEP (*(.jcr)) - *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) - *(.fixup) - *(.got1) - *(.got2) - *(.dynamic) - *(.got) - *(.plt) - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP (*(.preinit_array)) - PROVIDE_HIDDEN (__preinit_array_end = .); - PROVIDE_HIDDEN (__init_array_start = .); - KEEP (*(SORT(.init_array.*))) - KEEP (*(.init_array)) - PROVIDE_HIDDEN (__init_array_end = .); - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP (*(.fini_array)) - KEEP (*(SORT(.fini_array.*))) - PROVIDE_HIDDEN (__fini_array_end = .); - - *(.data .data.* .gnu.linkonce.d.*) - KEEP (*(.gnu.linkonce.d.*personality*)) - SORT(CONSTRUCTORS) - - . = ALIGN (bsp_section_align); - } > RAM - - .sdata : { - PROVIDE (_SDA_BASE_ = 32768); - *(.sdata .sdata.* .gnu.linkonce.s.*) - - . = ALIGN (bsp_section_align); - - _edata = .; - PROVIDE (edata = .); - - /* - * BSP: End of data section - */ - bsp_section_data_end = .; - } > RAM - - .sbss : { - /* - * BSP: Start of bss section - */ - bsp_section_bss_start = .; - - __bss_start = .; - - PROVIDE (__sbss_start = .); PROVIDE (___sbss_start = .); - *(.scommon) - *(.dynsbss) - *(.sbss .sbss.* .gnu.linkonce.sb.*) - PROVIDE (__sbss_end = .); PROVIDE (___sbss_end = .); - - . = ALIGN (bsp_section_align); - } > RAM - - .bss : { - *(COMMON) - *(.dynbss) - *(.bss .bss.* .gnu.linkonce.b.*) - - . = ALIGN (bsp_section_align); - - __end = .; - _end = .; - PROVIDE (end = .); - - /* - * BSP: End of bss section - */ - bsp_section_bss_end = .; - } > RAM - - /* 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) } - /* DWARF debug sections. - Symbols in the DWARF debugging sections are relative to the beginning - of the section so we begin them at 0. */ - /* DWARF 1 */ - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - /* GNU DWARF 1 extensions */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - /* DWARF 1.1 and DWARF 2 */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - /* DWARF 2 */ - .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - /* SGI/MIPS DWARF 2 extensions */ - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } - /* DWARF 3 */ - .debug_pubtypes 0 : { *(.debug_pubtypes) } - .debug_ranges 0 : { *(.debug_ranges) } - .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } - - /DISCARD/ : { - *(.note.GNU-stack) *(.gnu_debuglink) - } - - /* - * BSP: Catch all unknown sections - */ - .nirvana : { - *(*) - } > NIRVANA -} +include linkcmds.mpc55xxevb diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.base b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.base new file mode 100644 index 0000000000..0d82d43449 --- /dev/null +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.base @@ -0,0 +1,284 @@ +/** + * @file + * + * Derived from internal linker script of GNU ld (GNU Binutils) 2.18 for elf32ppc emulation. + */ + +OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") +OUTPUT_ARCH(powerpc) +ENTRY(start) + +SECTIONS +{ + .text : { + /* + * BSP: Start of text section + */ + bsp_section_text_start = .; + + /* + * BSP: System startup entry + */ + KEEP (*(.entry)) + + /* + * BSP: Moved into .text from .init + */ + KEEP (*(.init)) + + *(.text .stub .text.* .gnu.linkonce.t.*) + KEEP (*(.text.*personality*)) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.glink) + + /* + * BSP: Special FreeBSD sysctl sections + */ + . = ALIGN (16); + __start_set_sysctl_set = .; + *(set_sysctl_*); + __stop_set_sysctl_set = ABSOLUTE(.); + *(set_domain_*); + *(set_pseudo_*); + + /* + * BSP: Moved into .text from .* + */ + *(.rodata .rodata.* .gnu.linkonce.r.*) + *(.rodata1) + *(.interp) + *(.note.gnu.build-id) + *(.hash) + *(.gnu.hash) + *(.dynsym) + *(.dynstr) + *(.gnu.version) + *(.gnu.version_d) + *(.gnu.version_r) + *(.eh_frame_hdr) + + /* + * BSP: Magic PPC stuff + */ + *(.PPC.*) + + /* + * BSP: Required by cpukit/score/src/threadhandler.c + */ + PROVIDE (_fini = .); + + /* + * BSP: Moved into .text from .fini + */ + KEEP (*(.fini)) + + . = ALIGN (bsp_section_align); + + PROVIDE (__etext = .); + PROVIDE (_etext = .); + PROVIDE (etext = .); + } > REGION_TEXT =0 + + .sdata2 : { + PROVIDE (_SDA2_BASE_ = 32768); + + *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) + + . = ALIGN (bsp_section_align); + /* + * BSP: End of text section + */ + bsp_section_text_end = .; + } > REGION_TEXT =0 + + .vectors : { + . = ALIGN (bsp_section_align); + bsp_section_vector_start = .; + /* + * BSP: Reserve space for exception handler + */ + . = . + 0x180; + . = ALIGN (bsp_section_align); + } > REGION_VECTORS + + .data : AT (bsp_section_text_end) { + /* + * BSP: Start of data section + */ + bsp_section_data_start = .; + + + /* + * BSP: Moved into .data from .ctors + */ + /* gcc uses crtbegin.o to find the start of + the constructors, 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. */ + KEEP (*crtbegin.o(.ctors)) + KEEP (*crtbegin?.o(.ctors)) + /* We don't want to include the .ctor section from + the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + + /* + * BSP: Moved into .data from .dtors + */ + KEEP (*crtbegin.o(.dtors)) + KEEP (*crtbegin?.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + + /* + * BSP: Moved into .data from .* + */ + *(.tdata .tdata.* .gnu.linkonce.td.*) + *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) + *(.data1) + KEEP (*(.eh_frame)) + *(.gcc_except_table .gcc_except_table.*) + KEEP (*(.jcr)) + *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) + *(.fixup) + *(.got1) + *(.got2) + *(.dynamic) + *(.got) + *(.plt) + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + PROVIDE_HIDDEN (__fini_array_end = .); + + *(.data .data.* .gnu.linkonce.d.*) + KEEP (*(.gnu.linkonce.d.*personality*)) + SORT(CONSTRUCTORS) + + . = ALIGN (bsp_section_align); + } > REGION_DATA + + .sdata : { + PROVIDE (_SDA_BASE_ = 32768); + *(.sdata .sdata.* .gnu.linkonce.s.*) + + . = ALIGN (bsp_section_align); + + _edata = .; + PROVIDE (edata = .); + + /* + * BSP: End of data section + */ + bsp_section_data_end = .; + } > REGION_DATA + + .sbss : { + /* + * BSP: Start of bss section + */ + bsp_section_sbss_start = .; + + __bss_start = .; + + PROVIDE (__sbss_start = .); PROVIDE (___sbss_start = .); + *(.scommon) + *(.dynsbss) + *(.sbss .sbss.* .gnu.linkonce.sb.*) + PROVIDE (__sbss_end = .); PROVIDE (___sbss_end = .); + + . = ALIGN (bsp_section_align); + bsp_section_sbss_end = .; + } > REGION_DATA + + .sbss2 : { + bsp_section_bss_start = .; + *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) + + . = ALIGN (bsp_section_align); + + } > REGION_BSS + + .bss : { + *(COMMON) + *(.dynbss) + *(.bss .bss.* .gnu.linkonce.b.*) + + . = ALIGN (bsp_section_align); + + __end = .; + _end = .; + PROVIDE (end = .); + + /* + * BSP: End of bss section + */ + bsp_section_bss_end = .; + } > REGION_BSS + + /* 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) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* DWARF 3 */ + .debug_pubtypes 0 : { *(.debug_pubtypes) } + .debug_ranges 0 : { *(.debug_ranges) } + .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } + + /DISCARD/ : { + *(.note.GNU-stack) *(.gnu_debuglink) + } + + /* + * BSP: Catch all unknown sections + */ + .nirvana : { + *(*) + } > NIRVANA +} diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.gwlcfm b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.gwlcfm new file mode 100644 index 0000000000..6553e1aa84 --- /dev/null +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.gwlcfm @@ -0,0 +1,31 @@ +MEMORY +{ + ROM (RX) : ORIGIN = 0x0, LENGTH = 1536M + RAM (AIW) : ORIGIN = 0x40000000, LENGTH = 80K + RAM_EXT : ORIGIN = 0x20000000, LENGTH = 512K + NIRVANA : ORIGIN = 0x0, LENGTH = 0 +} + +bsp_ram_start = ORIGIN (RAM); +bsp_ram_end = ORIGIN (RAM) + LENGTH (RAM); +bsp_ram_size = LENGTH (RAM); + +bsp_rom_start = ORIGIN (ROM); +bsp_rom_end = ORIGIN (ROM) + LENGTH (ROM); +bsp_rom_size = LENGTH (ROM); + +bsp_external_ram_start = ORIGIN (RAM_EXT); +bsp_external_ram_end = ORIGIN (RAM_EXT) + LENGTH (RAM_EXT); +bsp_external_ram_size = LENGTH (RAM_EXT); + +bsp_section_align = 32; + +REGION_ALIAS ("REGION_TEXT", ROM); +REGION_ALIAS ("REGION_VECTORS", RAM); +REGION_ALIAS ("REGION_DATA", RAM); +REGION_ALIAS ("REGION_BSS", RAM_EXT); + +INCLUDE linkcmds.base + +bsp_workspace_start = bsp_section_bss_end; + diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.memory b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.memory deleted file mode 100644 index 344195c897..0000000000 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.memory +++ /dev/null @@ -1,21 +0,0 @@ -MEMORY -{ - ROM (RX) : ORIGIN = 0x0, LENGTH = 3M - RAM (AIW) : ORIGIN = 0x40000000, LENGTH = 128K - EXT_RAM : ORIGIN = 0x20000000, LENGTH = 512K - NIRVANA : ORIGIN = 0x0, LENGTH = 0 -} - -bsp_ram_start = ORIGIN (RAM); -bsp_ram_end = ORIGIN (RAM) + LENGTH (RAM); -bsp_ram_size = LENGTH (RAM); - -bsp_rom_start = ORIGIN (ROM); -bsp_rom_end = ORIGIN (ROM) + LENGTH (ROM); -bsp_rom_size = LENGTH (ROM); - -bsp_external_ram_start = ORIGIN (EXT_RAM); -bsp_external_ram_end = ORIGIN (EXT_RAM) + LENGTH (EXT_RAM); -bsp_external_ram_size = LENGTH (EXT_RAM); - -bsp_section_align = 32; diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5566evb b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5566evb new file mode 100644 index 0000000000..a3acf2f6d6 --- /dev/null +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5566evb @@ -0,0 +1,31 @@ +MEMORY +{ + ROM (RX) : ORIGIN = 0x0, LENGTH = 3M + RAM (AIW) : ORIGIN = 0x40000000, LENGTH = 128K + RAM_EXT : ORIGIN = 0x20000000, LENGTH = 512K + NIRVANA : ORIGIN = 0x0, LENGTH = 0 +} + +bsp_ram_start = ORIGIN (RAM); +bsp_ram_end = ORIGIN (RAM) + LENGTH (RAM); +bsp_ram_size = LENGTH (RAM); + +bsp_rom_start = ORIGIN (ROM); +bsp_rom_end = ORIGIN (ROM) + LENGTH (ROM); +bsp_rom_size = LENGTH (ROM); + +bsp_external_ram_start = ORIGIN (RAM_EXT); +bsp_external_ram_end = ORIGIN (RAM_EXT) + LENGTH (RAM_EXT); +bsp_external_ram_size = LENGTH (RAM_EXT); + +bsp_section_align = 32; + +REGION_ALIAS ("REGION_TEXT", ROM); +REGION_ALIAS ("REGION_VECTORS", RAM); +REGION_ALIAS ("REGION_DATA", RAM); +REGION_ALIAS ("REGION_BSS", RAM_EXT); + +INCLUDE linkcmds.base + +bsp_workspace_start = bsp_section_bss_end; + diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start.S b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start.S index 67efea8a99..9e6bf84093 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start.S +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start.S @@ -26,7 +26,8 @@ #include <libcpu/powerpc-utility.h> #include <mpc55xx/reg-defs.h> - +#include <bspopts.h> + .section ".entry", "ax" PUBLIC_VAR (start) .globl fmpll_syncr_vals @@ -82,8 +83,10 @@ start: /* Config internal flash */ bl SYM (mpc55xx_flash_config) +#if DATA_CACHE_ENABLE || INSTRUCTION_CACHE_ENABLE /* FIXME: Config cache */ bl config_cache +#endif /* DATA_CACHE_ENABLE || INSTRUCTION_CACHE_ENABLE */ /* * TODO, FIXME: Enable cache in the MMU for the SRAM @@ -127,11 +130,11 @@ start: LA r4, bsp_ram_end /* Assert: Proper alignment of destination start */ - andi. r6, r3, 0x37 + andi. r6, r3, 0x3f bne twiddle /* Assert: Proper alignment of destination end */ - andi. r6, r4, 0x37 + andi. r6, r4, 0x3f bne twiddle /* Data size = destination end - destination start */ @@ -181,14 +184,6 @@ start: /* * Prepare high level initialization */ - LA r3, bsp_ram_start - LA r4, ppc_exc_vector_base - stw r3, 0(r4) - - /* Set global BSP clock speed variable */ - bl SYM (mpc55xx_get_system_clock) - LA r4, bsp_clock_speed - stw r3, 0(r4) /* Create NULL */ li r0, 0 |