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

Make flash and ram size depend on the mcu feature #173

Merged
merged 3 commits into from
Jun 25, 2021

Conversation

azerupi
Copy link
Contributor

@azerupi azerupi commented Jun 10, 2021

This fixes #170 by adding features for flash and RAM sizes and enabling the appropriate one for each mcu feature. It uses the new output from dbrgn/cube-parse#5

I'm not sure why I have more MCUs in the list, maybe a more recent version of CubeMX?
I tested it out locally, it seems to work.

Also I think this is a breaking change. Because it might break code that does not select a mcu-* feature but selects the other features manually. In that case no memory.x file will be loaded and the build will fail.

Copy link
Contributor

@hannobraun hannobraun left a comment

Choose a reason for hiding this comment

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

Looks good to me, although I didn't test or check against data sheets. I'd like to hear @dbrgn's opinion, as he's the resident CubeMX expert.

@hannobraun hannobraun requested a review from dbrgn June 11, 2021 11:20
@azerupi
Copy link
Contributor Author

azerupi commented Jun 11, 2021

No problem, it's better to take the time to review and test this 🙂

I just realized I didn't remove the memory_l0x*.x files, so I'll do that before it gets merged.

On an unrelated note, I was wondering what config you guys where using for rust-analyzer? I've added the following .vscode/settings.json file, but I'm wondering if you have more elaborate configurations that work better?

{
    "rust-analyzer.cargo.features": ["mcu-STM32L071K8Ux"],
}

@dbrgn
Copy link
Contributor

dbrgn commented Jun 12, 2021

Looks good to me, although I didn't test or check against data sheets. I'd like to hear @dbrgn's opinion, as he's the resident CubeMX expert.

🙂 I'll take a look as soon as I can.

@hannobraun
Copy link
Contributor

On an unrelated note, I was wondering what config you guys where using for rust-analyzer? I've added the following .vscode/settings.json file, but I'm wondering if you have more elaborate configurations that work better?

It's actually been a while since I actively worked on this repository, and I don't have an active checkout. I do have "rust-analyzer.checkOnSave.allTargets": false, in addition to the cargo.features, in the configuration for another HAL. But I don't remember why I needed that.

azerupi added a commit to azerupi/stm32l0xx-hal that referenced this pull request Jun 14, 2021
@dbrgn
Copy link
Contributor

dbrgn commented Jun 23, 2021

I'm not sure why I have more MCUs in the list, maybe a more recent version of CubeMX?

I think so, yes! I updated the list with the old version of cube-parse in #178. Can you rebase against the current master branch and resolve the conflicts by simply overwriting the conflicting part with the generated features? That way, only the new ram-* and flash-* feature changes should remain.

In case you're unsure how to do this with git, don't hesitate to ask, I'm happy to help!

Copy link
Contributor

@dbrgn dbrgn left a comment

Choose a reason for hiding this comment

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

Two small suggestions for the README, otherwise this looks good to me! Thanks for implementing this change, I think it will be very useful to get started quickly.

README.md Show resolved Hide resolved
README.md Show resolved Hide resolved
build.rs Show resolved Hide resolved
This fixes stm32-rs#170 by adding features for flash and RAM sizes and adding
enabling the appropriate one for each mcu feature.
@azerupi
Copy link
Contributor Author

azerupi commented Jun 24, 2021

Sorry for the noise, I think I forgot to add a file when rebasing. It should be good now.

Copy link
Contributor

@dbrgn dbrgn left a comment

Choose a reason for hiding this comment

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

Thanks! An intermediate commit adds git conflict markers (which are then removed again in the next commit), but we can solve that quite easily by squashing 🙂

@dbrgn dbrgn merged commit 8144e8d into stm32-rs:master Jun 25, 2021
dbrgn pushed a commit that referenced this pull request Jun 25, 2021
jamwaffles pushed a commit to jamwaffles/stm32l0xx-hal that referenced this pull request Jul 26, 2021
This fixes stm32-rs#170 by adding features for flash and RAM sizes and
enabling the appropriate one for each MCU feature.

The memory.x files are removed because they're now generated from the build.rs.

This commit also includes a clippy fix.
jamwaffles pushed a commit to jamwaffles/stm32l0xx-hal that referenced this pull request Jul 26, 2021
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.

stm32l051k8u6 has 64kb of flash but is configured with 16kb
3 participants