Skip to content
New issue

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

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

Already on GitHub? # to your account

cv32e40s ldgen bugfix #1991

Merged

Conversation

silabs-hfegran
Copy link
Contributor

@silabs-hfegran silabs-hfegran commented Jun 20, 2023

  • Fixed: Random tablejump sequence used hardcoded T0 register (Caused stack corruption)
  • Fixed: linker script generator run standalone does not get the correct include-files and errs on uvm macro that does not exist
  • Fixed: ldgen: Added support for configurations where not the entire memory map is writable
  • Fixed: -nmagic flag added (prevents linker from embedding the elf header into the first program header segment) This caused a binary mismatch between the output of objcopy and the contents of the program headers in the elf. The ISS only parses the program headers to decide what ends up in memory (correct from a program loader point of view but does not make sense for an embedded bare metal target). Objcopy that creates the raw binary for the RTL only parses the section header, which does not include this part of the binary, and thus there is a mismatch when this region is read without first being written by the program.
  • Fixed: Non-sensical debug region settings
  • Fixed: Missing enablement of "random instruction for hint"-setting in cpuctrl
  • Summary: Improved full regression test results from ~25/824 failures to ~4/824 failures

Signed-off-by: Henrik Fegran <Henrik.Fegran@silabs.com>
@silabs-hfegran silabs-hfegran marked this pull request as draft June 21, 2023 09:35
Signed-off-by: Henrik Fegran <Henrik.Fegran@silabs.com>
@silabs-hfegran silabs-hfegran marked this pull request as ready for review June 21, 2023 13:57
@MikeOpenHWGroup
Copy link
Member

I'll need some hand-holding to fully understand much of this.

@silabs-hfegran silabs-hfegran marked this pull request as draft June 22, 2023 07:20
@silabs-hfegran
Copy link
Contributor Author

I'll need some hand-holding to fully understand much of this.

When this PR Is fully ready I will give you a rundown of the changes - just want to double check a couple of items here before this is done.

mk/uvmt/xrun.mk Show resolved Hide resolved
cv32e40s/bsp/link_corev-dv.ld Outdated Show resolved Hide resolved
cv32e40s/bsp/link.ld Show resolved Hide resolved
cv32e40s/env/corev-dv/ldgen/cv32e40s_ldgen.sv Show resolved Hide resolved
Signed-off-by: Henrik Fegran <Henrik.Fegran@silabs.com>
Signed-off-by: Henrik Fegran <Henrik.Fegran@silabs.com>
Signed-off-by: Henrik Fegran <Henrik.Fegran@silabs.com>
@silabs-hfegran silabs-hfegran marked this pull request as ready for review June 22, 2023 14:27
@silabs-hfegran
Copy link
Contributor Author

While the GNU documentation for the -nmagic flag is rather sparse, I came across this comment on a LLVM PR that shed some light on the issue (different compiler, but gnu ld appears to behave this way as well), the undocumented behavior is the key here:

The -n (--nmagic) and -N (--omagic) options are used in non-paged environments such as embedded systems. They have the following documented
behavior:
--nmagic disables page alignment of OutputSections and disables linking against dynamic libraries.
--omagic is the same as --nmagic but additionally makes the text and data sections to be readable and writeable.
In addition to the documented behavior:

  • We don't generate a PT_RELO as there are no pages.
  • Unless explicitly instructed to by PHDRS we do not allocate the headers in the first program segment.
  • The linkerscript expressions that refer to the max and common page size are unaffected.

Signed-off-by: Henrik Fegran <Henrik.Fegran@silabs.com>
Signed-off-by: Henrik Fegran <Henrik.Fegran@silabs.com>
…tting to riscv-dv

Signed-off-by: Henrik Fegran <Henrik.Fegran@silabs.com>
@silabs-hfegran
Copy link
Contributor Author

silabs-hfegran commented Jun 28, 2023

Needs an update to pma_sb to account for debug module bypass of specific pma parameters - Currently pma configs with debug will most likely fail. Working on a fix Resolved

Signed-off-by: Henrik Fegran <Henrik.Fegran@silabs.com>
Signed-off-by: Henrik Fegran <Henrik.Fegran@silabs.com>
Signed-off-by: Henrik Fegran <Henrik.Fegran@silabs.com>
Signed-off-by: Henrik Fegran <Henrik.Fegran@silabs.com>
Copy link
Contributor

@silabs-robin silabs-robin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving based on:
Much of this has been discussed IRL.
The rest of it will be put on trial via regressions.
I have skimmed through everything and see nothing that should be objected to.

@silabs-robin silabs-robin merged commit 64209a9 into openhwgroup:cv32e40s/dev Jul 4, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants