You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been learning how to compile rust for a PicoRV32 running on an FPGA with a simple hello world project.
The build system depends on this crate (picorv32-rt) and works correctly if I specify the RAM offset in memory.x to be 0x00000000. However, If I try to build with the RAM offset set to anything other than 0x00000000 then I get the following error:
error: linking with `rust-lld` failed: exit status: 1
|
= note: "rust-lld" "-flavor" "gnu" "/home/toby/SmartAcoustics/development/Coucal/coucal-examples/hello_world/target/riscv32imc-unknown-none-elf/release/deps/hello_world-d4686bcf81ebe3fc.hello_world.4b9de73c-cgu.0.rcgu.o" "/home/toby/SmartAcoustics/development/Coucal/coucal-examples/hello_world/target/riscv32imc-unknown-none-elf/release/deps/hello_world-d4686bcf81ebe3fc.hello_world.4b9de73c-cgu.1.rcgu.o" "/home/toby/SmartAcoustics/development/Coucal/coucal-examples/hello_world/target/riscv32imc-unknown-none-elf/release/deps/hello_world-d4686bcf81ebe3fc.hello_world.4b9de73c-cgu.2.rcgu.o" "--as-needed" "-L" "/home/toby/SmartAcoustics/development/Coucal/coucal-examples/hello_world/target/riscv32imc-unknown-none-elf/release/deps" "-L" "/home/toby/SmartAcoustics/development/Coucal/coucal-examples/hello_world/target/release/deps" "-L" "/home/toby/SmartAcoustics/development/Coucal/coucal-examples/hello_world/target/riscv32imc-unknown-none-elf/release/build/hello-world-afce2ada90003271/out" "-L" "/home/toby/SmartAcoustics/development/Coucal/coucal-examples/hello_world/target/riscv32imc-unknown-none-elf/release/build/picorv32-rt-09e83ab27c5016e1/out" "-L" "/home/toby/SmartAcoustics/development/Coucal/coucal-examples/hello_world/target/riscv32imc-unknown-none-elf/release/build/picorv32-rt-09e83ab27c5016e1/out" "-L" "/home/toby/SmartAcoustics/development/Coucal/coucal-examples/hello_world/target/riscv32imc-unknown-none-elf/release/build/picorv32-b61a8cc3c2e7815b/out" "-L" "/home/toby/SmartAcoustics/development/Coucal/coucal-examples/hello_world/target/riscv32imc-unknown-none-elf/release/build/riscv-3a3b4c9fe2d93f17/out" "-L" "/home/toby/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/riscv32imc-unknown-none-elf/lib" "--start-group" "-Bstatic" "/home/toby/SmartAcoustics/development/Coucal/coucal-examples/hello_world/target/riscv32imc-unknown-none-elf/release/deps/libpanic_halt-aea83376b0334f55.rlib" "/home/toby/SmartAcoustics/development/Coucal/coucal-examples/hello_world/target/riscv32imc-unknown-none-elf/release/deps/libpicorv32_rt-5008630363f2bd7b.rlib" "/home/toby/SmartAcoustics/development/Coucal/coucal-examples/hello_world/target/riscv32imc-unknown-none-elf/release/deps/libpicorv32-1b73dced3ca29185.rlib" "/home/toby/SmartAcoustics/development/Coucal/coucal-examples/hello_world/target/riscv32imc-unknown-none-elf/release/deps/libriscv-3402687458f5892a.rlib" "/home/toby/SmartAcoustics/development/Coucal/coucal-examples/hello_world/target/riscv32imc-unknown-none-elf/release/deps/libbit_field-e25dfa1160590cf0.rlib" "/home/toby/SmartAcoustics/development/Coucal/coucal-examples/hello_world/target/riscv32imc-unknown-none-elf/release/deps/libbare_metal-ff4fa36d97cf66d9.rlib" "/home/toby/SmartAcoustics/development/Coucal/coucal-examples/hello_world/target/riscv32imc-unknown-none-elf/release/deps/libr0-d835aacd4e55ffe9.rlib" "/home/toby/SmartAcoustics/development/Coucal/coucal-examples/hello_world/target/riscv32imc-unknown-none-elf/release/deps/libfixedvec-0ead9ae3dec59c6d.rlib" "/home/toby/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/riscv32imc-unknown-none-elf/lib/librustc_std_workspace_core-1ca50dceae486887.rlib" "/home/toby/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/riscv32imc-unknown-none-elf/lib/libcore-452968c43ebb50a5.rlib" "--end-group" "/home/toby/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/riscv32imc-unknown-none-elf/lib/libcompiler_builtins-997a38c6b1cb6cd6.rlib" "-Bdynamic" "-znoexecstack" "-L" "/home/toby/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/riscv32imc-unknown-none-elf/lib" "-o" "/home/toby/SmartAcoustics/development/Coucal/coucal-examples/hello_world/target/riscv32imc-unknown-none-elf/release/deps/hello_world-d4686bcf81ebe3fc" "--gc-sections" "-O1" "-Tlink.x"
= note: rust-lld: error: section '.stack' will not fit in region 'RAM': overflowed by 4096 bytes
rust-lld: error: section '.stack' will not fit in region 'RAM': overflowed by 4096 bytes
error: could not compile `hello-world` due to previous error
I have fixed this by copying picorv32-rt/link.x into my project and modifying it in the following way (which I copied from the riscv-rt/link.x):
diff --git a/link.x b/link.x
index c2ffb9b..322d145 100644
--- a/link.x+++ b/link.x@@ -55,7 +55,7 @@ SECTIONS
PROVIDE(_heap_size = 0);
/* fictitious region that represents the memory available for the heap */
- .heap (INFO) :+ .heap (NOLOAD) :
{
_sheap = .;
. += _heap_size;
@@ -64,7 +64,7 @@ SECTIONS
} > RAM
/* fictitious region that represents the memory available for the stack */
- .stack (INFO) :+ .stack (NOLOAD) :
{
_estack = .;
. = _stack_start;
Can we fix this in the crate? I'm complete linker script beginner so I apologize if I'm doing something stupid or have set my build system up incorrectly.
The text was updated successfully, but these errors were encountered:
tobygomersall
changed the title
Stack restricted to offset 0.
RAM restricted to offset 0.
Mar 30, 2022
I have been learning how to compile rust for a PicoRV32 running on an FPGA with a simple hello world project.
The build system depends on this crate (picorv32-rt) and works correctly if I specify the RAM offset in
memory.x
to be0x00000000
. However, If I try to build with the RAM offset set to anything other than0x00000000
then I get the following error:I have fixed this by copying
picorv32-rt/link.x
into my project and modifying it in the following way (which I copied from the riscv-rt/link.x):Can we fix this in the crate? I'm complete linker script beginner so I apologize if I'm doing something stupid or have set my build system up incorrectly.
The text was updated successfully, but these errors were encountered: