From 84e59b7c04e47c3ec7aa95f53509fd812eee725e Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 15 Nov 2018 20:47:22 +0100 Subject: bsps/powerpc: Use interrupt stack for init stack Move start.o to separate file. Update #3459. --- bsps/powerpc/gen5200/start/start.S | 16 +- bsps/powerpc/gen83xx/start/start.S | 11 +- bsps/powerpc/haleakala/start/dlentry.S | 237 ------------------------- bsps/powerpc/haleakala/start/linkcmds | 1 + bsps/powerpc/haleakala/start/start.S | 237 +++++++++++++++++++++++++ bsps/powerpc/mpc8260ads/start/start.S | 17 +- bsps/powerpc/mvme3100/start/start.S | 19 +- bsps/powerpc/mvme5500/start/start.S | 25 +-- bsps/powerpc/shared/start/linkcmds.share | 3 - bsps/powerpc/shared/start/start.S | 27 +-- bsps/powerpc/ss555/start/linkcmds | 1 + bsps/powerpc/virtex/start/start.S | 16 +- bsps/powerpc/virtex4/start/linkcmds | 1 + bsps/powerpc/virtex5/start/linkcmds | 1 + c/src/lib/libbsp/powerpc/haleakala/Makefile.am | 9 +- c/src/lib/libbsp/powerpc/ss555/Makefile.am | 7 +- c/src/lib/libbsp/powerpc/virtex/configure.ac | 6 - c/src/lib/libbsp/powerpc/virtex4/Makefile.am | 7 +- c/src/lib/libbsp/powerpc/virtex5/Makefile.am | 7 +- 19 files changed, 321 insertions(+), 327 deletions(-) delete mode 100644 bsps/powerpc/haleakala/start/dlentry.S create mode 100644 bsps/powerpc/haleakala/start/start.S diff --git a/bsps/powerpc/gen5200/start/start.S b/bsps/powerpc/gen5200/start/start.S index 0c2dfd5989..9e9e504861 100644 --- a/bsps/powerpc/gen5200/start/start.S +++ b/bsps/powerpc/gen5200/start/start.S @@ -90,7 +90,9 @@ /* */ /***********************************************************************/ +#include #include +#include #include #include @@ -470,12 +472,14 @@ skip_ROM_start: bl bsp_uboot_copy_board_info #endif /* HAS_UBOOT */ -/* set stack pointer (common for RAM/ROM startup) */ - LA r1, bsp_section_text_start - addi r1, r1, -0x10 /* Set up stack pointer = beginning of text section - 0x10 */ - /* tag TOS with a NULL pointer (termination mark for stack dump) */ - li r0, 0 - stw r0, 0(r1) + /* + * Initialize start stack (common for RAM/ROM startup). The stacks are + * statically allocated and properly aligned. + */ + LA r1, _ISR_Stack_area_end + subi r1, r1, PPC_DEFAULT_CACHE_LINE_SIZE + li r0, 0 + stw r0, 0(r1) bl __eabi /* Set up EABI and SYSV environment */ diff --git a/bsps/powerpc/gen83xx/start/start.S b/bsps/powerpc/gen83xx/start/start.S index 532210e4b9..943ced4d59 100644 --- a/bsps/powerpc/gen83xx/start/start.S +++ b/bsps/powerpc/gen83xx/start/start.S @@ -413,13 +413,16 @@ start_code_in_ram: /* Read-write small data */ LA r13, _SDA_BASE_ - /* Clear cmdline */ + /* Clear cmdline */ li r3, 0 - /* Set start stack pointer */ + /* + * Initialize start stack. The stacks are statically allocated and + * properly aligned. + */ LA r1, _ISR_Stack_area_end - stwu r3, -4(r1) - stwu r3, -4(r1) + subi r1, r1, PPC_DEFAULT_CACHE_LINE_SIZE + stw r3, 0(r1) /* Call the first C routine */ bl SYM (boot_card) diff --git a/bsps/powerpc/haleakala/start/dlentry.S b/bsps/powerpc/haleakala/start/dlentry.S deleted file mode 100644 index 43dde91255..0000000000 --- a/bsps/powerpc/haleakala/start/dlentry.S +++ /dev/null @@ -1,237 +0,0 @@ -/* dlentry.s - * - * This file contains the entry code for RTEMS programs starting - * after download to RAM - * - * Author: Thomas Doerfler - * IMD Ingenieurbuero fuer Microcomputertechnik - * - * COPYRIGHT (c) 1998 by IMD - * - * Changes from IMD are covered by the original distributions terms. - * This file has been derived from the papyrus BSP: - * - * This file contains the entry veneer for RTEMS programs - * downloaded to Papyrus. - * - * Author: Andrew Bray - * - * COPYRIGHT (c) 1995 by i-cubed ltd. - * - * To anyone who acknowledges that this file is provided "AS IS" - * without any express or implied warranty: - * permission to use, copy, modify, and distribute this file - * for any purpose is hereby granted without fee, provided that - * the above copyright notice and this notice appears in all - * copies, and that the name of i-cubed limited not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * i-cubed limited makes no representations about the suitability - * of this software for any purpose. - * - * derived from "helas403/dlentry.S": - * - * Further changes to derive for the PPC405CR/GP/GPr/EX/EXr - * by Michael Hamel ADInstruments Ltd 2008 - */ - -#include - -/* - * The virtex ELF link scripts support three special sections: - * .entry The actual entry point - * .vectors The section containing the interrupt entry veneers. - */ - -/* - * Downloaded code loads the vectors separately to 0x00000100, - * so .entry can be over 256 bytes. - * - * The other sections are linked in the following order: - * .entry - * .text - * .data - * .bss - * see linker command file for section placement - * - * The initial stack is set to _ISR_Stack_area_end. - * - * All the entry veneer has to do is to clear the BSS. - */ - -/* - * GDB likes to have debugging information for the entry veneer. - * Here was some DWARF information. IMD removed it, because we - * could not check, whether it was still correct. Sorry. - - */ - - - .section .entry - - PUBLIC_VAR (start) - PUBLIC_VAR (download_entry) - PUBLIC_VAR (__rtems_entry_point) - -SYM(start): -SYM(download_entry): -SYM(__rtems_entry_point): - - .extern SYM (boot_card) - - bl .startup /* First word is branch to reset_entry */ - - -/*--------------------------------------------------------------------------- - * Parameters from linker - *--------------------------------------------------------------------------*/ - -base_addr: -toc_pointer: - .long s.got -bss_length: - .long bss.size -bss_addr: - .long bss.start -sbss_length: - .long sbss.size -sbss_addr: - .long sbss.start -stack_top: - .long _ISR_Stack_area_end -PUBLIC_VAR (text_addr) -text_addr: - .long text.start -PUBLIC_VAR (text_length) -text_length: - .long text.size - -/*--------------------------------------------------------------------------- - * Reset_entry. - *--------------------------------------------------------------------------*/ -.startup: - /* Get entrypoint address in R1 so we can find linker variables */ - mflr r1 - - /* Initialise procesor registers generally */ - bl init405 - - /* Clear .bss and .sbss */ - bl bssclr - - /*------------------------------------------------------------------- - * C_setup. - *------------------------------------------------------------------*/ - lwz r1,stack_top - base_addr(r1) /* Now set R1 to stack_top */ - addi r1,r1,-56-4 /* start stack at text_addr - 56 */ - li r3,0 - stw r3, 0(r1) /* Clear stack chain */ - stw r3, 4(r1) - stw r3, 8(r1) - stw r3, 12(r1) - - bl __eabi /* Initialise EABI: sets up r2 & r13 */ - - li r3, 0 /* command line */ - - b SYM (boot_card) /* call the first C routine */ - -/*--------------------------------------------------------------------------- - * bssclr. - *--------------------------------------------------------------------------*/ -bssclr: lwz r2,bss_addr-base_addr(r1) /* start of bss set by loader */ - lwz r3,bss_length-base_addr(r1) /* bss length */ - srwi. r3,r3,2 /* div 4 to get # of words */ - li r0,0 - beq dosbss /* no bss */ - mtctr r3 /* set ctr reg */ - subi r2,r2,4 -clear_bss: stwu r0,4(r2) - bdnz clear_bss /* decrement counter and loop */ - -dosbss: lwz r2,sbss_addr-base_addr(r1) /* start of sbss set by loader */ - lwz r3,sbss_length-base_addr(r1) /* sbss length */ - slwi. r3,r3,2 /* div 4 to get # of words */ - subi r2,r2,4 - beqlr /* no sbss */ - mtctr r3 /* set ctr reg */ -clear_sbss: stwu r0,4(r2) - bdnz clear_sbss /* decrement counter and loop */ - - blr /* return */ - - -/*--------------------------------------------------------------------------- - * Generic 405 register setup - *--------------------------------------------------------------------------*/ -init405: - li r0, 0 - mtmsr r0 - mticcr r0 - mtdccr r0 - - li r3,0x7FFC # 405EX-specific - mtsgr r3 # Clear guarded mode on all storage except PCIe region - - mtsler r0 # Storage is all big-endian - mtsu0r r0 # and uncompressed - - iccci r3,0 # Invalidate the instruction cache - li r3,1 # Enable F800 0000 to FFFF FFFF - oris r3,r3,0xC000 # Enable 0000 0000 to 0FFF FFFF - mticcr r3 - isync - - li r3,0 - li r4,256 # 405 has 128 or 256 32-byte lines: do 256 - mtctr r4 # set loop ctr -dcloop: dccci 0,r3 # invalidate line - addi r3,r3,0x20 # bump to next line - bdnz dcloop - mtdcwr r0 # Select write-back caching - lis r3,0xC000 # Enable 0000 0000 to 0FFF FFFF - # mtdccr r3 # Enable data cache - - mtevpr r0 - mtesr r0 - mtxer r0 - - lwarx r3,r0,r0 # get some data/set resv bit - stwcx. r3,r0,r0 # store out and clear resv bit - - lis r3,0xDEAD - ori r3,r3,0xBEEF # Make distintive uninitialised value - mr r4, r3 - mr r5, r3 - mr r6, r3 - mr r7, r3 - mr r8, r3 - mr r9, r3 - mr r10, r3 - mr r11, r3 - mr r12, r3 - mr r13, r3 - mr r14, r3 - mr r15, r3 - mr r16, r3 - mr r17, r3 - mr r18, r3 - mr r19, r3 - mr r20, r3 - mr r21, r3 - mr r22, r3 - mr r23, r3 - mr r24, r3 - mr r25, r3 - mr r26, r3 - mr r27, r3 - mr r28, r3 - mr r29, r3 - mr r30, r3 - mr r31, r3 - - blr - -.L_text_e: - - .comm environ,4,4 diff --git a/bsps/powerpc/haleakala/start/linkcmds b/bsps/powerpc/haleakala/start/linkcmds index 3bccc97c38..7cd993c0c9 100644 --- a/bsps/powerpc/haleakala/start/linkcmds +++ b/bsps/powerpc/haleakala/start/linkcmds @@ -11,6 +11,7 @@ OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") OUTPUT_ARCH(powerpc) +STARTUP(start.o) ENTRY(download_entry) EXTERN(__vectors) diff --git a/bsps/powerpc/haleakala/start/start.S b/bsps/powerpc/haleakala/start/start.S new file mode 100644 index 0000000000..43dde91255 --- /dev/null +++ b/bsps/powerpc/haleakala/start/start.S @@ -0,0 +1,237 @@ +/* dlentry.s + * + * This file contains the entry code for RTEMS programs starting + * after download to RAM + * + * Author: Thomas Doerfler + * IMD Ingenieurbuero fuer Microcomputertechnik + * + * COPYRIGHT (c) 1998 by IMD + * + * Changes from IMD are covered by the original distributions terms. + * This file has been derived from the papyrus BSP: + * + * This file contains the entry veneer for RTEMS programs + * downloaded to Papyrus. + * + * Author: Andrew Bray + * + * COPYRIGHT (c) 1995 by i-cubed ltd. + * + * To anyone who acknowledges that this file is provided "AS IS" + * without any express or implied warranty: + * permission to use, copy, modify, and distribute this file + * for any purpose is hereby granted without fee, provided that + * the above copyright notice and this notice appears in all + * copies, and that the name of i-cubed limited not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * i-cubed limited makes no representations about the suitability + * of this software for any purpose. + * + * derived from "helas403/dlentry.S": + * + * Further changes to derive for the PPC405CR/GP/GPr/EX/EXr + * by Michael Hamel ADInstruments Ltd 2008 + */ + +#include + +/* + * The virtex ELF link scripts support three special sections: + * .entry The actual entry point + * .vectors The section containing the interrupt entry veneers. + */ + +/* + * Downloaded code loads the vectors separately to 0x00000100, + * so .entry can be over 256 bytes. + * + * The other sections are linked in the following order: + * .entry + * .text + * .data + * .bss + * see linker command file for section placement + * + * The initial stack is set to _ISR_Stack_area_end. + * + * All the entry veneer has to do is to clear the BSS. + */ + +/* + * GDB likes to have debugging information for the entry veneer. + * Here was some DWARF information. IMD removed it, because we + * could not check, whether it was still correct. Sorry. + + */ + + + .section .entry + + PUBLIC_VAR (start) + PUBLIC_VAR (download_entry) + PUBLIC_VAR (__rtems_entry_point) + +SYM(start): +SYM(download_entry): +SYM(__rtems_entry_point): + + .extern SYM (boot_card) + + bl .startup /* First word is branch to reset_entry */ + + +/*--------------------------------------------------------------------------- + * Parameters from linker + *--------------------------------------------------------------------------*/ + +base_addr: +toc_pointer: + .long s.got +bss_length: + .long bss.size +bss_addr: + .long bss.start +sbss_length: + .long sbss.size +sbss_addr: + .long sbss.start +stack_top: + .long _ISR_Stack_area_end +PUBLIC_VAR (text_addr) +text_addr: + .long text.start +PUBLIC_VAR (text_length) +text_length: + .long text.size + +/*--------------------------------------------------------------------------- + * Reset_entry. + *--------------------------------------------------------------------------*/ +.startup: + /* Get entrypoint address in R1 so we can find linker variables */ + mflr r1 + + /* Initialise procesor registers generally */ + bl init405 + + /* Clear .bss and .sbss */ + bl bssclr + + /*------------------------------------------------------------------- + * C_setup. + *------------------------------------------------------------------*/ + lwz r1,stack_top - base_addr(r1) /* Now set R1 to stack_top */ + addi r1,r1,-56-4 /* start stack at text_addr - 56 */ + li r3,0 + stw r3, 0(r1) /* Clear stack chain */ + stw r3, 4(r1) + stw r3, 8(r1) + stw r3, 12(r1) + + bl __eabi /* Initialise EABI: sets up r2 & r13 */ + + li r3, 0 /* command line */ + + b SYM (boot_card) /* call the first C routine */ + +/*--------------------------------------------------------------------------- + * bssclr. + *--------------------------------------------------------------------------*/ +bssclr: lwz r2,bss_addr-base_addr(r1) /* start of bss set by loader */ + lwz r3,bss_length-base_addr(r1) /* bss length */ + srwi. r3,r3,2 /* div 4 to get # of words */ + li r0,0 + beq dosbss /* no bss */ + mtctr r3 /* set ctr reg */ + subi r2,r2,4 +clear_bss: stwu r0,4(r2) + bdnz clear_bss /* decrement counter and loop */ + +dosbss: lwz r2,sbss_addr-base_addr(r1) /* start of sbss set by loader */ + lwz r3,sbss_length-base_addr(r1) /* sbss length */ + slwi. r3,r3,2 /* div 4 to get # of words */ + subi r2,r2,4 + beqlr /* no sbss */ + mtctr r3 /* set ctr reg */ +clear_sbss: stwu r0,4(r2) + bdnz clear_sbss /* decrement counter and loop */ + + blr /* return */ + + +/*--------------------------------------------------------------------------- + * Generic 405 register setup + *--------------------------------------------------------------------------*/ +init405: + li r0, 0 + mtmsr r0 + mticcr r0 + mtdccr r0 + + li r3,0x7FFC # 405EX-specific + mtsgr r3 # Clear guarded mode on all storage except PCIe region + + mtsler r0 # Storage is all big-endian + mtsu0r r0 # and uncompressed + + iccci r3,0 # Invalidate the instruction cache + li r3,1 # Enable F800 0000 to FFFF FFFF + oris r3,r3,0xC000 # Enable 0000 0000 to 0FFF FFFF + mticcr r3 + isync + + li r3,0 + li r4,256 # 405 has 128 or 256 32-byte lines: do 256 + mtctr r4 # set loop ctr +dcloop: dccci 0,r3 # invalidate line + addi r3,r3,0x20 # bump to next line + bdnz dcloop + mtdcwr r0 # Select write-back caching + lis r3,0xC000 # Enable 0000 0000 to 0FFF FFFF + # mtdccr r3 # Enable data cache + + mtevpr r0 + mtesr r0 + mtxer r0 + + lwarx r3,r0,r0 # get some data/set resv bit + stwcx. r3,r0,r0 # store out and clear resv bit + + lis r3,0xDEAD + ori r3,r3,0xBEEF # Make distintive uninitialised value + mr r4, r3 + mr r5, r3 + mr r6, r3 + mr r7, r3 + mr r8, r3 + mr r9, r3 + mr r10, r3 + mr r11, r3 + mr r12, r3 + mr r13, r3 + mr r14, r3 + mr r15, r3 + mr r16, r3 + mr r17, r3 + mr r18, r3 + mr r19, r3 + mr r20, r3 + mr r21, r3 + mr r22, r3 + mr r23, r3 + mr r24, r3 + mr r25, r3 + mr r26, r3 + mr r27, r3 + mr r28, r3 + mr r29, r3 + mr r30, r3 + mr r31, r3 + + blr + +.L_text_e: + + .comm environ,4,4 diff --git a/bsps/powerpc/mpc8260ads/start/start.S b/bsps/powerpc/mpc8260ads/start/start.S index 4fdc21cea9..0537bbf849 100644 --- a/bsps/powerpc/mpc8260ads/start/start.S +++ b/bsps/powerpc/mpc8260ads/start/start.S @@ -30,11 +30,9 @@ */ #include +#include /* - * The initial stack is set to run BELOW the code base address. - * (between the vectors and text sections) - * * The entry veneer has to clear the BSS and copy the read only * version of the data segment to the correct location. */ @@ -134,11 +132,16 @@ text_length: /* set toc */ lwz r2, toc_pointer-base_addr(r1) - /* Set up stack pointer = beginning of text section - 56 */ - addi r1, r1, -56-4 + /* Clear cmdline */ + li r3, 0 - /* Clear cmdline */ - xor r3, r3, r3 + /* + * Initialize start stack. The stacks are statically allocated and + * properly aligned. + */ + LA r1, _ISR_Stack_area_end + subi r1, r1, PPC_DEFAULT_CACHE_LINE_SIZE + stw r3, 0(r1) .extern SYM (boot_card) bl SYM (boot_card) /* call the first C routine */ diff --git a/bsps/powerpc/mvme3100/start/start.S b/bsps/powerpc/mvme3100/start/start.S index 493720e0c7..ade890a80b 100644 --- a/bsps/powerpc/mvme3100/start/start.S +++ b/bsps/powerpc/mvme3100/start/start.S @@ -12,8 +12,7 @@ */ #include -#include -#include +#include #include @@ -71,15 +70,15 @@ __rtems_entry_point: mr r6,r28 mr r7,r27 bl save_boot_params - addis r9,r0, (__stack-PPC_MINIMUM_STACK_FRAME_SIZE)@ha - addi r9,r9, (__stack-PPC_MINIMUM_STACK_FRAME_SIZE)@l - /* align down to 16-bytes */ - li r5, (CPU_STACK_ALIGNMENT - 1) - andc r1, r9, r5 - /* NULL ptr to back chain */ - li r0, 0 - stw r0, 0(r1) + /* + * Initialize start stack. The stacks are statically allocated and + * properly aligned. + */ + LA r1, _ISR_Stack_area_end + subi r1, r1, PPC_DEFAULT_CACHE_LINE_SIZE + li r0, 0 + stw r0, 0(r1) /* * We are now in a environment that is totally independent from diff --git a/bsps/powerpc/mvme5500/start/start.S b/bsps/powerpc/mvme5500/start/start.S index 5990c7e2d4..c948c9c1ef 100644 --- a/bsps/powerpc/mvme5500/start/start.S +++ b/bsps/powerpc/mvme5500/start/start.S @@ -13,8 +13,7 @@ */ #include -#include -#include +#include #include #include @@ -134,23 +133,15 @@ enter_C_code: mr r6,r28 mr r7,r27 bl save_boot_params + /* - * stack = &__rtems_end + 4096 - */ - addis r9,r0, __stack-PPC_MINIMUM_STACK_FRAME_SIZE@ha - addi r9,r9, __stack-PPC_MINIMUM_STACK_FRAME_SIZE@l - /* - * align initial stack - * (we hope that the bootloader stack was 16-byte aligned - * or we haven't used altivec yet...) - */ - li r0, (CPU_STACK_ALIGNMENT-1) - andc r1, r9, r0 - /* - * NULL ptr to back chain + * Initialize start stack. The stacks are statically allocated and + * properly aligned. */ - li r0, 0 - stw r0, 0(r1) + LA r1, _ISR_Stack_area_end + subi r1, r1, PPC_DEFAULT_CACHE_LINE_SIZE + li r0, 0 + stw r0, 0(r1) /* * We are now in a environment that is totally independent from diff --git a/bsps/powerpc/shared/start/linkcmds.share b/bsps/powerpc/shared/start/linkcmds.share index e2a3a16fbe..2fc66015cb 100644 --- a/bsps/powerpc/shared/start/linkcmds.share +++ b/bsps/powerpc/shared/start/linkcmds.share @@ -3,7 +3,6 @@ OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", OUTPUT_ARCH(powerpc) /* Do we need any of these for elf? __DYNAMIC = 0; */ -PROVIDE (__stack = 0); MEMORY { VECTORS : ORIGIN = 0x0 , LENGTH = 0x3000 CODE : ORIGIN = 0x3000 , LENGTH = 32M - 0x3000 @@ -247,8 +246,6 @@ SECTIONS PROVIDE (__bss_end = .); } > CODE . = ALIGN(16); - . += 0x1000; - __stack = .; _end = . ; __rtems_end = . ; PROVIDE (end = .); diff --git a/bsps/powerpc/shared/start/start.S b/bsps/powerpc/shared/start/start.S index 354b9a967e..faffaf9f31 100644 --- a/bsps/powerpc/shared/start/start.S +++ b/bsps/powerpc/shared/start/start.S @@ -10,8 +10,7 @@ */ #include -#include -#include +#include #include #include @@ -133,24 +132,16 @@ enter_C_code: mr r6,r28 mr r7,r27 bl save_boot_params + /* - * stack = &__rtems_end + 4096 - */ - addis r9,r0, __stack-PPC_MINIMUM_STACK_FRAME_SIZE@ha - addi r9,r9, __stack-PPC_MINIMUM_STACK_FRAME_SIZE@l - /* - * align initial stack - * (we hope that the bootloader stack was 16-byte aligned - * or we haven't used altivec yet...) - */ - li r0, (CPU_STACK_ALIGNMENT-1) - andc r1, r9, r0 - /* - * Tag TOS with a NULL (terminator for stack dump) + * Initialize start stack. The stacks are statically allocated and + * properly aligned. */ - li r0, 0 - stw r0, 0(r1) - + LA r1, _ISR_Stack_area_end + subi r1, r1, PPC_DEFAULT_CACHE_LINE_SIZE + li r0, 0 + stw r0, 0(r1) + /* * We are now in a environment that is totally independent from * bootloader setup. diff --git a/bsps/powerpc/ss555/start/linkcmds b/bsps/powerpc/ss555/start/linkcmds index f3a41dd3a9..e8df31e2f0 100644 --- a/bsps/powerpc/ss555/start/linkcmds +++ b/bsps/powerpc/ss555/start/linkcmds @@ -16,6 +16,7 @@ OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") OUTPUT_ARCH(powerpc) +STARTUP(start.o) ENTRY(start) EXTERN(_vectors) diff --git a/bsps/powerpc/virtex/start/start.S b/bsps/powerpc/virtex/start/start.S index 725b09954f..3c9cd229d3 100644 --- a/bsps/powerpc/virtex/start/start.S +++ b/bsps/powerpc/virtex/start/start.S @@ -47,11 +47,6 @@ virtex_exc_vector_base: b twiddle .endr - /* Start stack area */ -.rept BSP_START_STACK_SIZE / 4 - b twiddle -.endr - _start: /* Reset time base */ @@ -59,10 +54,13 @@ _start: mtspr TBWU, r0 mtspr TBWL, r0 - /* Initialize start stack */ - LWI r1, _start - stwu r0, -4(r1) - stwu r0, -4(r1) + /* + * Initialize start stack. The stacks are statically allocated and + * properly aligned. + */ + LA r1, _ISR_Stack_area_end + subi r1, r1, PPC_DEFAULT_CACHE_LINE_SIZE + stw r0, 0(r1) /* Copy fast text */ LWI r3, bsp_section_fast_text_begin diff --git a/bsps/powerpc/virtex4/start/linkcmds b/bsps/powerpc/virtex4/start/linkcmds index 66705168ef..46e5111b67 100644 --- a/bsps/powerpc/virtex4/start/linkcmds +++ b/bsps/powerpc/virtex4/start/linkcmds @@ -8,6 +8,7 @@ OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") OUTPUT_ARCH(powerpc) +STARTUP(start.o) ENTRY(download_entry) EXTERN(download_entry) EXTERN(__vectors) diff --git a/bsps/powerpc/virtex5/start/linkcmds b/bsps/powerpc/virtex5/start/linkcmds index 0cb4b4e752..32425f4c7f 100644 --- a/bsps/powerpc/virtex5/start/linkcmds +++ b/bsps/powerpc/virtex5/start/linkcmds @@ -8,6 +8,7 @@ OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") OUTPUT_ARCH(powerpc) +STARTUP(start.o) ENTRY(download_entry) EXTERN(download_entry) EXTERN(__vectors) diff --git a/c/src/lib/libbsp/powerpc/haleakala/Makefile.am b/c/src/lib/libbsp/powerpc/haleakala/Makefile.am index 89594c83cf..e58a42a530 100644 --- a/c/src/lib/libbsp/powerpc/haleakala/Makefile.am +++ b/c/src/lib/libbsp/powerpc/haleakala/Makefile.am @@ -5,11 +5,13 @@ include $(top_srcdir)/../../bsp.am dist_project_lib_DATA = ../../../../../../bsps/powerpc/haleakala/start/bsp_specs - +start.$(OBJEXT): ../../../../../../bsps/powerpc/haleakala/start/start.S + $(CPPASCOMPILE) -o $@ -c $< +project_lib_DATA = start.$(OBJEXT) rtems_crti.$(OBJEXT): ../../../../../../bsps/powerpc/shared/start/rtems_crti.S $(CPPASCOMPILE) -o $@ -c $< -project_lib_DATA = rtems_crti.$(OBJEXT) +project_lib_DATA += rtems_crti.$(OBJEXT) project_lib_DATA += linkcmds @@ -26,9 +28,6 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c librtemsbsp_a_SOURCES += ../../../../../../bsps/powerpc/haleakala/start/mmu_405.c librtemsbsp_a_SOURCES += ../../../../../../bsps/powerpc/haleakala/start/mmu_405asm.S -# dlentry -librtemsbsp_a_SOURCES += ../../../../../../bsps/powerpc/haleakala/start/dlentry.S - # console librtemsbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/console/uart.c librtemsbsp_a_SOURCES += ../../../../../../bsps/powerpc/shared/console/console.c diff --git a/c/src/lib/libbsp/powerpc/ss555/Makefile.am b/c/src/lib/libbsp/powerpc/ss555/Makefile.am index 51ea72166f..c6276e15e9 100644 --- a/c/src/lib/libbsp/powerpc/ss555/Makefile.am +++ b/c/src/lib/libbsp/powerpc/ss555/Makefile.am @@ -5,11 +5,13 @@ include $(top_srcdir)/../../bsp.am dist_project_lib_DATA = ../../../../../../bsps/powerpc/ss555/start/bsp_specs - +start.$(OBJEXT): ../../../../../../bsps/powerpc/ss555/start/start.S + $(CPPASCOMPILE) -o $@ -c $< +project_lib_DATA = start.$(OBJEXT) rtems_crti.$(OBJEXT): ../../../../../../bsps/powerpc/shared/start/rtems_crti.S $(CPPASCOMPILE) -o $@ -c $< -project_lib_DATA = rtems_crti.$(OBJEXT) +project_lib_DATA += rtems_crti.$(OBJEXT) project_lib_DATA += linkcmds @@ -26,7 +28,6 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/powerpc/ss555/start/bspstart.c librtemsbsp_a_SOURCES += ../../../../../../bsps/powerpc/ss555/start/iss555.c librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/getentropy/getentropy-cpucounter.c librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c -librtemsbsp_a_SOURCES += ../../../../../../bsps/powerpc/ss555/start/start.S librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspgetworkarea-default.c librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspreset-empty.c # tm27supp diff --git a/c/src/lib/libbsp/powerpc/virtex/configure.ac b/c/src/lib/libbsp/powerpc/virtex/configure.ac index b70adf1af5..19ecf513a3 100644 --- a/c/src/lib/libbsp/powerpc/virtex/configure.ac +++ b/c/src/lib/libbsp/powerpc/virtex/configure.ac @@ -10,12 +10,6 @@ RTEMS_CANONICAL_TARGET_CPU AM_INIT_AUTOMAKE([no-define nostdinc foreign 1.12.2]) RTEMS_BSP_CONFIGURE - - - -RTEMS_BSPOPTS_SET([BSP_START_STACK_SIZE],[*],[4096]) -RTEMS_BSPOPTS_HELP([BSP_START_STACK_SIZE],[size of low-level start stack]) - RTEMS_BSPOPTS_SET([RTEMS_XPARAMETERS_H],[*],[\]) RTEMS_BSPOPTS_HELP([RTEMS_XPARAMETERS_H], [This defines the location of the hardware specific "xparameters.h" file. diff --git a/c/src/lib/libbsp/powerpc/virtex4/Makefile.am b/c/src/lib/libbsp/powerpc/virtex4/Makefile.am index 62ca072f94..56845f95de 100644 --- a/c/src/lib/libbsp/powerpc/virtex4/Makefile.am +++ b/c/src/lib/libbsp/powerpc/virtex4/Makefile.am @@ -9,9 +9,14 @@ dist_project_lib_DATA = ../../../../../../bsps/powerpc/virtex4/start/bsp_specs # include # start + +start.$(OBJEXT): ../../../../../../bsps/powerpc/virtex4/start/start.S + $(CPPASCOMPILE) -o $@ -c $< +project_lib_DATA = start.$(OBJEXT) + rtems_crti.$(OBJEXT): ../../../../../../bsps/powerpc/shared/start/rtems_crti.S $(CPPASCOMPILE) -o $@ -c $< -project_lib_DATA = rtems_crti.$(OBJEXT) +project_lib_DATA += rtems_crti.$(OBJEXT) project_lib_DATA += linkcmds diff --git a/c/src/lib/libbsp/powerpc/virtex5/Makefile.am b/c/src/lib/libbsp/powerpc/virtex5/Makefile.am index 2dd664d0a3..fae04ed02d 100644 --- a/c/src/lib/libbsp/powerpc/virtex5/Makefile.am +++ b/c/src/lib/libbsp/powerpc/virtex5/Makefile.am @@ -8,9 +8,14 @@ dist_project_lib_DATA = ../../../../../../bsps/powerpc/virtex5/start/bsp_specs # include # start + +start.$(OBJEXT): ../../../../../../bsps/powerpc/virtex5/start/start.S + $(CPPASCOMPILE) -o $@ -c $< +project_lib_DATA = start.$(OBJEXT) + rtems_crti.$(OBJEXT): ../../../../../../bsps/powerpc/shared/start/rtems_crti.S $(CPPASCOMPILE) -o $@ -c $< -project_lib_DATA = rtems_crti.$(OBJEXT) +project_lib_DATA += rtems_crti.$(OBJEXT) project_lib_DATA += linkcmds -- cgit v1.2.3