Skip to content

Conversation

@duskmoon314
Copy link
Contributor

Intro

We can use svdtools convert <input.svd> <output.svd> --format-config <format_config.yaml/json> to format an SVD file now.

For example, we have .svdfmt.yaml with the below lines:

peripheral_name: Constant
peripheral_base_address: UpperHex16

The output SVD file will have peripheral names in CONSTANT_CASE and addresses like 0x00ABCDEF or 0x0123456789ABCDEF.

The available config is in svd-encoder

Only support SVD output via svd-encoder for now.

@burrbull
Copy link
Member

Thought about it just now. It should be cool also be able to change BitRange format.

@burrbull
Copy link
Member

Could you fix clippy warnings?

@duskmoon314
Copy link
Contributor Author

Thought about it just now. It should be cool also be able to change BitRange format.

This can be done by setting svd_encoder::Config's field_bit_range. For example, field_bit_range: MsbLsb in the config file will lead us to <lsb>a</lsb><msb>b</msb>.

Could you fix clippy warnings?

There are two warnings. One is an unused lifetime, we can just remove it. The other one is too-many-arguments caused by my adding format_config to function convert_cli::convert. Maybe an appropriate way is to combine multiple arguments together in a new struct.

@duskmoon314
Copy link
Contributor Author

I separate three bool arguments to ParserConfig to fix that clippy warning.

Also, change several lines according to clippy.

Copy link
Member

@adamgreig adamgreig left a comment

Choose a reason for hiding this comment

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

thanks, looks good!

bors r+

@bors
Copy link
Contributor

bors bot commented Jul 20, 2022

@bors bors bot merged commit b14cf64 into rust-embedded:master Jul 20, 2022
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.

3 participants