diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5d50879d9..3dc5dc87c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,6 +11,10 @@ jobs: "", "-std=c99 -Wall -Wextra -Wpedantic -Werror -Wno-unused-parameter", ] + riscv_libc: [ + "", + "picolibc", + ] steps: - name: 'Clone freedom-e-sdk' @@ -38,12 +42,12 @@ jobs: - name: 'Build all examples on all targets' run: | - docker run --rm -e RISCV_CFLAGS="${{ matrix.riscv_cflags }}" freedom-e-sdk ./scripts/all-targets-build + docker run --rm -e RISCV_CFLAGS="${{ matrix.riscv_cflags }}" -e RISCV_LIBC="${{ matrix.riscv_libc }}" freedom-e-sdk ./scripts/all-targets-build - name: 'Run examples on QEMU' run: | - docker run --rm -e RISCV_CFLAGS="${{ matrix.riscv_cflags }}" freedom-e-sdk ./scripts/test-qemu-targets + docker run --rm -e RISCV_CFLAGS="${{ matrix.riscv_cflags }}" -e RISCV_LIBC="${{ matrix.riscv_libc }}" freedom-e-sdk ./scripts/test-qemu-targets - name: 'Build examples as standalone projects' run: | - docker run --rm -e RISCV_CFLAGS="${{ matrix.riscv_cflags }}" freedom-e-sdk ./scripts/test-standalone + docker run --rm -e RISCV_CFLAGS="${{ matrix.riscv_cflags }}" -e RISCV_LIBC="${{ matrix.riscv_libc }}" freedom-e-sdk ./scripts/test-standalone diff --git a/FreeRTOS-metal b/FreeRTOS-metal index 32fbffebc..6e2f8115f 160000 --- a/FreeRTOS-metal +++ b/FreeRTOS-metal @@ -1 +1 @@ -Subproject commit 32fbffebc06c1f737d6c87aeefb390ff3b9c43b4 +Subproject commit 6e2f8115fcd7ba60e141b5e2d84bf2209df26adb diff --git a/bsp/freedom-e310-arty/metal.default.lds b/bsp/freedom-e310-arty/metal.default.lds index 46cb9917d..09ab2262b 100644 --- a/bsp/freedom-e310-arty/metal.default.lds +++ b/bsp/freedom-e310-arty/metal.default.lds @@ -16,6 +16,14 @@ MEMORY rom (irx!wa) : ORIGIN = 0x20400000, LENGTH = 0x1fc00000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -75,17 +83,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >rom + } >rom :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >rom + } >rom :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >rom + } >rom :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -96,7 +104,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >rom + } >rom :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -107,7 +115,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >rom + } >rom :rom @@ -118,7 +126,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >rom + } >rom :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -127,14 +135,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >rom + } >rom : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >rom + } >rom :rom .rodata : { *(.rdata) @@ -147,7 +155,7 @@ SECTIONS *(.srodata.cst2) *(.srodata .srodata.*) - } >rom + } >rom :rom /* ITIM SECTION * @@ -161,7 +169,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >itim AT>rom + } >itim AT>rom :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -182,11 +190,31 @@ SECTIONS PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.* .sdata2.*) *(.gnu.linkonce.s.*) - } >ram AT>rom + } >ram AT>rom :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >ram AT>rom :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >ram AT>ram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >ram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -194,10 +222,10 @@ SECTIONS *(.bss .bss.*) *(.gnu.linkonce.b.*) *(COMMON) - } >ram + } >ram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); @@ -207,14 +235,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >ram + } >ram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >ram + PROVIDE( __heap_end = . ); + } >ram :ram } \ No newline at end of file diff --git a/bsp/freedom-e310-arty/metal.freertos.lds b/bsp/freedom-e310-arty/metal.freertos.lds index c772d023e..4e28a5905 100644 --- a/bsp/freedom-e310-arty/metal.freertos.lds +++ b/bsp/freedom-e310-arty/metal.freertos.lds @@ -19,6 +19,14 @@ MEMORY rom (irx!wa) : ORIGIN = 0x20400000, LENGTH = 0x1fc00000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -78,17 +86,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >rom + } >rom :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >rom + } >rom :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >rom + } >rom :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -99,7 +107,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >rom + } >rom :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -110,7 +118,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >rom + } >rom :rom .privileged_functions : ALIGN (4) { __privileged_functions_start__ = .; @@ -128,7 +136,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >rom + } >rom :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -137,14 +145,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >rom + } >rom : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >rom + } >rom :rom .rodata : { *(.rdata) @@ -158,7 +166,7 @@ SECTIONS *(.srodata .srodata.*) __unprivileged_section_end__ = .; - } >rom + } >rom :rom /* ITIM SECTION * @@ -172,7 +180,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >itim AT>rom + } >itim AT>rom :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -194,11 +202,31 @@ SECTIONS PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.* .sdata2.*) *(.gnu.linkonce.s.*) - } >ram AT>rom + } >ram AT>rom :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >ram AT>rom :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >ram AT>ram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >ram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -207,10 +235,10 @@ SECTIONS *(.gnu.linkonce.b.*) *(COMMON) __unprivileged_data_section_end__ = .; - } >ram + } >ram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); .privileged_data (NOLOAD) : ALIGN(8) { @@ -228,14 +256,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >ram + } >ram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >ram + PROVIDE( __heap_end = . ); + } >ram :ram } \ No newline at end of file diff --git a/bsp/freedom-e310-arty/metal.ramrodata.lds b/bsp/freedom-e310-arty/metal.ramrodata.lds index 2fdb8d660..eb70b0b15 100644 --- a/bsp/freedom-e310-arty/metal.ramrodata.lds +++ b/bsp/freedom-e310-arty/metal.ramrodata.lds @@ -20,6 +20,14 @@ MEMORY rom (irx!wa) : ORIGIN = 0x20400000, LENGTH = 0x1fc00000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -79,17 +87,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >rom + } >rom :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >rom + } >rom :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >rom + } >rom :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -100,7 +108,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >rom + } >rom :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -111,7 +119,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >rom + } >rom :rom @@ -122,7 +130,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >rom + } >rom :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -131,14 +139,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >rom + } >rom : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >rom + } >rom :rom /* ITIM SECTION @@ -153,7 +161,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >itim AT>rom + } >itim AT>rom :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -186,11 +194,31 @@ SECTIONS *(.rdata) *(.rodata .rodata.*) *(.gnu.linkonce.r.*) - } >ram AT>rom + } >ram AT>rom :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >ram AT>rom :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >ram AT>ram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >ram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -198,10 +226,10 @@ SECTIONS *(.bss .bss.*) *(.gnu.linkonce.b.*) *(COMMON) - } >ram + } >ram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); @@ -211,14 +239,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >ram + } >ram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >ram + PROVIDE( __heap_end = . ); + } >ram :ram } \ No newline at end of file diff --git a/bsp/freedom-e310-arty/metal.scratchpad.lds b/bsp/freedom-e310-arty/metal.scratchpad.lds index a3ed56caf..fa25165d7 100644 --- a/bsp/freedom-e310-arty/metal.scratchpad.lds +++ b/bsp/freedom-e310-arty/metal.scratchpad.lds @@ -17,6 +17,14 @@ MEMORY rom (irx!wa) : ORIGIN = 0x20400000, LENGTH = 0x1fc00000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -76,17 +84,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >ram + } >ram :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >ram + } >ram :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >ram + } >ram :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -97,7 +105,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >ram + } >ram :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -108,7 +116,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >ram + } >ram :rom @@ -119,7 +127,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >ram + } >ram :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -128,14 +136,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >ram + } >ram : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >ram + } >ram :rom .rodata : { *(.rdata) @@ -148,7 +156,7 @@ SECTIONS *(.srodata.cst2) *(.srodata .srodata.*) - } >ram + } >ram :rom /* ITIM SECTION * @@ -162,7 +170,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >itim AT>ram + } >itim AT>ram :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -183,11 +191,31 @@ SECTIONS PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.* .sdata2.*) *(.gnu.linkonce.s.*) - } >ram AT>ram + } >ram AT>ram :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >ram AT>ram :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >ram AT>ram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >ram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -195,10 +223,10 @@ SECTIONS *(.bss .bss.*) *(.gnu.linkonce.b.*) *(COMMON) - } >ram + } >ram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); @@ -208,14 +236,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >ram + } >ram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >ram + PROVIDE( __heap_end = . ); + } >ram :ram } \ No newline at end of file diff --git a/bsp/qemu-sifive-e31/metal.default.lds b/bsp/qemu-sifive-e31/metal.default.lds index ed28e8c73..0dd2470ae 100644 --- a/bsp/qemu-sifive-e31/metal.default.lds +++ b/bsp/qemu-sifive-e31/metal.default.lds @@ -15,6 +15,14 @@ MEMORY rom (irx!wa) : ORIGIN = 0x20400000, LENGTH = 0x1fc00000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -74,17 +82,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >rom + } >rom :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >rom + } >rom :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >rom + } >rom :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -95,7 +103,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >rom + } >rom :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -106,7 +114,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >rom + } >rom :rom @@ -117,7 +125,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >rom + } >rom :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -126,14 +134,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >rom + } >rom : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >rom + } >rom :rom .rodata : { *(.rdata) @@ -146,7 +154,7 @@ SECTIONS *(.srodata.cst2) *(.srodata .srodata.*) - } >rom + } >rom :rom /* ITIM SECTION * @@ -160,7 +168,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >ram AT>rom + } >ram AT>rom :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -181,11 +189,31 @@ SECTIONS PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.* .sdata2.*) *(.gnu.linkonce.s.*) - } >ram AT>rom + } >ram AT>rom :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >ram AT>rom :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >ram AT>ram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >ram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -193,10 +221,10 @@ SECTIONS *(.bss .bss.*) *(.gnu.linkonce.b.*) *(COMMON) - } >ram + } >ram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); @@ -206,14 +234,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >ram + } >ram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >ram + PROVIDE( __heap_end = . ); + } >ram :ram } \ No newline at end of file diff --git a/bsp/qemu-sifive-e31/metal.freertos.lds b/bsp/qemu-sifive-e31/metal.freertos.lds index fe66977ff..94d3494a8 100644 --- a/bsp/qemu-sifive-e31/metal.freertos.lds +++ b/bsp/qemu-sifive-e31/metal.freertos.lds @@ -18,6 +18,14 @@ MEMORY rom (irx!wa) : ORIGIN = 0x20400000, LENGTH = 0x1fc00000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -77,17 +85,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >rom + } >rom :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >rom + } >rom :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >rom + } >rom :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -98,7 +106,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >rom + } >rom :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -109,7 +117,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >rom + } >rom :rom .privileged_functions : ALIGN (4) { __privileged_functions_start__ = .; @@ -127,7 +135,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >rom + } >rom :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -136,14 +144,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >rom + } >rom : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >rom + } >rom :rom .rodata : { *(.rdata) @@ -157,7 +165,7 @@ SECTIONS *(.srodata .srodata.*) __unprivileged_section_end__ = .; - } >rom + } >rom :rom /* ITIM SECTION * @@ -171,7 +179,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >ram AT>rom + } >ram AT>rom :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -193,11 +201,31 @@ SECTIONS PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.* .sdata2.*) *(.gnu.linkonce.s.*) - } >ram AT>rom + } >ram AT>rom :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >ram AT>rom :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >ram AT>ram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >ram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -206,10 +234,10 @@ SECTIONS *(.gnu.linkonce.b.*) *(COMMON) __unprivileged_data_section_end__ = .; - } >ram + } >ram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); .privileged_data (NOLOAD) : ALIGN(8) { @@ -227,14 +255,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >ram + } >ram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >ram + PROVIDE( __heap_end = . ); + } >ram :ram } \ No newline at end of file diff --git a/bsp/qemu-sifive-e31/metal.ramrodata.lds b/bsp/qemu-sifive-e31/metal.ramrodata.lds index 38fc2f1c7..797799d64 100644 --- a/bsp/qemu-sifive-e31/metal.ramrodata.lds +++ b/bsp/qemu-sifive-e31/metal.ramrodata.lds @@ -19,6 +19,14 @@ MEMORY rom (irx!wa) : ORIGIN = 0x20400000, LENGTH = 0x1fc00000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -78,17 +86,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >rom + } >rom :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >rom + } >rom :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >rom + } >rom :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -99,7 +107,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >rom + } >rom :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -110,7 +118,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >rom + } >rom :rom @@ -121,7 +129,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >rom + } >rom :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -130,14 +138,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >rom + } >rom : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >rom + } >rom :rom /* ITIM SECTION @@ -152,7 +160,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >ram AT>rom + } >ram AT>rom :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -185,11 +193,31 @@ SECTIONS *(.rdata) *(.rodata .rodata.*) *(.gnu.linkonce.r.*) - } >ram AT>rom + } >ram AT>rom :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >ram AT>rom :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >ram AT>ram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >ram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -197,10 +225,10 @@ SECTIONS *(.bss .bss.*) *(.gnu.linkonce.b.*) *(COMMON) - } >ram + } >ram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); @@ -210,14 +238,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >ram + } >ram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >ram + PROVIDE( __heap_end = . ); + } >ram :ram } \ No newline at end of file diff --git a/bsp/qemu-sifive-e31/metal.scratchpad.lds b/bsp/qemu-sifive-e31/metal.scratchpad.lds index 8df4d8cf4..84bc43c64 100644 --- a/bsp/qemu-sifive-e31/metal.scratchpad.lds +++ b/bsp/qemu-sifive-e31/metal.scratchpad.lds @@ -16,6 +16,14 @@ MEMORY rom (irx!wa) : ORIGIN = 0x20400000, LENGTH = 0x1fc00000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -75,17 +83,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >ram + } >ram :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >ram + } >ram :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >ram + } >ram :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -96,7 +104,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >ram + } >ram :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -107,7 +115,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >ram + } >ram :rom @@ -118,7 +126,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >ram + } >ram :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -127,14 +135,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >ram + } >ram : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >ram + } >ram :rom .rodata : { *(.rdata) @@ -147,7 +155,7 @@ SECTIONS *(.srodata.cst2) *(.srodata .srodata.*) - } >ram + } >ram :rom /* ITIM SECTION * @@ -161,7 +169,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >ram AT>ram + } >ram AT>ram :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -182,11 +190,31 @@ SECTIONS PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.* .sdata2.*) *(.gnu.linkonce.s.*) - } >ram AT>ram + } >ram AT>ram :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >ram AT>ram :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >ram AT>ram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >ram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -194,10 +222,10 @@ SECTIONS *(.bss .bss.*) *(.gnu.linkonce.b.*) *(COMMON) - } >ram + } >ram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); @@ -207,14 +235,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >ram + } >ram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >ram + PROVIDE( __heap_end = . ); + } >ram :ram } \ No newline at end of file diff --git a/bsp/qemu-sifive-s51/metal.default.lds b/bsp/qemu-sifive-s51/metal.default.lds index ed28e8c73..0dd2470ae 100644 --- a/bsp/qemu-sifive-s51/metal.default.lds +++ b/bsp/qemu-sifive-s51/metal.default.lds @@ -15,6 +15,14 @@ MEMORY rom (irx!wa) : ORIGIN = 0x20400000, LENGTH = 0x1fc00000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -74,17 +82,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >rom + } >rom :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >rom + } >rom :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >rom + } >rom :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -95,7 +103,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >rom + } >rom :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -106,7 +114,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >rom + } >rom :rom @@ -117,7 +125,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >rom + } >rom :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -126,14 +134,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >rom + } >rom : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >rom + } >rom :rom .rodata : { *(.rdata) @@ -146,7 +154,7 @@ SECTIONS *(.srodata.cst2) *(.srodata .srodata.*) - } >rom + } >rom :rom /* ITIM SECTION * @@ -160,7 +168,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >ram AT>rom + } >ram AT>rom :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -181,11 +189,31 @@ SECTIONS PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.* .sdata2.*) *(.gnu.linkonce.s.*) - } >ram AT>rom + } >ram AT>rom :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >ram AT>rom :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >ram AT>ram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >ram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -193,10 +221,10 @@ SECTIONS *(.bss .bss.*) *(.gnu.linkonce.b.*) *(COMMON) - } >ram + } >ram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); @@ -206,14 +234,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >ram + } >ram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >ram + PROVIDE( __heap_end = . ); + } >ram :ram } \ No newline at end of file diff --git a/bsp/qemu-sifive-s51/metal.freertos.lds b/bsp/qemu-sifive-s51/metal.freertos.lds index fe66977ff..94d3494a8 100644 --- a/bsp/qemu-sifive-s51/metal.freertos.lds +++ b/bsp/qemu-sifive-s51/metal.freertos.lds @@ -18,6 +18,14 @@ MEMORY rom (irx!wa) : ORIGIN = 0x20400000, LENGTH = 0x1fc00000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -77,17 +85,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >rom + } >rom :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >rom + } >rom :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >rom + } >rom :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -98,7 +106,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >rom + } >rom :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -109,7 +117,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >rom + } >rom :rom .privileged_functions : ALIGN (4) { __privileged_functions_start__ = .; @@ -127,7 +135,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >rom + } >rom :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -136,14 +144,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >rom + } >rom : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >rom + } >rom :rom .rodata : { *(.rdata) @@ -157,7 +165,7 @@ SECTIONS *(.srodata .srodata.*) __unprivileged_section_end__ = .; - } >rom + } >rom :rom /* ITIM SECTION * @@ -171,7 +179,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >ram AT>rom + } >ram AT>rom :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -193,11 +201,31 @@ SECTIONS PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.* .sdata2.*) *(.gnu.linkonce.s.*) - } >ram AT>rom + } >ram AT>rom :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >ram AT>rom :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >ram AT>ram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >ram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -206,10 +234,10 @@ SECTIONS *(.gnu.linkonce.b.*) *(COMMON) __unprivileged_data_section_end__ = .; - } >ram + } >ram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); .privileged_data (NOLOAD) : ALIGN(8) { @@ -227,14 +255,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >ram + } >ram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >ram + PROVIDE( __heap_end = . ); + } >ram :ram } \ No newline at end of file diff --git a/bsp/qemu-sifive-s51/metal.ramrodata.lds b/bsp/qemu-sifive-s51/metal.ramrodata.lds index 38fc2f1c7..797799d64 100644 --- a/bsp/qemu-sifive-s51/metal.ramrodata.lds +++ b/bsp/qemu-sifive-s51/metal.ramrodata.lds @@ -19,6 +19,14 @@ MEMORY rom (irx!wa) : ORIGIN = 0x20400000, LENGTH = 0x1fc00000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -78,17 +86,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >rom + } >rom :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >rom + } >rom :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >rom + } >rom :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -99,7 +107,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >rom + } >rom :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -110,7 +118,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >rom + } >rom :rom @@ -121,7 +129,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >rom + } >rom :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -130,14 +138,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >rom + } >rom : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >rom + } >rom :rom /* ITIM SECTION @@ -152,7 +160,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >ram AT>rom + } >ram AT>rom :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -185,11 +193,31 @@ SECTIONS *(.rdata) *(.rodata .rodata.*) *(.gnu.linkonce.r.*) - } >ram AT>rom + } >ram AT>rom :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >ram AT>rom :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >ram AT>ram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >ram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -197,10 +225,10 @@ SECTIONS *(.bss .bss.*) *(.gnu.linkonce.b.*) *(COMMON) - } >ram + } >ram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); @@ -210,14 +238,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >ram + } >ram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >ram + PROVIDE( __heap_end = . ); + } >ram :ram } \ No newline at end of file diff --git a/bsp/qemu-sifive-s51/metal.scratchpad.lds b/bsp/qemu-sifive-s51/metal.scratchpad.lds index 8df4d8cf4..84bc43c64 100644 --- a/bsp/qemu-sifive-s51/metal.scratchpad.lds +++ b/bsp/qemu-sifive-s51/metal.scratchpad.lds @@ -16,6 +16,14 @@ MEMORY rom (irx!wa) : ORIGIN = 0x20400000, LENGTH = 0x1fc00000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -75,17 +83,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >ram + } >ram :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >ram + } >ram :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >ram + } >ram :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -96,7 +104,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >ram + } >ram :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -107,7 +115,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >ram + } >ram :rom @@ -118,7 +126,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >ram + } >ram :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -127,14 +135,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >ram + } >ram : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >ram + } >ram :rom .rodata : { *(.rdata) @@ -147,7 +155,7 @@ SECTIONS *(.srodata.cst2) *(.srodata .srodata.*) - } >ram + } >ram :rom /* ITIM SECTION * @@ -161,7 +169,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >ram AT>ram + } >ram AT>ram :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -182,11 +190,31 @@ SECTIONS PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.* .sdata2.*) *(.gnu.linkonce.s.*) - } >ram AT>ram + } >ram AT>ram :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >ram AT>ram :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >ram AT>ram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >ram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -194,10 +222,10 @@ SECTIONS *(.bss .bss.*) *(.gnu.linkonce.b.*) *(COMMON) - } >ram + } >ram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); @@ -207,14 +235,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >ram + } >ram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >ram + PROVIDE( __heap_end = . ); + } >ram :ram } \ No newline at end of file diff --git a/bsp/qemu-sifive-u54/metal.default.lds b/bsp/qemu-sifive-u54/metal.default.lds index 9a27e6414..59ef7c56d 100644 --- a/bsp/qemu-sifive-u54/metal.default.lds +++ b/bsp/qemu-sifive-u54/metal.default.lds @@ -14,6 +14,14 @@ MEMORY testram (airwx) : ORIGIN = 0x80000000, LENGTH = 0x80000000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -73,17 +81,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >testram + } >testram :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >testram + } >testram :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >testram + } >testram :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -94,7 +102,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >testram + } >testram :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -105,7 +113,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >testram + } >testram :rom @@ -116,7 +124,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >testram + } >testram :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -125,14 +133,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >testram + } >testram : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >testram + } >testram :rom .rodata : { *(.rdata) @@ -145,7 +153,7 @@ SECTIONS *(.srodata.cst2) *(.srodata .srodata.*) - } >testram + } >testram :rom /* ITIM SECTION * @@ -159,7 +167,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >testram AT>testram + } >testram AT>testram :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -180,11 +188,31 @@ SECTIONS PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.* .sdata2.*) *(.gnu.linkonce.s.*) - } >testram AT>testram + } >testram AT>testram :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >testram AT>testram :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >testram AT>testram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >testram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -192,10 +220,10 @@ SECTIONS *(.bss .bss.*) *(.gnu.linkonce.b.*) *(COMMON) - } >testram + } >testram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); @@ -205,14 +233,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >testram + } >testram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >testram + PROVIDE( __heap_end = . ); + } >testram :ram } \ No newline at end of file diff --git a/bsp/qemu-sifive-u54/metal.freertos.lds b/bsp/qemu-sifive-u54/metal.freertos.lds index 17aec2578..7c1531b60 100644 --- a/bsp/qemu-sifive-u54/metal.freertos.lds +++ b/bsp/qemu-sifive-u54/metal.freertos.lds @@ -17,6 +17,14 @@ MEMORY testram (airwx) : ORIGIN = 0x80000000, LENGTH = 0x80000000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -76,17 +84,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >testram + } >testram :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >testram + } >testram :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >testram + } >testram :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -97,7 +105,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >testram + } >testram :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -108,7 +116,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >testram + } >testram :rom .privileged_functions : ALIGN (4) { __privileged_functions_start__ = .; @@ -126,7 +134,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >testram + } >testram :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -135,14 +143,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >testram + } >testram : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >testram + } >testram :rom .rodata : { *(.rdata) @@ -156,7 +164,7 @@ SECTIONS *(.srodata .srodata.*) __unprivileged_section_end__ = .; - } >testram + } >testram :rom /* ITIM SECTION * @@ -170,7 +178,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >testram AT>testram + } >testram AT>testram :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -192,11 +200,31 @@ SECTIONS PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.* .sdata2.*) *(.gnu.linkonce.s.*) - } >testram AT>testram + } >testram AT>testram :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >testram AT>testram :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >testram AT>testram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >testram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -205,10 +233,10 @@ SECTIONS *(.gnu.linkonce.b.*) *(COMMON) __unprivileged_data_section_end__ = .; - } >testram + } >testram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); .privileged_data (NOLOAD) : ALIGN(8) { @@ -226,14 +254,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >testram + } >testram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >testram + PROVIDE( __heap_end = . ); + } >testram :ram } \ No newline at end of file diff --git a/bsp/qemu-sifive-u54/metal.ramrodata.lds b/bsp/qemu-sifive-u54/metal.ramrodata.lds index 6b0100004..fcece341c 100644 --- a/bsp/qemu-sifive-u54/metal.ramrodata.lds +++ b/bsp/qemu-sifive-u54/metal.ramrodata.lds @@ -18,6 +18,14 @@ MEMORY testram (airwx) : ORIGIN = 0x80000000, LENGTH = 0x80000000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -77,17 +85,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >testram + } >testram :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >testram + } >testram :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >testram + } >testram :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -98,7 +106,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >testram + } >testram :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -109,7 +117,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >testram + } >testram :rom @@ -120,7 +128,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >testram + } >testram :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -129,14 +137,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >testram + } >testram : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >testram + } >testram :rom /* ITIM SECTION @@ -151,7 +159,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >testram AT>testram + } >testram AT>testram :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -184,11 +192,31 @@ SECTIONS *(.rdata) *(.rodata .rodata.*) *(.gnu.linkonce.r.*) - } >testram AT>testram + } >testram AT>testram :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >testram AT>testram :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >testram AT>testram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >testram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -196,10 +224,10 @@ SECTIONS *(.bss .bss.*) *(.gnu.linkonce.b.*) *(COMMON) - } >testram + } >testram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); @@ -209,14 +237,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >testram + } >testram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >testram + PROVIDE( __heap_end = . ); + } >testram :ram } \ No newline at end of file diff --git a/bsp/qemu-sifive-u54/metal.scratchpad.lds b/bsp/qemu-sifive-u54/metal.scratchpad.lds index ae0599868..52ab5b605 100644 --- a/bsp/qemu-sifive-u54/metal.scratchpad.lds +++ b/bsp/qemu-sifive-u54/metal.scratchpad.lds @@ -15,6 +15,14 @@ MEMORY testram (airwx) : ORIGIN = 0x80000000, LENGTH = 0x80000000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -74,17 +82,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >testram + } >testram :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >testram + } >testram :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >testram + } >testram :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -95,7 +103,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >testram + } >testram :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -106,7 +114,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >testram + } >testram :rom @@ -117,7 +125,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >testram + } >testram :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -126,14 +134,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >testram + } >testram : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >testram + } >testram :rom .rodata : { *(.rdata) @@ -146,7 +154,7 @@ SECTIONS *(.srodata.cst2) *(.srodata .srodata.*) - } >testram + } >testram :rom /* ITIM SECTION * @@ -160,7 +168,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >testram AT>testram + } >testram AT>testram :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -181,11 +189,31 @@ SECTIONS PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.* .sdata2.*) *(.gnu.linkonce.s.*) - } >testram AT>testram + } >testram AT>testram :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >testram AT>testram :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >testram AT>testram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >testram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -193,10 +221,10 @@ SECTIONS *(.bss .bss.*) *(.gnu.linkonce.b.*) *(COMMON) - } >testram + } >testram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); @@ -206,14 +234,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >testram + } >testram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >testram + PROVIDE( __heap_end = . ); + } >testram :ram } \ No newline at end of file diff --git a/bsp/qemu-sifive-u54mc/metal.default.lds b/bsp/qemu-sifive-u54mc/metal.default.lds index ec8ed8ca5..c8c4963b5 100644 --- a/bsp/qemu-sifive-u54mc/metal.default.lds +++ b/bsp/qemu-sifive-u54mc/metal.default.lds @@ -14,6 +14,14 @@ MEMORY testram (airwx) : ORIGIN = 0x80000000, LENGTH = 0x80000000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -73,17 +81,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >testram + } >testram :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >testram + } >testram :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >testram + } >testram :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -94,7 +102,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >testram + } >testram :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -105,7 +113,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >testram + } >testram :rom @@ -116,7 +124,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >testram + } >testram :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -125,14 +133,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >testram + } >testram : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >testram + } >testram :rom .rodata : { *(.rdata) @@ -145,7 +153,7 @@ SECTIONS *(.srodata.cst2) *(.srodata .srodata.*) - } >testram + } >testram :rom /* ITIM SECTION * @@ -159,7 +167,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >testram AT>testram + } >testram AT>testram :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -180,11 +188,31 @@ SECTIONS PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.* .sdata2.*) *(.gnu.linkonce.s.*) - } >testram AT>testram + } >testram AT>testram :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >testram AT>testram :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >testram AT>testram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >testram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -192,10 +220,10 @@ SECTIONS *(.bss .bss.*) *(.gnu.linkonce.b.*) *(COMMON) - } >testram + } >testram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); @@ -208,14 +236,16 @@ SECTIONS . += __stack_size; /* Hart 2 */ . += __stack_size; /* Hart 3 */ PROVIDE(metal_segment_stack_end = .); - } >testram + } >testram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >testram + PROVIDE( __heap_end = . ); + } >testram :ram } \ No newline at end of file diff --git a/bsp/qemu-sifive-u54mc/metal.freertos.lds b/bsp/qemu-sifive-u54mc/metal.freertos.lds index ebcc972a0..4b0165346 100644 --- a/bsp/qemu-sifive-u54mc/metal.freertos.lds +++ b/bsp/qemu-sifive-u54mc/metal.freertos.lds @@ -17,6 +17,14 @@ MEMORY testram (airwx) : ORIGIN = 0x80000000, LENGTH = 0x80000000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -76,17 +84,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >testram + } >testram :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >testram + } >testram :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >testram + } >testram :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -97,7 +105,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >testram + } >testram :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -108,7 +116,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >testram + } >testram :rom .privileged_functions : ALIGN (4) { __privileged_functions_start__ = .; @@ -126,7 +134,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >testram + } >testram :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -135,14 +143,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >testram + } >testram : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >testram + } >testram :rom .rodata : { *(.rdata) @@ -156,7 +164,7 @@ SECTIONS *(.srodata .srodata.*) __unprivileged_section_end__ = .; - } >testram + } >testram :rom /* ITIM SECTION * @@ -170,7 +178,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >testram AT>testram + } >testram AT>testram :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -192,11 +200,31 @@ SECTIONS PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.* .sdata2.*) *(.gnu.linkonce.s.*) - } >testram AT>testram + } >testram AT>testram :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >testram AT>testram :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >testram AT>testram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >testram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -205,10 +233,10 @@ SECTIONS *(.gnu.linkonce.b.*) *(COMMON) __unprivileged_data_section_end__ = .; - } >testram + } >testram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); .privileged_data (NOLOAD) : ALIGN(8) { @@ -229,14 +257,16 @@ SECTIONS . += __stack_size; /* Hart 2 */ . += __stack_size; /* Hart 3 */ PROVIDE(metal_segment_stack_end = .); - } >testram + } >testram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >testram + PROVIDE( __heap_end = . ); + } >testram :ram } \ No newline at end of file diff --git a/bsp/qemu-sifive-u54mc/metal.ramrodata.lds b/bsp/qemu-sifive-u54mc/metal.ramrodata.lds index d071b4084..e30b12131 100644 --- a/bsp/qemu-sifive-u54mc/metal.ramrodata.lds +++ b/bsp/qemu-sifive-u54mc/metal.ramrodata.lds @@ -18,6 +18,14 @@ MEMORY testram (airwx) : ORIGIN = 0x80000000, LENGTH = 0x80000000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -77,17 +85,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >testram + } >testram :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >testram + } >testram :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >testram + } >testram :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -98,7 +106,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >testram + } >testram :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -109,7 +117,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >testram + } >testram :rom @@ -120,7 +128,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >testram + } >testram :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -129,14 +137,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >testram + } >testram : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >testram + } >testram :rom /* ITIM SECTION @@ -151,7 +159,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >testram AT>testram + } >testram AT>testram :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -184,11 +192,31 @@ SECTIONS *(.rdata) *(.rodata .rodata.*) *(.gnu.linkonce.r.*) - } >testram AT>testram + } >testram AT>testram :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >testram AT>testram :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >testram AT>testram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >testram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -196,10 +224,10 @@ SECTIONS *(.bss .bss.*) *(.gnu.linkonce.b.*) *(COMMON) - } >testram + } >testram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); @@ -212,14 +240,16 @@ SECTIONS . += __stack_size; /* Hart 2 */ . += __stack_size; /* Hart 3 */ PROVIDE(metal_segment_stack_end = .); - } >testram + } >testram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >testram + PROVIDE( __heap_end = . ); + } >testram :ram } \ No newline at end of file diff --git a/bsp/qemu-sifive-u54mc/metal.scratchpad.lds b/bsp/qemu-sifive-u54mc/metal.scratchpad.lds index da8bd1d70..731f4aab7 100644 --- a/bsp/qemu-sifive-u54mc/metal.scratchpad.lds +++ b/bsp/qemu-sifive-u54mc/metal.scratchpad.lds @@ -15,6 +15,14 @@ MEMORY testram (airwx) : ORIGIN = 0x80000000, LENGTH = 0x80000000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -74,17 +82,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >testram + } >testram :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >testram + } >testram :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >testram + } >testram :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -95,7 +103,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >testram + } >testram :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -106,7 +114,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >testram + } >testram :rom @@ -117,7 +125,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >testram + } >testram :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -126,14 +134,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >testram + } >testram : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >testram + } >testram :rom .rodata : { *(.rdata) @@ -146,7 +154,7 @@ SECTIONS *(.srodata.cst2) *(.srodata .srodata.*) - } >testram + } >testram :rom /* ITIM SECTION * @@ -160,7 +168,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >testram AT>testram + } >testram AT>testram :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -181,11 +189,31 @@ SECTIONS PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.* .sdata2.*) *(.gnu.linkonce.s.*) - } >testram AT>testram + } >testram AT>testram :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >testram AT>testram :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >testram AT>testram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >testram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -193,10 +221,10 @@ SECTIONS *(.bss .bss.*) *(.gnu.linkonce.b.*) *(COMMON) - } >testram + } >testram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); @@ -209,14 +237,16 @@ SECTIONS . += __stack_size; /* Hart 2 */ . += __stack_size; /* Hart 3 */ PROVIDE(metal_segment_stack_end = .); - } >testram + } >testram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >testram + PROVIDE( __heap_end = . ); + } >testram :ram } \ No newline at end of file diff --git a/bsp/sifive-hifive-unleashed/metal.default.lds b/bsp/sifive-hifive-unleashed/metal.default.lds index 63f6e6916..8542c96bb 100644 --- a/bsp/sifive-hifive-unleashed/metal.default.lds +++ b/bsp/sifive-hifive-unleashed/metal.default.lds @@ -16,6 +16,14 @@ MEMORY rom (irx!wa) : ORIGIN = 0x20000000, LENGTH = 0x10000000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -75,17 +83,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >rom + } >rom :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >rom + } >rom :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >rom + } >rom :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -96,7 +104,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >rom + } >rom :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -107,7 +115,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >rom + } >rom :rom @@ -118,7 +126,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >rom + } >rom :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -127,14 +135,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >rom + } >rom : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >rom + } >rom :rom .rodata : { *(.rdata) @@ -147,7 +155,7 @@ SECTIONS *(.srodata.cst2) *(.srodata .srodata.*) - } >rom + } >rom :rom /* ITIM SECTION * @@ -161,7 +169,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >itim AT>rom + } >itim AT>rom :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -182,11 +190,31 @@ SECTIONS PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.* .sdata2.*) *(.gnu.linkonce.s.*) - } >ram AT>rom + } >ram AT>rom :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >ram AT>rom :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >ram AT>ram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >ram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -194,10 +222,10 @@ SECTIONS *(.bss .bss.*) *(.gnu.linkonce.b.*) *(COMMON) - } >ram + } >ram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); @@ -211,14 +239,16 @@ SECTIONS . += __stack_size; /* Hart 3 */ . += __stack_size; /* Hart 4 */ PROVIDE(metal_segment_stack_end = .); - } >ram + } >ram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >ram + PROVIDE( __heap_end = . ); + } >ram :ram } \ No newline at end of file diff --git a/bsp/sifive-hifive-unleashed/metal.freertos.lds b/bsp/sifive-hifive-unleashed/metal.freertos.lds index aad7c5467..a357aa487 100644 --- a/bsp/sifive-hifive-unleashed/metal.freertos.lds +++ b/bsp/sifive-hifive-unleashed/metal.freertos.lds @@ -19,6 +19,14 @@ MEMORY rom (irx!wa) : ORIGIN = 0x20000000, LENGTH = 0x10000000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -78,17 +86,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >rom + } >rom :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >rom + } >rom :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >rom + } >rom :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -99,7 +107,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >rom + } >rom :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -110,7 +118,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >rom + } >rom :rom .privileged_functions : ALIGN (4) { __privileged_functions_start__ = .; @@ -128,7 +136,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >rom + } >rom :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -137,14 +145,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >rom + } >rom : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >rom + } >rom :rom .rodata : { *(.rdata) @@ -158,7 +166,7 @@ SECTIONS *(.srodata .srodata.*) __unprivileged_section_end__ = .; - } >rom + } >rom :rom /* ITIM SECTION * @@ -172,7 +180,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >itim AT>rom + } >itim AT>rom :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -194,11 +202,31 @@ SECTIONS PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.* .sdata2.*) *(.gnu.linkonce.s.*) - } >ram AT>rom + } >ram AT>rom :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >ram AT>rom :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >ram AT>ram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >ram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -207,10 +235,10 @@ SECTIONS *(.gnu.linkonce.b.*) *(COMMON) __unprivileged_data_section_end__ = .; - } >ram + } >ram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); .privileged_data (NOLOAD) : ALIGN(8) { @@ -232,14 +260,16 @@ SECTIONS . += __stack_size; /* Hart 3 */ . += __stack_size; /* Hart 4 */ PROVIDE(metal_segment_stack_end = .); - } >ram + } >ram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >ram + PROVIDE( __heap_end = . ); + } >ram :ram } \ No newline at end of file diff --git a/bsp/sifive-hifive-unleashed/metal.ramrodata.lds b/bsp/sifive-hifive-unleashed/metal.ramrodata.lds index ae544599b..1bda6f753 100644 --- a/bsp/sifive-hifive-unleashed/metal.ramrodata.lds +++ b/bsp/sifive-hifive-unleashed/metal.ramrodata.lds @@ -20,6 +20,14 @@ MEMORY rom (irx!wa) : ORIGIN = 0x20000000, LENGTH = 0x10000000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -79,17 +87,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >rom + } >rom :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >rom + } >rom :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >rom + } >rom :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -100,7 +108,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >rom + } >rom :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -111,7 +119,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >rom + } >rom :rom @@ -122,7 +130,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >rom + } >rom :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -131,7 +139,7 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >rom + } >rom : rom @@ -155,7 +163,7 @@ SECTIONS *(.text .text.*) *(.gnu.linkonce.t.*) *(.itim .itim.*) - } >itim AT>rom + } >itim AT>rom :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -188,11 +196,31 @@ SECTIONS *(.rdata) *(.rodata .rodata.*) *(.gnu.linkonce.r.*) - } >ram AT>rom + } >ram AT>rom :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >ram AT>rom :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >ram AT>ram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >ram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -200,10 +228,10 @@ SECTIONS *(.bss .bss.*) *(.gnu.linkonce.b.*) *(COMMON) - } >ram + } >ram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); @@ -217,14 +245,16 @@ SECTIONS . += __stack_size; /* Hart 3 */ . += __stack_size; /* Hart 4 */ PROVIDE(metal_segment_stack_end = .); - } >ram + } >ram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >ram + PROVIDE( __heap_end = . ); + } >ram :ram } \ No newline at end of file diff --git a/bsp/sifive-hifive-unleashed/metal.scratchpad.lds b/bsp/sifive-hifive-unleashed/metal.scratchpad.lds index d145f5e69..0dbf66b52 100644 --- a/bsp/sifive-hifive-unleashed/metal.scratchpad.lds +++ b/bsp/sifive-hifive-unleashed/metal.scratchpad.lds @@ -17,6 +17,14 @@ MEMORY rom (irx!wa) : ORIGIN = 0x20000000, LENGTH = 0x10000000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -76,17 +84,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >ram + } >ram :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >ram + } >ram :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >ram + } >ram :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -97,7 +105,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >ram + } >ram :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -108,7 +116,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >ram + } >ram :rom @@ -119,7 +127,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >ram + } >ram :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -128,14 +136,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >ram + } >ram : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >ram + } >ram :rom .rodata : { *(.rdata) @@ -148,7 +156,7 @@ SECTIONS *(.srodata.cst2) *(.srodata .srodata.*) - } >ram + } >ram :rom /* ITIM SECTION * @@ -162,7 +170,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >itim AT>ram + } >itim AT>ram :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -183,11 +191,31 @@ SECTIONS PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.* .sdata2.*) *(.gnu.linkonce.s.*) - } >ram AT>ram + } >ram AT>ram :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >ram AT>ram :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >ram AT>ram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >ram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -195,10 +223,10 @@ SECTIONS *(.bss .bss.*) *(.gnu.linkonce.b.*) *(COMMON) - } >ram + } >ram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); @@ -212,14 +240,16 @@ SECTIONS . += __stack_size; /* Hart 3 */ . += __stack_size; /* Hart 4 */ PROVIDE(metal_segment_stack_end = .); - } >ram + } >ram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >ram + PROVIDE( __heap_end = . ); + } >ram :ram } \ No newline at end of file diff --git a/bsp/sifive-hifive1-revb/metal.default.lds b/bsp/sifive-hifive1-revb/metal.default.lds index 09b03a32d..b7451ceea 100644 --- a/bsp/sifive-hifive1-revb/metal.default.lds +++ b/bsp/sifive-hifive1-revb/metal.default.lds @@ -16,6 +16,14 @@ MEMORY rom (irx!wa) : ORIGIN = 0x20010000, LENGTH = 0x6a120 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -75,17 +83,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >rom + } >rom :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >rom + } >rom :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >rom + } >rom :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -96,7 +104,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >rom + } >rom :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -107,7 +115,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >rom + } >rom :rom @@ -118,7 +126,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >rom + } >rom :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -127,14 +135,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >rom + } >rom : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >rom + } >rom :rom .rodata : { *(.rdata) @@ -147,7 +155,7 @@ SECTIONS *(.srodata.cst2) *(.srodata .srodata.*) - } >rom + } >rom :rom /* ITIM SECTION * @@ -161,7 +169,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >itim AT>rom + } >itim AT>rom :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -182,11 +190,31 @@ SECTIONS PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.* .sdata2.*) *(.gnu.linkonce.s.*) - } >ram AT>rom + } >ram AT>rom :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >ram AT>rom :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >ram AT>ram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >ram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -194,10 +222,10 @@ SECTIONS *(.bss .bss.*) *(.gnu.linkonce.b.*) *(COMMON) - } >ram + } >ram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); @@ -207,14 +235,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >ram + } >ram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >ram + PROVIDE( __heap_end = . ); + } >ram :ram } \ No newline at end of file diff --git a/bsp/sifive-hifive1-revb/metal.freertos.lds b/bsp/sifive-hifive1-revb/metal.freertos.lds index eeba88d54..5221c8682 100644 --- a/bsp/sifive-hifive1-revb/metal.freertos.lds +++ b/bsp/sifive-hifive1-revb/metal.freertos.lds @@ -19,6 +19,14 @@ MEMORY rom (irx!wa) : ORIGIN = 0x20010000, LENGTH = 0x6a120 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -78,17 +86,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >rom + } >rom :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >rom + } >rom :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >rom + } >rom :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -99,7 +107,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >rom + } >rom :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -110,7 +118,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >rom + } >rom :rom .privileged_functions : ALIGN (4) { __privileged_functions_start__ = .; @@ -128,7 +136,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >rom + } >rom :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -137,14 +145,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >rom + } >rom : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >rom + } >rom :rom .rodata : { *(.rdata) @@ -158,7 +166,7 @@ SECTIONS *(.srodata .srodata.*) __unprivileged_section_end__ = .; - } >rom + } >rom :rom /* ITIM SECTION * @@ -172,7 +180,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >itim AT>rom + } >itim AT>rom :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -194,11 +202,31 @@ SECTIONS PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.* .sdata2.*) *(.gnu.linkonce.s.*) - } >ram AT>rom + } >ram AT>rom :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >ram AT>rom :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >ram AT>ram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >ram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -207,10 +235,10 @@ SECTIONS *(.gnu.linkonce.b.*) *(COMMON) __unprivileged_data_section_end__ = .; - } >ram + } >ram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); .privileged_data (NOLOAD) : ALIGN(8) { @@ -228,14 +256,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >ram + } >ram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >ram + PROVIDE( __heap_end = . ); + } >ram :ram } \ No newline at end of file diff --git a/bsp/sifive-hifive1-revb/metal.ramrodata.lds b/bsp/sifive-hifive1-revb/metal.ramrodata.lds index d3db57346..18a1ddd5e 100644 --- a/bsp/sifive-hifive1-revb/metal.ramrodata.lds +++ b/bsp/sifive-hifive1-revb/metal.ramrodata.lds @@ -20,6 +20,14 @@ MEMORY rom (irx!wa) : ORIGIN = 0x20010000, LENGTH = 0x6a120 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -79,17 +87,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >rom + } >rom :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >rom + } >rom :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >rom + } >rom :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -100,7 +108,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >rom + } >rom :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -111,7 +119,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >rom + } >rom :rom @@ -122,7 +130,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >rom + } >rom :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -131,14 +139,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >rom + } >rom : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >rom + } >rom :rom /* ITIM SECTION @@ -153,7 +161,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >itim AT>rom + } >itim AT>rom :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -186,11 +194,31 @@ SECTIONS *(.rdata) *(.rodata .rodata.*) *(.gnu.linkonce.r.*) - } >ram AT>rom + } >ram AT>rom :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >ram AT>rom :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >ram AT>ram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >ram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -198,10 +226,10 @@ SECTIONS *(.bss .bss.*) *(.gnu.linkonce.b.*) *(COMMON) - } >ram + } >ram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); @@ -211,14 +239,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >ram + } >ram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >ram + PROVIDE( __heap_end = . ); + } >ram :ram } \ No newline at end of file diff --git a/bsp/sifive-hifive1-revb/metal.scratchpad.lds b/bsp/sifive-hifive1-revb/metal.scratchpad.lds index 6e9d4abb7..bb6a5365b 100644 --- a/bsp/sifive-hifive1-revb/metal.scratchpad.lds +++ b/bsp/sifive-hifive1-revb/metal.scratchpad.lds @@ -17,6 +17,14 @@ MEMORY rom (irx!wa) : ORIGIN = 0x20010000, LENGTH = 0x6a120 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -76,17 +84,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >ram + } >ram :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >ram + } >ram :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >ram + } >ram :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -97,7 +105,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >ram + } >ram :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -108,7 +116,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >ram + } >ram :rom @@ -119,7 +127,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >ram + } >ram :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -128,14 +136,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >ram + } >ram : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >ram + } >ram :rom .rodata : { *(.rdata) @@ -148,7 +156,7 @@ SECTIONS *(.srodata.cst2) *(.srodata .srodata.*) - } >ram + } >ram :rom /* ITIM SECTION * @@ -162,7 +170,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >itim AT>ram + } >itim AT>ram :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -183,11 +191,31 @@ SECTIONS PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.* .sdata2.*) *(.gnu.linkonce.s.*) - } >ram AT>ram + } >ram AT>ram :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >ram AT>ram :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >ram AT>ram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >ram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -195,10 +223,10 @@ SECTIONS *(.bss .bss.*) *(.gnu.linkonce.b.*) *(COMMON) - } >ram + } >ram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); @@ -208,14 +236,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >ram + } >ram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >ram + PROVIDE( __heap_end = . ); + } >ram :ram } \ No newline at end of file diff --git a/bsp/sifive-hifive1/metal.default.lds b/bsp/sifive-hifive1/metal.default.lds index 60a018063..c13808684 100644 --- a/bsp/sifive-hifive1/metal.default.lds +++ b/bsp/sifive-hifive1/metal.default.lds @@ -15,6 +15,14 @@ MEMORY rom (irx!wa) : ORIGIN = 0x20400000, LENGTH = 0x1fc00000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -74,17 +82,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >rom + } >rom :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >rom + } >rom :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >rom + } >rom :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -95,7 +103,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >rom + } >rom :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -106,7 +114,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >rom + } >rom :rom @@ -117,7 +125,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >rom + } >rom :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -126,14 +134,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >rom + } >rom : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >rom + } >rom :rom .rodata : { *(.rdata) @@ -146,7 +154,7 @@ SECTIONS *(.srodata.cst2) *(.srodata .srodata.*) - } >rom + } >rom :rom /* ITIM SECTION * @@ -160,7 +168,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >ram AT>rom + } >ram AT>rom :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -181,11 +189,31 @@ SECTIONS PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.* .sdata2.*) *(.gnu.linkonce.s.*) - } >ram AT>rom + } >ram AT>rom :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >ram AT>rom :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >ram AT>ram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >ram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -193,10 +221,10 @@ SECTIONS *(.bss .bss.*) *(.gnu.linkonce.b.*) *(COMMON) - } >ram + } >ram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); @@ -206,14 +234,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >ram + } >ram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >ram + PROVIDE( __heap_end = . ); + } >ram :ram } \ No newline at end of file diff --git a/bsp/sifive-hifive1/metal.freertos.lds b/bsp/sifive-hifive1/metal.freertos.lds index 2ed1ec43c..1f421d37c 100644 --- a/bsp/sifive-hifive1/metal.freertos.lds +++ b/bsp/sifive-hifive1/metal.freertos.lds @@ -18,6 +18,14 @@ MEMORY rom (irx!wa) : ORIGIN = 0x20400000, LENGTH = 0x1fc00000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -77,17 +85,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >rom + } >rom :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >rom + } >rom :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >rom + } >rom :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -98,7 +106,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >rom + } >rom :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -109,7 +117,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >rom + } >rom :rom .privileged_functions : ALIGN (4) { __privileged_functions_start__ = .; @@ -127,7 +135,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >rom + } >rom :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -136,14 +144,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >rom + } >rom : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >rom + } >rom :rom .rodata : { *(.rdata) @@ -157,7 +165,7 @@ SECTIONS *(.srodata .srodata.*) __unprivileged_section_end__ = .; - } >rom + } >rom :rom /* ITIM SECTION * @@ -171,7 +179,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >ram AT>rom + } >ram AT>rom :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -193,11 +201,31 @@ SECTIONS PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.* .sdata2.*) *(.gnu.linkonce.s.*) - } >ram AT>rom + } >ram AT>rom :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >ram AT>rom :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >ram AT>ram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >ram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -206,10 +234,10 @@ SECTIONS *(.gnu.linkonce.b.*) *(COMMON) __unprivileged_data_section_end__ = .; - } >ram + } >ram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); .privileged_data (NOLOAD) : ALIGN(8) { @@ -227,14 +255,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >ram + } >ram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >ram + PROVIDE( __heap_end = . ); + } >ram :ram } \ No newline at end of file diff --git a/bsp/sifive-hifive1/metal.ramrodata.lds b/bsp/sifive-hifive1/metal.ramrodata.lds index fdb03784e..5096e6123 100644 --- a/bsp/sifive-hifive1/metal.ramrodata.lds +++ b/bsp/sifive-hifive1/metal.ramrodata.lds @@ -19,6 +19,14 @@ MEMORY rom (irx!wa) : ORIGIN = 0x20400000, LENGTH = 0x1fc00000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -78,17 +86,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >rom + } >rom :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >rom + } >rom :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >rom + } >rom :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -99,7 +107,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >rom + } >rom :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -110,7 +118,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >rom + } >rom :rom @@ -121,7 +129,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >rom + } >rom :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -130,14 +138,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >rom + } >rom : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >rom + } >rom :rom /* ITIM SECTION @@ -152,7 +160,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >ram AT>rom + } >ram AT>rom :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -185,11 +193,31 @@ SECTIONS *(.rdata) *(.rodata .rodata.*) *(.gnu.linkonce.r.*) - } >ram AT>rom + } >ram AT>rom :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >ram AT>rom :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >ram AT>ram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >ram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -197,10 +225,10 @@ SECTIONS *(.bss .bss.*) *(.gnu.linkonce.b.*) *(COMMON) - } >ram + } >ram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); @@ -210,14 +238,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >ram + } >ram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >ram + PROVIDE( __heap_end = . ); + } >ram :ram } \ No newline at end of file diff --git a/bsp/sifive-hifive1/metal.scratchpad.lds b/bsp/sifive-hifive1/metal.scratchpad.lds index 2893b5a35..eb5b16c52 100644 --- a/bsp/sifive-hifive1/metal.scratchpad.lds +++ b/bsp/sifive-hifive1/metal.scratchpad.lds @@ -16,6 +16,14 @@ MEMORY rom (irx!wa) : ORIGIN = 0x20400000, LENGTH = 0x1fc00000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -75,17 +83,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >ram + } >ram :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >ram + } >ram :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >ram + } >ram :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -96,7 +104,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >ram + } >ram :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -107,7 +115,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >ram + } >ram :rom @@ -118,7 +126,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >ram + } >ram :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -127,14 +135,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >ram + } >ram : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >ram + } >ram :rom .rodata : { *(.rdata) @@ -147,7 +155,7 @@ SECTIONS *(.srodata.cst2) *(.srodata .srodata.*) - } >ram + } >ram :rom /* ITIM SECTION * @@ -161,7 +169,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >ram AT>ram + } >ram AT>ram :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -182,11 +190,31 @@ SECTIONS PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.* .sdata2.*) *(.gnu.linkonce.s.*) - } >ram AT>ram + } >ram AT>ram :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >ram AT>ram :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >ram AT>ram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >ram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -194,10 +222,10 @@ SECTIONS *(.bss .bss.*) *(.gnu.linkonce.b.*) *(COMMON) - } >ram + } >ram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); @@ -207,14 +235,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >ram + } >ram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >ram + PROVIDE( __heap_end = . ); + } >ram :ram } \ No newline at end of file diff --git a/bsp/spike/metal.default.lds b/bsp/spike/metal.default.lds index 9a27e6414..59ef7c56d 100644 --- a/bsp/spike/metal.default.lds +++ b/bsp/spike/metal.default.lds @@ -14,6 +14,14 @@ MEMORY testram (airwx) : ORIGIN = 0x80000000, LENGTH = 0x80000000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -73,17 +81,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >testram + } >testram :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >testram + } >testram :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >testram + } >testram :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -94,7 +102,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >testram + } >testram :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -105,7 +113,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >testram + } >testram :rom @@ -116,7 +124,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >testram + } >testram :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -125,14 +133,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >testram + } >testram : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >testram + } >testram :rom .rodata : { *(.rdata) @@ -145,7 +153,7 @@ SECTIONS *(.srodata.cst2) *(.srodata .srodata.*) - } >testram + } >testram :rom /* ITIM SECTION * @@ -159,7 +167,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >testram AT>testram + } >testram AT>testram :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -180,11 +188,31 @@ SECTIONS PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.* .sdata2.*) *(.gnu.linkonce.s.*) - } >testram AT>testram + } >testram AT>testram :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >testram AT>testram :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >testram AT>testram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >testram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -192,10 +220,10 @@ SECTIONS *(.bss .bss.*) *(.gnu.linkonce.b.*) *(COMMON) - } >testram + } >testram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); @@ -205,14 +233,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >testram + } >testram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >testram + PROVIDE( __heap_end = . ); + } >testram :ram } \ No newline at end of file diff --git a/bsp/spike/metal.freertos.lds b/bsp/spike/metal.freertos.lds index 17aec2578..7c1531b60 100644 --- a/bsp/spike/metal.freertos.lds +++ b/bsp/spike/metal.freertos.lds @@ -17,6 +17,14 @@ MEMORY testram (airwx) : ORIGIN = 0x80000000, LENGTH = 0x80000000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -76,17 +84,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >testram + } >testram :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >testram + } >testram :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >testram + } >testram :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -97,7 +105,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >testram + } >testram :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -108,7 +116,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >testram + } >testram :rom .privileged_functions : ALIGN (4) { __privileged_functions_start__ = .; @@ -126,7 +134,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >testram + } >testram :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -135,14 +143,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >testram + } >testram : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >testram + } >testram :rom .rodata : { *(.rdata) @@ -156,7 +164,7 @@ SECTIONS *(.srodata .srodata.*) __unprivileged_section_end__ = .; - } >testram + } >testram :rom /* ITIM SECTION * @@ -170,7 +178,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >testram AT>testram + } >testram AT>testram :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -192,11 +200,31 @@ SECTIONS PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.* .sdata2.*) *(.gnu.linkonce.s.*) - } >testram AT>testram + } >testram AT>testram :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >testram AT>testram :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >testram AT>testram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >testram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -205,10 +233,10 @@ SECTIONS *(.gnu.linkonce.b.*) *(COMMON) __unprivileged_data_section_end__ = .; - } >testram + } >testram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); .privileged_data (NOLOAD) : ALIGN(8) { @@ -226,14 +254,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >testram + } >testram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >testram + PROVIDE( __heap_end = . ); + } >testram :ram } \ No newline at end of file diff --git a/bsp/spike/metal.ramrodata.lds b/bsp/spike/metal.ramrodata.lds index 6b0100004..fcece341c 100644 --- a/bsp/spike/metal.ramrodata.lds +++ b/bsp/spike/metal.ramrodata.lds @@ -18,6 +18,14 @@ MEMORY testram (airwx) : ORIGIN = 0x80000000, LENGTH = 0x80000000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -77,17 +85,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >testram + } >testram :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >testram + } >testram :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >testram + } >testram :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -98,7 +106,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >testram + } >testram :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -109,7 +117,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >testram + } >testram :rom @@ -120,7 +128,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >testram + } >testram :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -129,14 +137,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >testram + } >testram : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >testram + } >testram :rom /* ITIM SECTION @@ -151,7 +159,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >testram AT>testram + } >testram AT>testram :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -184,11 +192,31 @@ SECTIONS *(.rdata) *(.rodata .rodata.*) *(.gnu.linkonce.r.*) - } >testram AT>testram + } >testram AT>testram :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >testram AT>testram :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >testram AT>testram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >testram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -196,10 +224,10 @@ SECTIONS *(.bss .bss.*) *(.gnu.linkonce.b.*) *(COMMON) - } >testram + } >testram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); @@ -209,14 +237,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >testram + } >testram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >testram + PROVIDE( __heap_end = . ); + } >testram :ram } \ No newline at end of file diff --git a/bsp/spike/metal.scratchpad.lds b/bsp/spike/metal.scratchpad.lds index ae0599868..52ab5b605 100644 --- a/bsp/spike/metal.scratchpad.lds +++ b/bsp/spike/metal.scratchpad.lds @@ -15,6 +15,14 @@ MEMORY testram (airwx) : ORIGIN = 0x80000000, LENGTH = 0x80000000 } +PHDRS +{ + rom PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; + ram PT_LOAD; +} + SECTIONS { /* Each hart is allocated its own stack of size __stack_size. This value @@ -74,17 +82,17 @@ SECTIONS KEEP (*(.text.metal.init.*)) KEEP (*(SORT_NONE(.init))) KEEP (*(.text.libgloss.start)) - } >testram + } >testram :rom .fini : { KEEP (*(SORT_NONE(.fini))) - } >testram + } >testram :rom .preinit_array : ALIGN(8) { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } >testram + } >testram :rom .init_array : ALIGN(8) { PROVIDE_HIDDEN (__init_array_start = .); @@ -95,7 +103,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.init_array.*))); KEEP (*(.metal.init_array)); PROVIDE_HIDDEN ( metal_constructors_end = .); - } >testram + } >testram :rom .fini_array : ALIGN(8) { PROVIDE_HIDDEN (__fini_array_start = .); @@ -106,7 +114,7 @@ SECTIONS KEEP (*(SORT_BY_INIT_PRIORITY(.metal.fini_array.*))); KEEP (*(.metal.fini_array)); PROVIDE_HIDDEN ( metal_destructors_end = .); - } >testram + } >testram :rom @@ -117,7 +125,7 @@ SECTIONS KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) KEEP (*(.metal.ctors .metal.ctors.*)) - } >testram + } >testram :rom .dtors : { KEEP (*crtbegin.o(.dtors)) @@ -126,14 +134,14 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.metal.dtors .metal.dtors.*)) - } >testram + } >testram : rom .text : { *(.text.unlikely .text.unlikely.*) *(.text.startup .text.startup.*) *(.text .text.*) *(.gnu.linkonce.t.*) - } >testram + } >testram :rom .rodata : { *(.rdata) @@ -146,7 +154,7 @@ SECTIONS *(.srodata.cst2) *(.srodata .srodata.*) - } >testram + } >testram :rom /* ITIM SECTION * @@ -160,7 +168,7 @@ SECTIONS .itim : ALIGN(8) { *(.itim .itim.*) - } >testram AT>testram + } >testram AT>testram :rom PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) ); PROVIDE( metal_segment_itim_target_start = ADDR(.itim) ); @@ -181,11 +189,31 @@ SECTIONS PROVIDE( __global_pointer$ = . + 0x800 ); *(.sdata .sdata.* .sdata2.*) *(.gnu.linkonce.s.*) - } >testram AT>testram + } >testram AT>testram :ram_init + + .tdata : { + PROVIDE( __tls_base = . ); + *(.tdata .tdata.* .gnu.linkonce.td.*) + } >testram AT>testram :tls :ram_init + + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); PROVIDE( metal_segment_data_source_start = LOADADDR(.data) ); PROVIDE( metal_segment_data_target_start = ADDR(.data) ); - PROVIDE( metal_segment_data_target_end = ADDR(.data) + SIZEOF(.data) ); + PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) ); + + .tbss : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon .tcommon.*) + PROVIDE( __tls_end = . ); + } >testram AT>testram :tls :ram + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + + .tbss_space : { + . = . + __tbss_size; + } >testram :ram .bss (NOLOAD): ALIGN(8) { *(.sbss*) @@ -193,10 +221,10 @@ SECTIONS *(.bss .bss.*) *(.gnu.linkonce.b.*) *(COMMON) - } >testram + } >testram :ram - PROVIDE( metal_segment_bss_source_start = LOADADDR(.bss) ); - PROVIDE( metal_segment_bss_target_start = ADDR(.bss) ); + PROVIDE( metal_segment_bss_source_start = LOADADDR(.tbss) ); + PROVIDE( metal_segment_bss_target_start = ADDR(.tbss) ); PROVIDE( metal_segment_bss_target_end = ADDR(.bss) + SIZEOF(.bss) ); @@ -206,14 +234,16 @@ SECTIONS . += __stack_size; /* Hart 0 */ PROVIDE( _sp = . ); PROVIDE(metal_segment_stack_end = .); - } >testram + } >testram :ram .heap (NOLOAD) : ALIGN(4) { + PROVIDE( __end = . ); PROVIDE( metal_segment_heap_target_start = . ); /* If __heap_max is defined, grow the heap to use the rest of RAM, * otherwise set the heap size to __heap_size */ . = DEFINED(__heap_max) ? MIN( LENGTH(ram) - ( . - ORIGIN(ram)) , 0x10000000) : __heap_size; PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); - } >testram + PROVIDE( __heap_end = . ); + } >testram :ram } \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index 8f79b8c38..992b5e547 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,6 +1,7 @@ FROM ubuntu:16.04 AS download-tarballs ARG RISCV_TOOLS_TARBALL=riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14.tar.gz +ARG RISCV_PICOLIBC_TARBALL=riscv64-unknown-elf-picolibc-1.4.1-2019.08.0-x86_64-linux-ubuntu14.tar.gz ARG QEMU_TARBALL=riscv-qemu-4.1.0-2019.08.0-x86_64-linux-ubuntu14.tar.gz RUN apt-get update && \ @@ -9,6 +10,10 @@ RUN apt-get update && \ rsync \ wget +# Install picolibc +RUN wget --no-verbose https://github.com/keith-packard/picolibc/releases/download/1.4.1/${RISCV_PICOLIBC_TARBALL} && \ + tar xzf ${RISCV_PICOLIBC_TARBALL} + # Install RISC-V Toolchain RUN wget --no-verbose https://static.dev.sifive.com/dev-tools/${RISCV_TOOLS_TARBALL} && \ tar xzf ${RISCV_TOOLS_TARBALL} && \ diff --git a/freedom-metal b/freedom-metal index 6fd4b0a4e..decf30784 160000 --- a/freedom-metal +++ b/freedom-metal @@ -1 +1 @@ -Subproject commit 6fd4b0a4e1c12b9ab159aea42fbe5ff7e6f7e81f +Subproject commit decf307843530081cbfa585c872a31cbb42fb1c8 diff --git a/scripts/all-targets-build b/scripts/all-targets-build index ee8be44f8..0153ae30a 100755 --- a/scripts/all-targets-build +++ b/scripts/all-targets-build @@ -25,6 +25,11 @@ do continue fi + # mc examples are broken + if [ "${program}" == "example-freertos-mc" -o "${program}" == "example-freertos-blinky-mc" ]; then + continue + fi + make TARGET="${target}" PROGRAM="${program}" CONFIGURATION="${CONFIGURATION}" -j${nproc} software make TARGET="${target}" PROGRAM="${program}" CONFIGURATION="${CONFIGURATION}" clean-software done diff --git a/scripts/ldscript-generator b/scripts/ldscript-generator index 9cbbc90dd..0fff38012 160000 --- a/scripts/ldscript-generator +++ b/scripts/ldscript-generator @@ -1 +1 @@ -Subproject commit 9cbbc90dd67bdb2615a153f0c8217e706663ea5c +Subproject commit 0fff38012af8ab7dc1715d08e5ff3456847ceb65 diff --git a/scripts/libmetal.mk b/scripts/libmetal.mk index 7ab7e7d1d..97ba97f17 100644 --- a/scripts/libmetal.mk +++ b/scripts/libmetal.mk @@ -114,7 +114,7 @@ $(METAL_BUILD_DIR)/Makefile: \ --host=$(CROSS_COMPILE) \ --prefix=$(METAL_PREFIX) \ --libdir=$(METAL_LIB_DIR) \ - --with-builtin-libgloss \ + $(METAL_WITH_EXTRA) \ --with-machine-header=$(abspath $(METAL_HEADER)) \ --with-machine-inline=$(abspath $(METAL_INLINE)) \ --with-platform-header=$(abspath $(PLATFORM_HEADER)) diff --git a/scripts/standalone.mk b/scripts/standalone.mk index 1b9d66236..a6446c230 100644 --- a/scripts/standalone.mk +++ b/scripts/standalone.mk @@ -41,6 +41,26 @@ ifeq ($(RISCV_CMODEL),) RISCV_CMODEL = medany endif +ifeq ($(RISCV_LIBC),) +RISCV_LIBC=nano +endif + +ifeq ($(RISCV_LIBC),nano) +LIBMETAL_EXTRA=-lmetal-gloss +METAL_WITH_EXTRA=--with-builtin-libgloss +SPEC=nano +endif + +ifeq ($(RISCV_LIBC),picolibc) +LIBMETAL_EXTRA=-lmetal-pico +METAL_WITH_EXTRA=--with-builtin-libmetal-pico +SPEC=picolibc +endif + +ifeq ($(SPEC),) +$(error RISCV_LIBC set to an unsupported value: $(RISCV_LIBC)) +endif + ifeq ($(PROGRAM),dhrystone) ifeq ($(LINK_TARGET),) ifneq ($(TARGET),freedom-e310-arty) @@ -78,6 +98,15 @@ else $(error Unable to determine XLEN from $(RISCV_ARCH)) endif +MTIME_RATE_HZ_DEF=32768 +ifeq ($(findstring qemu,$(TARGET)),qemu) +MTIME_RATE_HZ_DEF=10000000 +else +ifeq ($(findstring unleashed,$(TARGET)),unleashed) +MTIME_RATE_HZ_DEF=1000000 +endif +endif + ############################################################# # Toolchain ############################################################# @@ -128,10 +157,14 @@ RISCV_CXXFLAGS += -ffunction-sections -fdata-sections RISCV_CCASFLAGS += -I$(abspath $(BSP_DIR)/install/include/) RISCV_CFLAGS += -I$(abspath $(BSP_DIR)/install/include/) RISCV_CXXFLAGS += -I$(abspath $(BSP_DIR)/install/include/) -# Use newlib-nano -RISCV_CCASFLAGS += --specs=nano.specs -RISCV_CFLAGS += --specs=nano.specs -RISCV_CXXFLAGS += --specs=nano.specs +# Reference selected library +RISCV_ASFLAGS += --specs=$(SPEC).specs +RISCV_CCASFLAGS += --specs=$(SPEC).specs +RISCV_CFLAGS += --specs=$(SPEC).specs +RISCV_CXXFLAGS += --specs=$(SPEC).specs +# Set the MTIME frequency +RISCV_CFLAGS += -DMTIME_RATE_HZ_DEF=$(MTIME_RATE_HZ_DEF) +RISCV_CXXFLAGS += -DMTIME_RATE_HZ_DEF=$(MTIME_RATE_HZ_DEF) # Turn on garbage collection for unused sections RISCV_LDFLAGS += -Wl,--gc-sections @@ -143,7 +176,7 @@ RISCV_LDFLAGS += -nostartfiles -nostdlib RISCV_LDFLAGS += -L$(sort $(dir $(abspath $(filter %.a,$^)))) -T$(abspath $(filter %.lds,$^)) # Link to the relevant libraries -RISCV_LDLIBS += -Wl,--start-group -lc -lgcc -lm -lmetal -lmetal-gloss -Wl,--end-group +RISCV_LDLIBS += -Wl,--start-group -lc -lgcc -lm -lmetal $(LIBMETAL_EXTRA) -Wl,--end-group # Load the configuration Makefile CONFIGURATION_FILE = $(wildcard $(CONFIGURATION).mk) @@ -206,6 +239,7 @@ PROGRAM_SRCS = $(wildcard $(SRC_DIR)/*.c) $(wildcard $(SRC_DIR)/*.h) $(wildcard $(PROGRAM_ELF): \ $(PROGRAM_SRCS) \ $(BSP_DIR)/install/lib/$(CONFIGURATION)/libmetal.a \ + $(BSP_DIR)/install/lib/$(CONFIGURATION)/libmetal-pico.a \ $(BSP_DIR)/install/lib/$(CONFIGURATION)/libmetal-gloss.a \ $(BSP_DIR)/metal.$(LINK_TARGET).lds mkdir -p $(dir $@) diff --git a/wit-manifest.json b/wit-manifest.json index fab4761bf..32966eef5 100644 --- a/wit-manifest.json +++ b/wit-manifest.json @@ -5,7 +5,7 @@ "source": "git@github.com:sifive/freedom-devicetree-tools.git" }, { - "commit": "6fd4b0a4e1c12b9ab159aea42fbe5ff7e6f7e81f", + "commit": "decf307843530081cbfa585c872a31cbb42fb1c8", "name": "freedom-metal", "source": "git@github.com:sifive/freedom-metal.git" }, @@ -20,7 +20,7 @@ "source": "git@github.com:sifive/devicetree-overlay-generator.git" }, { - "commit": "9cbbc90dd67bdb2615a153f0c8217e706663ea5c", + "commit": "0fff38012af8ab7dc1715d08e5ff3456847ceb65", "name": "ldscript-generator", "source": "git@github.com:sifive/ldscript-generator.git" }, @@ -200,7 +200,7 @@ "source": "git@github.com:sifive/benchmark-mem-latency.git" }, { - "commit": "32fbffebc06c1f737d6c87aeefb390ff3b9c43b4", + "commit": "6e2f8115fcd7ba60e141b5e2d84bf2209df26adb", "name": "FreeRTOS-metal", "source": "git@github.com:sifive/FreeRTOS-metal.git" },