Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #469 from sifive/bump-ldscript-generator
Browse files Browse the repository at this point in the history
Bump ldscript generator for various fixes
  • Loading branch information
nategraff-sifive authored Apr 21, 2020
2 parents 5dfa130 + beceff7 commit 208e627
Show file tree
Hide file tree
Showing 38 changed files with 470 additions and 218 deletions.
19 changes: 13 additions & 6 deletions bsp/freedom-e310-arty/metal.default.lds
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ PHDRS
ram_init PT_LOAD;
tls PT_TLS;
ram PT_LOAD;
itim_init PT_LOAD;
}

SECTIONS
Expand Down Expand Up @@ -169,7 +170,7 @@ SECTIONS

.itim : ALIGN(8) {
*(.itim .itim.*)
} >itim AT>rom :rom
} >itim AT>rom :itim_init

PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) );
PROVIDE( metal_segment_itim_target_start = ADDR(.itim) );
Expand All @@ -181,6 +182,11 @@ SECTIONS
* memory into a read-write-capable memory such as data tightly-integrated
* memory (DTIM) or another main memory, as well as the BSS, stack, and
* heap.
*
* You might notice that .data, .tdata, .tbss, .tbss_space, and .bss all
* have an apparently unnecessary ALIGN at their top. This is because
* the implementation of _start in Freedom Metal libgloss depends on the
* ADDR and LOADADDR being 8-byte aligned.
*/

.data : ALIGN(8) {
Expand All @@ -192,7 +198,7 @@ SECTIONS
*(.gnu.linkonce.s.*)
} >ram AT>rom :ram_init

.tdata : {
.tdata : ALIGN(8) {
PROVIDE( __tls_base = . );
*(.tdata .tdata.* .gnu.linkonce.td.*)
} >ram AT>rom :tls :ram_init
Expand All @@ -204,15 +210,15 @@ SECTIONS
PROVIDE( metal_segment_data_target_start = ADDR(.data) );
PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) );

.tbss : {
.tbss : ALIGN(8) {
*(.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_space : ALIGN(8) {
. = . + __tbss_size;
} >ram :ram

Expand All @@ -238,13 +244,14 @@ SECTIONS
} >ram :ram

.heap (NOLOAD) : ALIGN(4) {
PROVIDE( __end = . );
PROVIDE( __end = . );
PROVIDE( __heap_start = . );
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 = . );
PROVIDE( __heap_end = . );
PROVIDE( __heap_end = . );
} >ram :ram
}
19 changes: 13 additions & 6 deletions bsp/freedom-e310-arty/metal.freertos.lds
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ PHDRS
ram_init PT_LOAD;
tls PT_TLS;
ram PT_LOAD;
itim_init PT_LOAD;
}

SECTIONS
Expand Down Expand Up @@ -180,7 +181,7 @@ SECTIONS

.itim : ALIGN(8) {
*(.itim .itim.*)
} >itim AT>rom :rom
} >itim AT>rom :itim_init

PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) );
PROVIDE( metal_segment_itim_target_start = ADDR(.itim) );
Expand All @@ -192,6 +193,11 @@ SECTIONS
* memory into a read-write-capable memory such as data tightly-integrated
* memory (DTIM) or another main memory, as well as the BSS, stack, and
* heap.
*
* You might notice that .data, .tdata, .tbss, .tbss_space, and .bss all
* have an apparently unnecessary ALIGN at their top. This is because
* the implementation of _start in Freedom Metal libgloss depends on the
* ADDR and LOADADDR being 8-byte aligned.
*/

.data : ALIGN(8) {
Expand All @@ -204,7 +210,7 @@ SECTIONS
*(.gnu.linkonce.s.*)
} >ram AT>rom :ram_init

.tdata : {
.tdata : ALIGN(8) {
PROVIDE( __tls_base = . );
*(.tdata .tdata.* .gnu.linkonce.td.*)
} >ram AT>rom :tls :ram_init
Expand All @@ -216,15 +222,15 @@ SECTIONS
PROVIDE( metal_segment_data_target_start = ADDR(.data) );
PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) );

.tbss : {
.tbss : ALIGN(8) {
*(.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_space : ALIGN(8) {
. = . + __tbss_size;
} >ram :ram

Expand Down Expand Up @@ -259,13 +265,14 @@ SECTIONS
} >ram :ram

.heap (NOLOAD) : ALIGN(4) {
PROVIDE( __end = . );
PROVIDE( __end = . );
PROVIDE( __heap_start = . );
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 = . );
PROVIDE( __heap_end = . );
PROVIDE( __heap_end = . );
} >ram :ram
}
19 changes: 13 additions & 6 deletions bsp/freedom-e310-arty/metal.ramrodata.lds
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ PHDRS
ram_init PT_LOAD;
tls PT_TLS;
ram PT_LOAD;
itim_init PT_LOAD;
}

SECTIONS
Expand Down Expand Up @@ -161,7 +162,7 @@ SECTIONS

.itim : ALIGN(8) {
*(.itim .itim.*)
} >itim AT>rom :rom
} >itim AT>rom :itim_init

PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) );
PROVIDE( metal_segment_itim_target_start = ADDR(.itim) );
Expand All @@ -173,6 +174,11 @@ SECTIONS
* memory into a read-write-capable memory such as data tightly-integrated
* memory (DTIM) or another main memory, as well as the BSS, stack, and
* heap.
*
* You might notice that .data, .tdata, .tbss, .tbss_space, and .bss all
* have an apparently unnecessary ALIGN at their top. This is because
* the implementation of _start in Freedom Metal libgloss depends on the
* ADDR and LOADADDR being 8-byte aligned.
*/

.data : ALIGN(8) {
Expand All @@ -196,7 +202,7 @@ SECTIONS
*(.gnu.linkonce.r.*)
} >ram AT>rom :ram_init

.tdata : {
.tdata : ALIGN(8) {
PROVIDE( __tls_base = . );
*(.tdata .tdata.* .gnu.linkonce.td.*)
} >ram AT>rom :tls :ram_init
Expand All @@ -208,15 +214,15 @@ SECTIONS
PROVIDE( metal_segment_data_target_start = ADDR(.data) );
PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) );

.tbss : {
.tbss : ALIGN(8) {
*(.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_space : ALIGN(8) {
. = . + __tbss_size;
} >ram :ram

Expand All @@ -242,13 +248,14 @@ SECTIONS
} >ram :ram

.heap (NOLOAD) : ALIGN(4) {
PROVIDE( __end = . );
PROVIDE( __end = . );
PROVIDE( __heap_start = . );
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 = . );
PROVIDE( __heap_end = . );
PROVIDE( __heap_end = . );
} >ram :ram
}
19 changes: 13 additions & 6 deletions bsp/freedom-e310-arty/metal.scratchpad.lds
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ PHDRS
ram_init PT_LOAD;
tls PT_TLS;
ram PT_LOAD;
itim_init PT_LOAD;
}

SECTIONS
Expand Down Expand Up @@ -170,7 +171,7 @@ SECTIONS

.itim : ALIGN(8) {
*(.itim .itim.*)
} >itim AT>ram :rom
} >itim AT>ram :itim_init

PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) );
PROVIDE( metal_segment_itim_target_start = ADDR(.itim) );
Expand All @@ -182,6 +183,11 @@ SECTIONS
* memory into a read-write-capable memory such as data tightly-integrated
* memory (DTIM) or another main memory, as well as the BSS, stack, and
* heap.
*
* You might notice that .data, .tdata, .tbss, .tbss_space, and .bss all
* have an apparently unnecessary ALIGN at their top. This is because
* the implementation of _start in Freedom Metal libgloss depends on the
* ADDR and LOADADDR being 8-byte aligned.
*/

.data : ALIGN(8) {
Expand All @@ -193,7 +199,7 @@ SECTIONS
*(.gnu.linkonce.s.*)
} >ram AT>ram :ram_init

.tdata : {
.tdata : ALIGN(8) {
PROVIDE( __tls_base = . );
*(.tdata .tdata.* .gnu.linkonce.td.*)
} >ram AT>ram :tls :ram_init
Expand All @@ -205,15 +211,15 @@ SECTIONS
PROVIDE( metal_segment_data_target_start = ADDR(.data) );
PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) );

.tbss : {
.tbss : ALIGN(8) {
*(.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_space : ALIGN(8) {
. = . + __tbss_size;
} >ram :ram

Expand All @@ -239,13 +245,14 @@ SECTIONS
} >ram :ram

.heap (NOLOAD) : ALIGN(4) {
PROVIDE( __end = . );
PROVIDE( __end = . );
PROVIDE( __heap_start = . );
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 = . );
PROVIDE( __heap_end = . );
PROVIDE( __heap_end = . );
} >ram :ram
}
19 changes: 13 additions & 6 deletions bsp/qemu-sifive-e31/metal.default.lds
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ PHDRS
ram_init PT_LOAD;
tls PT_TLS;
ram PT_LOAD;
itim_init PT_LOAD;
}

SECTIONS
Expand Down Expand Up @@ -168,7 +169,7 @@ SECTIONS

.itim : ALIGN(8) {
*(.itim .itim.*)
} >ram AT>rom :rom
} >ram AT>rom :itim_init

PROVIDE( metal_segment_itim_source_start = LOADADDR(.itim) );
PROVIDE( metal_segment_itim_target_start = ADDR(.itim) );
Expand All @@ -180,6 +181,11 @@ SECTIONS
* memory into a read-write-capable memory such as data tightly-integrated
* memory (DTIM) or another main memory, as well as the BSS, stack, and
* heap.
*
* You might notice that .data, .tdata, .tbss, .tbss_space, and .bss all
* have an apparently unnecessary ALIGN at their top. This is because
* the implementation of _start in Freedom Metal libgloss depends on the
* ADDR and LOADADDR being 8-byte aligned.
*/

.data : ALIGN(8) {
Expand All @@ -191,7 +197,7 @@ SECTIONS
*(.gnu.linkonce.s.*)
} >ram AT>rom :ram_init

.tdata : {
.tdata : ALIGN(8) {
PROVIDE( __tls_base = . );
*(.tdata .tdata.* .gnu.linkonce.td.*)
} >ram AT>rom :tls :ram_init
Expand All @@ -203,15 +209,15 @@ SECTIONS
PROVIDE( metal_segment_data_target_start = ADDR(.data) );
PROVIDE( metal_segment_data_target_end = ADDR(.tdata) + SIZEOF(.tdata) );

.tbss : {
.tbss : ALIGN(8) {
*(.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_space : ALIGN(8) {
. = . + __tbss_size;
} >ram :ram

Expand All @@ -237,13 +243,14 @@ SECTIONS
} >ram :ram

.heap (NOLOAD) : ALIGN(4) {
PROVIDE( __end = . );
PROVIDE( __end = . );
PROVIDE( __heap_start = . );
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 = . );
PROVIDE( __heap_end = . );
PROVIDE( __heap_end = . );
} >ram :ram
}
Loading

0 comments on commit 208e627

Please sign in to comment.