-
Notifications
You must be signed in to change notification settings - Fork 7.6k
arch: arm: cortex_a_r: Fix linker script #77291
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
Conversation
Hello @mausys, and thank you very much for your first pull request to the Zephyr project! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution. I think it would be valuable to try to keep this file aligned with its aarch64 variant.
@carlocaione I see this is not conditioned in aarch64 either.
Do you have any recommendation on this matter ?
@mausys please fix the CI errors. Also, can you give a reproducer for the problem you are seeing? |
05dad1c
to
47f3315
Compare
You can check the generated .map file for a non-XIP project (my target is a zynq 7000). The value of the variable _image_ram_start is less than that of _text_region_start, while _image_ram_end is greater than __text_region_end. That means, that _image_ram includes the __text_region. All those variables are used in arm_mmu.c to create the page table entries. I'm not sure what happens when multiple page table entries exist for a page. But the code segment might become writable, what could be a security issue. Anyway it creates unnecessary page table entries. |
I analyzed the arm_mmu.c again and as far as I understand, maybe no duplicate entries are created and instead the code segment overwrites the wrong data segment entries. But this is confusing. |
47f3315
to
2126d8b
Compare
@carlocaione Does @mausys’s replies answer your question? |
@carlocaione ping? :) |
fbdcbac
to
3332bff
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding "fix" in commit title helps identify fixes and instead of "like e102e37690a" could you add some more comments?
Here is a rough draft of what I think could be added instead for both commits:
arch: arm: cortex_m: fix text region overlap with ram in !XIP
ROM_ADDR and RAM_ADDR is same when CONFIG_XIP is not defined.
If we reset the location for RAMABLE region to RAM_ADDR text region,
which is part of rom, overlaps with initial ram region.
This commit tries to avoid this incorrect behaviour for cortex_m
3332bff
to
cc2972b
Compare
@ithinuel has your request for change been addressed properly? If yes, please revisit your -1, thanks! |
@mausys, sorry for the oversight, could you please remove my name from the commit message as a co-author? I don't think adding review comments always counts for co-authorship. Appreciate your help! |
ROM_ADDR and RAM_ADDR is same when CONFIG_XIP is not defined. If we reset the location for RAMABLE region to RAM_ADDR text region, which is part of rom, overlaps with initial ram region. This commit tries to avoid this incorrect behaviour for cortex_a and cortex_m Signed-off-by: Simon Maurer <mail@maurer.systems>
cc2972b
to
8ac1faf
Compare
Hi @mausys @ithinuel @wearyzen
|
This commit fixes overlapping MMU regions. If ROM_ADDR equals RAM_ADDR, the current output location counter will not be resetted, so the _image_ram range doesn't include the __text_region range.