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

Add base-address-shift configuration flag #791

Merged
merged 1 commit into from
Jan 10, 2024

Conversation

gephaistos
Copy link
Contributor

Hello!
We are working with the FPGA-based project and unlike with micro-controllers all peripherals are dynamic.
In order to swap different devices (described within several SVD files) in a single board we need to be able to move their addresses.
That's why in this PR we added a flag to shift all base addresses provided in SVD.

@gephaistos gephaistos requested a review from a team as a code owner December 25, 2023 14:39
burrbull
burrbull previously approved these changes Dec 25, 2023
@burrbull
Copy link
Member

Would not it better to generate some global constant and use it calculating PTR?

@Emilgardis
Copy link
Member

I don't see the reasoning for this, why is the base address in the svd not shifted already?

@gephaistos
Copy link
Contributor Author

The address might depend on other cores.
For example, if we want to add our core to these cores the base address should have one value and in the other case it would require another value.
It would be more convenient to be able to change base address value dynamically instead of changing this value in SVD file each time.

@burrbull
Copy link
Member

It would be more convenient to be able to change base address value dynamically instead of changing this value in SVD file each time.

What do you mean under "dynamically" in rust terms?
Is it const BASE_ADDRESS or static mut BASE_ADDRESS. In second case it can lead to significant downgrade in code optimization.

@gephaistos
Copy link
Contributor Author

I meant to dynamically shift it from SVD file during generation, not on the Rust side. The PR does exactly this functionality.

@thejpster
Copy link
Contributor

It seems like a niche use-case, but the PR is low-overhead and most people can just ignore the configuration option. Perhaps the help text should be something like:

This offset will be added to all base addresses on all peripherals in the SVD file. Useful for soft-cores where the peripheral address range isn't necessarily fixed. Ignore this option if you are not building your own FPGA based soft-cores.

src/main.rs Outdated Show resolved Hide resolved
burrbull
burrbull previously approved these changes Jan 8, 2024
Emilgardis
Emilgardis previously approved these changes Jan 8, 2024
@burrbull
Copy link
Member

burrbull commented Jan 8, 2024

need rebase

@gephaistos gephaistos dismissed stale reviews from Emilgardis and burrbull via 651da2d January 10, 2024 09:50
@gephaistos gephaistos force-pushed the new-config-flag branch 3 times, most recently from 44e8768 to 30117e9 Compare January 10, 2024 09:54
@burrbull burrbull enabled auto-merge January 10, 2024 12:12
@burrbull burrbull added this pull request to the merge queue Jan 10, 2024
Merged via the queue into rust-embedded:master with commit 869d34f Jan 10, 2024
46 checks passed
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

Successfully merging this pull request may close these issues.

4 participants