Changeset 2e5cf7f in rtems


Ignore:
Timestamp:
Mar 16, 2018, 2:09:36 PM (14 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
e9fb3133
Parents:
9860cc7
git-author:
Sebastian Huber <sebastian.huber@…> (03/16/18 14:09:36)
git-committer:
Sebastian Huber <sebastian.huber@…> (03/16/18 14:11:19)
Message:

bsps/powerpc: Use shared linker command file

Close #3339.

Location:
c/src/lib/libbsp/powerpc/qemuppc
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/powerpc/qemuppc/start/start.S

    r9860cc7 r2e5cf7f  
    44#include <bspopts.h>
    55
    6         #.section ".text"
    7         .section .entry_point_section,"awx",@progbits
    8         .global _start
     6        .global bsp_interrupt_stack_start
     7        .global bsp_interrupt_stack_end
     8        .global _start
     9
     10        .section .bsp_start_text,"awx",@progbits
    911
    1012_start:
    11         lis   %r1,_stack@h
    12         ori   %r1,%r1,_stack@l
     13        lis   %r1,bsp_interrupt_stack_start@h
     14        ori   %r1,%r1,bsp_interrupt_stack_start@l
    1315        /* Make sure stack is properly aligned */
    1416        li    %r3, CPU_STACK_ALIGNMENT - 1
     
    4143        b _start
    4244        .size _reset, . - _reset
     45
     46        /* Start stack area */
     47        .section ".bsp_rwextra", "aw", @nobits
     48        .align 4
     49        .space 4096
     50bsp_interrupt_stack_start:
     51        .space 32768
     52bsp_interrupt_stack_end:
  • c/src/lib/libbsp/powerpc/qemuppc/startup/bspstart.c

    r9860cc7 r2e5cf7f  
    4545extern char bsp_interrupt_stack_start[];
    4646extern char bsp_interrupt_stack_end[];
    47 extern char bsp_interrupt_stack_size[];
    4847uint32_t BSP_mem_size = (uint32_t)RamSize;
    4948
     
    8887   */
    8988  intrStackStart = (uintptr_t) bsp_interrupt_stack_start;
    90   intrStackSize =  (uintptr_t) bsp_interrupt_stack_size;
     89  intrStackSize =  (uintptr_t) bsp_interrupt_stack_end - intrStackStart;
    9190
    9291  BSP_mem_size = (uint32_t )RamSize;
  • c/src/lib/libbsp/powerpc/qemuppc/startup/cmain.c

    r9860cc7 r2e5cf7f  
    11#include <bsp/bootcard.h>
     2#include <bsp/linker-symbols.h>
    23
    34static void
     
    3132}
    3233
    33 extern unsigned char __sdata2_load[], __sdata2_start[], __sdata2_end[];
    34 extern unsigned char __data_load[], __data_start[], __data_end[];
    35 extern unsigned char __sdata_load[], __sdata_start[], __sdata_end[];
    36 extern unsigned char __sbss2_start[], __sbss2_end[];
    37 extern unsigned char __sbss_start[], __sbss_end[];
    38 extern unsigned char __bss_start[], __bss_end[];
    39 
    4034
    4135/*
     
    5044   * init variable sections
    5145   */
    52   __memcpy (__sdata2_start, __sdata2_load, __sdata2_end - __sdata2_start);
    53   __memcpy (__sdata_start , __sdata_load , __sdata_end  - __sdata_start);
    54   __memcpy (__data_start  , __data_load  , __data_end   - __data_start);
    55   __bzero (__sbss2_start  , __sbss2_end - __sbss2_start);
    56   __bzero (__sbss_start   , __sbss_end  - __sbss_start);
    57   __bzero (__bss_start    , __bss_end   - __bss_start);
     46  __memcpy (bsp_section_data_begin, bsp_section_data_load_begin, (int)bsp_section_data_size);
     47  __bzero (bsp_section_bss_begin, (int)bsp_section_bss_size);
     48  __bzero (bsp_section_sbss_begin, (int)bsp_section_sbss_size);
    5849  /* printk( "start of BSP\n"); */
    5950  boot_card(0);
  • c/src/lib/libbsp/powerpc/qemuppc/startup/linkcmds

    r9860cc7 r2e5cf7f  
    1 OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc",
    2               "elf32-powerpc")
    3 OUTPUT_ARCH(powerpc:common)
    4 ENTRY(_start)
    5 STARTUP(start.o)
    61EXTERN(__vectors)
    72
    83MEMORY
    94  {
    10         RAM       : ORIGIN = 0, LENGTH = 4M
     5        EMPTY     : ORIGIN = 0, LENGTH = 0
     6        RAM       : ORIGIN = 0x2000, LENGTH = 4M - 0x2000
    117        ROM       : ORIGIN = 0xFFC00000, LENGTH = 4M
    128        VECTORS   : ORIGIN = 0xFFF00000, LENGTH = 0x20000
     
    1410  }
    1511
    16 RamBase = DEFINED(RamBase) ? RamBase : 0x0;
    17 RamSize = DEFINED(RamSize) ? RamSize : 4M;
    18 HeapSize = DEFINED(HeapSize) ? HeapSize : 0;
     12REGION_ALIAS ("REGION_START", ROM);
     13REGION_ALIAS ("REGION_FAST_TEXT", ROM);
     14REGION_ALIAS ("REGION_FAST_TEXT_LOAD", ROM);
     15REGION_ALIAS ("REGION_TEXT", ROM);
     16REGION_ALIAS ("REGION_TEXT_LOAD", ROM);
     17REGION_ALIAS ("REGION_RODATA", ROM);
     18REGION_ALIAS ("REGION_RODATA_LOAD", ROM);
     19REGION_ALIAS ("REGION_FAST_DATA", RAM);
     20REGION_ALIAS ("REGION_FAST_DATA_LOAD", ROM);
     21REGION_ALIAS ("REGION_DATA", RAM);
     22REGION_ALIAS ("REGION_DATA_LOAD", ROM);
     23REGION_ALIAS ("REGION_BSS", RAM);
     24REGION_ALIAS ("REGION_RWEXTRA", RAM);
     25REGION_ALIAS ("REGION_WORK", RAM);
     26REGION_ALIAS ("REGION_STACK", RAM);
     27REGION_ALIAS ("REGION_NOCACHE", EMPTY);
     28REGION_ALIAS ("REGION_NOCACHE_LOAD", EMPTY);
     29REGION_ALIAS ("REGION_NVRAM", EMPTY);
    1930
    20 bsp_section_align = 32;
    21 
    22 SECTIONS
    23 {
    24   /* Read-only sections, merged into text segment: */
    25   . = 0xfffc0000;
    26 /*
    27   .entry_point_section :
    28   {
    29   } =0
    30 */
    31 
    32   .text           :
    33   {
    34     *(.entry_point_section)
    35     *(.text .text.* .gnu.linkonce.t.*)
    36     *(.eh_frame_hdr*)
    37     *(.eh_frame*)
    38 
    39     /*
    40      * Special FreeBSD sysctl sections.
    41      */
    42     . = ALIGN (16);
    43     __start_set_sysctl_set = .;
    44     *(set_sysctl_*);
    45     __stop_set_sysctl_set = ABSOLUTE(.);
    46     *(set_domain_*);
    47     *(set_pseudo_*);
    48 
    49     /* .gnu.warning sections are handled specially by elf32.em.  */
    50     *(.gnu.warning)
    51     . = ALIGN (bsp_section_align);
    52     __text_end = .;
    53   } >ROM =0
    54   .init           :
    55   {
    56     KEEP (*(.init))
    57   } >ROM =0
    58   .fini           :
    59   {
    60     _fini = .;
    61     KEEP (*(.fini))
    62   } >ROM =0
    63 
    64   /* Put .ctors and .dtors next to the .got2 section, so that the pointers
    65      get relocated with -mrelocatable. Also put in the .fixup pointers.
    66      The current compiler no longer needs this, but keep it around for 2.7.2  */
    67    PROVIDE (__GOT2_START__ = .);
    68    PROVIDE (_GOT2_START_ = .);
    69   .got2           :  { *(.got2)         } >ROM =0
    70   PROVIDE (__GOT2_END__ = .);
    71   PROVIDE (_GOT2_END_ = .);
    72 
    73   PROVIDE (__CTOR_LIST__ = .);
    74   .ctors          : { *(.ctors)         } >ROM =0
    75   PROVIDE (__CTOR_END__ = .);
    76 
    77   PROVIDE (__DTOR_LIST__ = .);
    78   .dtors          : { *(.dtors)         } >ROM =0
    79   PROVIDE (__DTOR_END__ = .);
    80   .jcr            : { KEEP (*(.jcr))    } > ROM =0
    81 
    82   .tdata : {
    83     _TLS_Data_begin = .;
    84     *(.tdata .tdata.* .gnu.linkonce.td.*)
    85     _TLS_Data_end = .;
    86   } >ROM =0
    87   .tbss : {
    88     _TLS_BSS_begin = .;
    89     *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
    90     _TLS_BSS_end = .;
    91   } >ROM =0
    92   _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
    93   _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
    94   _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
    95   _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
    96   _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
    97   _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
    98 
    99   .rodata :
    100   {
    101     *(.rodata .rodata.* .gnu.linkonce.r.*)
    102     *(.rodata1)
    103     KEEP (*(SORT(.rtemsroset.*)))
    104     . = ALIGN (bsp_section_align);
    105     __rodata_end = .;
    106   } >ROM =0
    107 
    108   .vectors :
    109   {
    110     . = . + 0x2000; /* skip vector area */
    111   } >RAM
    112 
    113   __sdata2_load = __rodata_end;
    114   .sdata2 : AT (__sdata2_load)
    115   {
    116     __sdata2_start = .;
    117     PROVIDE (_SDA2_BASE_ = 32768);
    118     *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
    119     . = ALIGN (bsp_section_align);
    120     __sdata2_end = .;
    121   } >RAM
    122   .sbss2 :
    123   {
    124     __sbss2_start = .;
    125     *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
    126     . = ALIGN (bsp_section_align);
    127     __sbss2_end = .;
    128   } >RAM
    129   __data_load = __sdata2_load + SIZEOF (.sdata2);
    130   .data : AT(__data_load)
    131   {
    132     __data_start = .;
    133     *(.data .data.* .gnu.linkonce.d.*)
    134     KEEP (*(SORT(.rtemsrwset.*)))
    135     KEEP (*(.gnu.linkonce.d.*personality*))
    136     SORT(CONSTRUCTORS)
    137     *(.data1)
    138     . = ALIGN (bsp_section_align);
    139     __data_end = .;
    140   } >RAM
    141   __sdata_load = __data_load + SIZEOF (.data);
    142   .sdata : AT(__sdata_load) {
    143     __sdata_start = .;
    144     PROVIDE (_SDA_BASE_ = 32768);
    145     *(.sdata .sdata.* .gnu.linkonce.s.*)
    146 
    147     . = ALIGN (bsp_section_align);
    148 
    149     _edata = .;
    150     __sdata_end = .;
    151     PROVIDE (edata = .);
    152 
    153     /*
    154      * BSP: End of data section
    155      */
    156     bsp_section_data_end = .;
    157   } > RAM
    158 
    159   PROVIDE (__EXCEPT_START__ = .);
    160   .gcc_except_table   : { *(.gcc_except_table*) } >RAM
    161   PROVIDE (__EXCEPT_END__ = .);
    162 
    163   .sbss :
    164   {
    165     __sbss_start = .;
    166     *(.dynsbss)
    167     *(.sbss .sbss.* .gnu.linkonce.sb.*)
    168     *(.scommon)
    169     . = ALIGN (bsp_section_align);
    170     __sbss_end = .;
    171   } >RAM
    172   .bss  :
    173   {
    174    __bss_start = .;
    175    *(.dynbss)
    176    *(.bss .bss.* .gnu.linkonce.b.*)
    177    *(COMMON)
    178     . = ALIGN (bsp_section_align);
    179    __bss_end = .;
    180 
    181    /* Allocate the main stack area.  Make sure it starts 16bytes aligned
    182       to accommodate any possible program expectation.  */
    183    _stack = ALIGN(16) + 0x1000;
    184    _end = _stack;
    185   } >RAM
    186 
    187   /*
    188    * BSP: Interrupt stack
    189    */
    190   bsp_interrupt_stack_start = _end;
    191   bsp_interrupt_stack_end = bsp_interrupt_stack_start + 32k;
    192   bsp_interrupt_stack_size = bsp_interrupt_stack_end - bsp_interrupt_stack_start;
    193 
    194   bsp_work_area_start = bsp_interrupt_stack_end;
    195   WorkAreaBase = bsp_work_area_start;
    196    . = RamBase + RamSize;
    197 
     31SECTIONS {
    19832  .reset :
    19933  {
    20034   KEEP(*(.reset))
    20135  } >RESET
    202 
    203   /* DWARF 1.1 and DWARF 2 */
    204   .debug_aranges  0 : { *(.debug_aranges) }
    205   .debug_pubnames 0 : { *(.debug_pubnames) }
    206   /* DWARF 2 */
    207   .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
    208   .debug_abbrev   0 : { *(.debug_abbrev) }
    209   .debug_line     0 : { *(.debug_line) }
    210   .debug_frame    0 : { *(.debug_frame) }
    211   .debug_str      0 : { *(.debug_str) }
    212   .debug_loc      0 : { *(.debug_loc) }
    213   .debug_macinfo  0 : { *(.debug_macinfo) }
    214   /* SGI/MIPS DWARF 2 extensions */
    215   .debug_weaknames 0 : { *(.debug_weaknames) }
    216   .debug_funcnames 0 : { *(.debug_funcnames) }
    217   .debug_typenames 0 : { *(.debug_typenames) }
    218   .debug_varnames  0 : { *(.debug_varnames) }
    219   /DISCARD/ : { *(.note.GNU-stack) }
    22036}
    22137
     38INCLUDE linkcmds.base
Note: See TracChangeset for help on using the changeset viewer.