lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 1 | OUTPUT_ARCH(riscv) |
| 2 | |
| 3 | /* required to correctly link newlib */ |
| 4 | GROUP( -lc -lgloss -lgcc -lsupc++ ) |
| 5 | |
| 6 | SEARCH_DIR(.) |
| 7 | __DYNAMIC = 0; |
| 8 | |
| 9 | MEMORY |
| 10 | { |
| 11 | flash (rx) : ORIGIN = 0x20000000, LENGTH = 0x100000 |
| 12 | ram (!rx) : ORIGIN = 0x10000000, LENGTH = 0x10000 |
| 13 | } |
| 14 | |
| 15 | _stack_start = ORIGIN(ram) + LENGTH(ram); |
| 16 | |
| 17 | /* We have to align each sector to word boundaries as our current s19->slm |
| 18 | * conversion scripts are not able to handle non-word aligned sections. */ |
| 19 | |
| 20 | |
| 21 | SECTIONS |
| 22 | { |
| 23 | .crt : { *(.crt) } > flash |
| 24 | |
| 25 | /* the 256 byte alignment is required by the machine trap vector table */ |
| 26 | .vectors : { |
| 27 | . = ALIGN(0x100); |
| 28 | _svectors = .; |
| 29 | *(.vectors) |
| 30 | _evectors = .; |
| 31 | } > flash |
| 32 | |
| 33 | .text : { |
| 34 | . = ALIGN(0x100); |
| 35 | _stext = .; |
| 36 | *(.text) |
| 37 | _etext = .; |
| 38 | __CTOR_LIST__ = .; |
| 39 | LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) |
| 40 | *(.ctors) |
| 41 | LONG(0) |
| 42 | __CTOR_END__ = .; |
| 43 | __DTOR_LIST__ = .; |
| 44 | LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) |
| 45 | *(.dtors) |
| 46 | LONG(0) |
| 47 | __DTOR_END__ = .; |
| 48 | *(.lit) |
| 49 | *(.shdata) |
| 50 | _endtext = .; |
| 51 | } > flash |
| 52 | |
| 53 | .rodata : { |
| 54 | . = ALIGN(4); |
| 55 | *(.rodata); |
| 56 | *(.rodata.*) |
| 57 | } > flash |
| 58 | |
| 59 | .shbss : |
| 60 | { |
| 61 | . = ALIGN(4); |
| 62 | *(.shbss) |
| 63 | } > flash |
| 64 | |
| 65 | /* idata stores the static variable data that will be loaded in ram below */ |
| 66 | .idata : |
| 67 | { |
| 68 | . = ALIGN(4); |
| 69 | _idata = .; |
| 70 | } > flash |
| 71 | |
| 72 | /* Static variable LMA at end of program |
| 73 | VMA at start of RAM. Stack is at end of RAM */ |
| 74 | .data 0x10000000 : AT ( _idata ){ |
| 75 | . = ALIGN(4); |
| 76 | _sdata = .; /* start of data */ |
| 77 | *(.data); |
| 78 | *(.data.*) |
| 79 | *(.sdata); |
| 80 | _edata = .; /* end of data */ |
| 81 | } > ram |
| 82 | |
| 83 | .bss : |
| 84 | { |
| 85 | . = ALIGN(4); |
| 86 | _bss_start = .; |
| 87 | *(.bss) |
| 88 | *(.bss.*) |
| 89 | *(.sbss) |
| 90 | *(.sbss.*) |
| 91 | *(COMMON) |
| 92 | _bss_end = .; |
| 93 | } > ram |
| 94 | |
| 95 | .stab 0 (NOLOAD) : |
| 96 | { |
| 97 | [ .stab ] |
| 98 | } |
| 99 | |
| 100 | .stabstr 0 (NOLOAD) : |
| 101 | { |
| 102 | [ .stabstr ] |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | ENTRY(main) |