Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Reimplement r0, since it is deprecated #122

Closed
coastalwhite opened this issue Sep 21, 2023 · 7 comments · Fixed by #123
Closed

Reimplement r0, since it is deprecated #122

coastalwhite opened this issue Sep 21, 2023 · 7 comments · Fixed by #123

Comments

@coastalwhite
Copy link
Contributor

This repository should find an alternative to r0, since that crate is now archived and deprecated.

@romancardenas
Copy link
Contributor

Thanks for opening this issue! I'll take a look. Of course, PRs are more than welcome :)

@coastalwhite
Copy link
Contributor Author

I’ll have a look at this. Is there a preference for a separate crate again or should it just become a part of the riscv-rt crate?

@romancardenas
Copy link
Contributor

I prefer to reduce the number of dependencies, but if you find a handy crate that eases the work, then use it.

If I were you, I'd implement it in assembly.

@adamgreig
Copy link
Member

The conclusion when we deprecated r0 was that this can only soundly be implemented in assembly; cortex-m-rt does so here. I think it's best put into your existing startup routine (here).

@romancardenas
Copy link
Contributor

romancardenas commented Sep 22, 2023

I see you feature-gate the RAM initialization. Would you recommend us to do the same for riscv-rt?

@romancardenas
Copy link
Contributor

coastalwhite added a commit to coastalwhite/riscv-rt that referenced this issue Sep 22, 2023
This implements the `r0::init_data` and `r0::zero_bss` routines in
assembly. There is a generic implementation for `riscv32` and
`riscv64`, since `riscv64` deals with alignment problems. The routines
are kept at their old calling site so that only one hardware thread
calls them. Consequently they are also inlined into the `start_rust`
function.

[Issue rust-embedded#122]
@adamgreig
Copy link
Member

I see you feature-gate the RAM initialization. Would you recommend us to do the same for riscv-rt?

That was a later addition from users with MCUs that have things like ECC RAM where you have to write to the entire RAM at startup to initialise the memory controller; usually it's enough to just initialise the .data and .bss sections and leave unused RAM alone. Since there's a startup time cost, it made sense to feature-gate this just for users who need it.

I think you could reasonably support the same feature, but just doing .data and .bss is enough for almost all use cases.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants