Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heap and stack location assigned by compiler (__heap_end, _shadow_stack_base, _stack_cache_base) #18

Open
torurstrom opened this issue Dec 11, 2024 · 0 comments
Assignees

Comments

@torurstrom
Copy link
Contributor

When we use programs that do not fit within the 2 MiB default size, it is necessary to manually set the heap and stack locations, e.g., for a 64 MiB memory (0x04000000 addresses), the symbols may be defined as

-O2 -Wl,--defsym,__heap_end=0x02000000 -Wl,--defsym,_stack_cache_base=0x04000000 -Wl,--defsym,_shadow_stack_base=0x03ff8000

i.e., the heap ends at half the memory size (the heap start is set by the compiler as right after the program), the stack for the first core starts at the end of the memory, and the size of the stack is 0x04000000-0x03ff8000=32 KiB. The second core's stack the starts at 0x03ff8000 and so on.

This can be difficult for users to know and decide on. Another approach is to let the compiler know the memory size, address spaces that are reserved/off limits and the stack size, and then let the compiler decide where to place the heap and stack.

@Emoun Emoun transferred this issue from t-crest/patmos Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants