The relationship between linker rom/ram size and VHDL IMEM/DMEM size #991
-
Background: I am playing around with the ram size variable of the linker script and the IMEM/DMEM size variable in the simple TB when running the hello world demo. I can't fully wrap my head around the behaviour I am seeing, so asking here for a small clarification. The reason I am doing these tests is because I want to create my own program that has large global variables and I am figuring out where these exactly get put in memory and what size that memory should be. Question: When I compile hello_world with When I compile hello_world with However, for both compile styles the output is the same:
And the sim gives the same logs:
So why does the reconfiguring of |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 17 replies
-
A follow-up question is about the problems with executing the following main file in simulation:
with the test array located in test.h and of size When simulating this, nothing gets printed any more. The compilation of this file results in a larger binary:
But that should not be a problem because my However, when I change the array size to
I really don't get what I am missing here... |
Beta Was this translation helpful? Give feedback.
-
Hi @Sam-Vervaeck !
On first glance it may appear like that. The size of the executables (or in fact the different sections of it) are the same, yes. But what is different is where the linker puts stuff at runtime. If you check the output of the diff --git a/sw/example/hello_world/main.asm b/sw/example/hello_world/main.asm
index 12815883..4dbbb6fd 100644
--- a/sw/example/hello_world/main.asm
+++ b/sw/example/hello_world/main.asm
@@ -14,8 +14,8 @@ Disassembly of section .text:
18: 30401073 csrw mie,zero
0000001c <__crt0_pointer_init>:
- 1c: 80020217 auipc tp,0x80020
- 20: fe320213 addi tp,tp,-29 # 8001ffff <__crt0_stack_end>
+ 1c: 80100217 auipc tp,0x80100
+ 20: fe320213 addi tp,tp,-29 # 800fffff <__crt0_stack_end>
24: ffc27113 andi sp,tp,-4
28: 80000297 auipc t0,0x80000
2c: 7d828293 addi t0,t0,2008 # 80000800 <__global_pointer$>
@@ -158,7 +158,7 @@ int main() { The symbol
Where (usually) the
When changing Thats why nothing is printed. To fix this, set |
Beta Was this translation helpful? Give feedback.
-
@NikLeberg thanks for clearing this! :) |
Beta Was this translation helpful? Give feedback.
Hi @Sam-Vervaeck !
On first glance it may appear like that. The size of the executables (or in fact the different sections of it) are the same, yes. But what is different is where the linker puts stuff at runtime.
If you check the output of the
make asm
task for each setting and compare the produced assembly, then you will notice that the only difference is__crt0_stack_end
. I.e. the start of the stack.