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 #407 from sifive/picolibc
Browse files Browse the repository at this point in the history
Picolibc
  • Loading branch information
nategraff-sifive authored Apr 17, 2020
2 parents 3b19e71 + c6720ed commit 609b550
Show file tree
Hide file tree
Showing 45 changed files with 1,745 additions and 617 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ jobs:
"",
"-std=c99 -Wall -Wextra -Wpedantic -Werror -Wno-unused-parameter",
]
riscv_libc: [
"",
"picolibc",
]

steps:
- name: 'Clone freedom-e-sdk'
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion FreeRTOS-metal
64 changes: 47 additions & 17 deletions bsp/freedom-e310-arty/metal.default.lds
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = .);
Expand All @@ -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 = .);
Expand All @@ -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



Expand All @@ -118,7 +126,7 @@ SECTIONS
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
KEEP (*(.metal.ctors .metal.ctors.*))
} >rom
} >rom :rom

.dtors : {
KEEP (*crtbegin.o(.dtors))
Expand All @@ -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)
Expand All @@ -147,7 +155,7 @@ SECTIONS
*(.srodata.cst2)
*(.srodata .srodata.*)

} >rom
} >rom :rom

/* ITIM SECTION
*
Expand All @@ -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) );
Expand All @@ -182,22 +190,42 @@ 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*)
*(.gnu.linkonce.sb.*)
*(.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) );


Expand All @@ -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
}
64 changes: 47 additions & 17 deletions bsp/freedom-e310-arty/metal.freertos.lds
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = .);
Expand All @@ -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 = .);
Expand All @@ -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__ = .;
Expand All @@ -128,7 +136,7 @@ SECTIONS
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
KEEP (*(.metal.ctors .metal.ctors.*))
} >rom
} >rom :rom

.dtors : {
KEEP (*crtbegin.o(.dtors))
Expand All @@ -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)
Expand All @@ -158,7 +166,7 @@ SECTIONS
*(.srodata .srodata.*)
__unprivileged_section_end__ = .;

} >rom
} >rom :rom

/* ITIM SECTION
*
Expand All @@ -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) );
Expand All @@ -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*)
Expand All @@ -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) {
Expand All @@ -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
}
Loading

0 comments on commit 609b550

Please sign in to comment.