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

Cannot find linker script memory.x #19

Closed
albertskog opened this issue Nov 5, 2020 · 2 comments
Closed

Cannot find linker script memory.x #19

albertskog opened this issue Nov 5, 2020 · 2 comments

Comments

@albertskog
Copy link
Contributor

albertskog commented Nov 5, 2020

Hi! I'm trying out this template on a Bluepill board with STM32F103C8 and stm32f1xx-hal. After following the setup steps (and working around #18) I get a linker error about missing memory.x when running cargo rb hello.

Copying memory.x from the HAL's repository into the root of the project as suggested by their readme solves the problem.
https://github.com/stm32-rs/stm32f1xx-hal/blob/master/memory.x

Is this expected to be part of step 5 ("5. Import your HAL")? I could make a PR on the readme but I'm not sure if this works differently for other HAL's?

@japaric
Copy link
Member

japaric commented Nov 9, 2020

Some HAL crates provide a memory.x file (the nrf HALs do) but some don't. I think most HAL crates don't consistently document whether they provide a memory.x or not (the nrf HALs don't document that they provide a memory.x; the stm32f1xx-hal does document that a memory.x file is required).

In terms of this template documentation, we should mention that when using a HAL additional steps maybe required, like writing a memory.x file, and that the HAL documentation should be checked. We could also write a troubleshooting section and mention that "memory.x not found" is a common error and how to fix it (write a memory.x file).

Semi-orthogonal to this, it may be possible to generate the memory.x file using probe-rs and the --chip information passed to probe-run. Whether that functionality should be in probe-run or a different tool (an embedded version of cargo-generate?) I do not know.

@albertskog
Copy link
Contributor Author

albertskog commented Nov 9, 2020

👍 I made a PR on the readme ⬆️

Regarding alternative methods - assuming a HAL has a memory.x, maybe it would be possible to use it "in place", without copying it into the project? I was thinking similar to how Cargo looks in several places for config.toml (https://doc.rust-lang.org/cargo/reference/config.html)

Edit: there is an open issue about ways to handle this in Cargo: rust-lang/cargo#7984

japaric added a commit that referenced this issue Nov 10, 2020
Fix #19 - add step for memory.x
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

No branches or pull requests

2 participants