-
Notifications
You must be signed in to change notification settings - Fork 2
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 support for parsing flash and ram sizes #5
Conversation
Done # Features based on Flash size (in kbytes)
flash-8 = []
flash-16 = []
flash-32 = []
flash-64 = []
flash-128 = []
flash-192 = []
# Features based on RAM size (in kbytes)
ram-2 = []
ram-8 = []
ram-20 = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @azerupi, this looks great!
Can you run cargo fmt
to make CI happy?
Oh, something else I noticed: You're taking the flash/ram sizes as Instead, maybe you could parse the numbers before even inserting them into the hashmap? This way, a regular |
Everything should be addressed. I ran rustfmt but due to the GitHub first contribution restrictions I can't see if CI passes, but I would assume it does. |
@dbrgn ping 🙂 |
@azerupi sorry, I wanted to review/merge tonight, but didn't find the time (and I'm not at home over the weekend). I'll try to do it next week. Feel free to ping me, in case I forget (I mostly use notification e-mails as reminders). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @azerupi, and sorry for the long delay in reviewing!
No problem at all, thanks! 🙂 |
This PR should solve part of the problem for stm32-rs/stm32l0xx-hal#170
When generating the MCU features I get the output below for the two MCUs I gave as an example. Which seems to be correct.
About the implementation, I tried to make as little change as possible. I'm not sure the tuple in the hasmap is the cleanest way to do it. A better idea would probably be to merge the two
Mcu
structs. Let me know if you have a better idea for the implementation.For the flash and ram features it generates the following:
I think it is quite manageable to handle this manually in the build.rs. But if needed we could generate the if/else wall automatically here too, would that be desired?
I just noticed flash and ram features are sorted alphabetically instead of numerically. I'm going to correct that before you merge this.