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

Having addresses is bad style #1

Open
mithro opened this issue Sep 25, 2019 · 1 comment
Open

Having addresses is bad style #1

mithro opened this issue Sep 25, 2019 · 1 comment

Comments

@mithro
Copy link
Member

mithro commented Sep 25, 2019

Currently the published reference manual has the address of things like CSR registers displayed everywhere.

This will eventually make everyone sad. It will make your developers sad when the addresses change. It will make the gateware developers sad when they are forced to put in horrible hacks to deal with trying to keep addresses the same. It'll make users sad when they get stuff which doesn't work.

If you don't use dynamic address values you are also going to spend a lot more LUTs on things like address decoding.

It is better to embrace the fact these addresses are dynamic and teach people to not hard code them.

@xobs
Copy link
Member

xobs commented Sep 26, 2019

That's by design.

This is a reference manual for a SoC that's guaranteed to not change. It's firmware, and is designed to be used by end-customers. They get sad when things change, because their software stops working. In fact, we need to document these things more -- including memory regions and their offsets.

Having dynamic addresses is probably fine for a bios file that gets built as part of the firmware, but as soon as you load user-facing code you need things to stop moving around.

For example, I'm working on a crate for Rust to enable the use of Rust in Fomu. This usually accepts an SVD file, which requires address offsets be fixed. If I publish one of these crates to crates.io, then those addresses are fixed and should never be changed.

It's not possible to not hard code them and still be able to work with precompiled files. So it's better to hard code them and document what they are.

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