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

A way to specify memory properties like flash size #42

Closed
bjoernQ opened this issue Apr 5, 2022 · 5 comments
Closed

A way to specify memory properties like flash size #42

bjoernQ opened this issue Apr 5, 2022 · 5 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@bjoernQ
Copy link
Contributor

bjoernQ commented Apr 5, 2022

It's very convenient that we don't need a memory.x or build.rs in binary crates using the HAL

However, we should be able to set things like flash size if it doesn't match our default.

Ideally not by providing custom linker scripts

@MabezDev
Copy link
Member

Perhaps a somewhat odd but simple strategy, what about setting the flash size to the addressable per chip and then letting the flashing step detect the failures?

E.g for the esp32 the max external flash supported is 16MB, we'd set that in the linker script. If someone tried to flash a 12MB program on a physical module with only 4MB the flashing step will fail.

@jessebraham jessebraham moved this to Todo in esp-rs May 13, 2022
@jessebraham jessebraham added the good first issue Good for newcomers label Oct 28, 2022
@bjoernQ
Copy link
Contributor Author

bjoernQ commented Mar 7, 2023

Maybe flash size was not the best example. What about things like guaranteed allocated stack-size (which are not manageable in a sane way with cargo features)

@bjoernQ
Copy link
Contributor Author

bjoernQ commented May 4, 2023

I tried https://crates.io/crates/toml-cfg and it seems to work great for this use-case. It works in the library code and in build.rs

I guess we could just use it as is, however there are a few things I don't like that much (for our use-case)

  • the sections in the cfg.toml need to match the pkg-name of the library, so users would need to have sections like esp-hal-common and esp32c3-hal etc. - would be better to have something like esp-hal or maybe don't needing a namespace at all
  • would be better to have some other name than cfg.toml for the configuration file (e.g. esp-hal.cfg or esp-hal-cfg.toml)

Maybe we could just pick-up the idea of toml-cfg and have our own macro (in esp-hal-procmacros)

@MabezDev
Copy link
Member

MabezDev commented May 4, 2023

Another option might be to use cargo's built-in [env] section. This might get a bit long if we have a lot of tunables though.

@MabezDev
Copy link
Member

I think this is a duplicate of #1111, so lets continue the discussion there.

@github-project-automation github-project-automation bot moved this from Todo to Done in esp-rs Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
Archived in project
Development

No branches or pull requests

3 participants