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

Examples for creating firmware for multiple targets? #117

Open
saosebastiao opened this issue Dec 18, 2024 · 1 comment
Open

Examples for creating firmware for multiple targets? #117

saosebastiao opened this issue Dec 18, 2024 · 1 comment

Comments

@saosebastiao
Copy link

I realize there are probably hundreds of ways to do the same thing, but it would be nice to have an example of some best practices for writing code that targets different microcontrollers, using different pinouts, etc., perhaps using the embedded_hal feature (if that makes it easier, not sure). For example, I'm currently targeting a G4 microcontroller, but what if I want to create a different board with an additional sensors and firmware features on an H5 microcontroller, what would be the best way to write my code to ensure I can easily port existing functionality in the new target?

@David-OConnor
Copy link
Owner

Hey! This is a great question. Unfortunately, I don't have a good answer. I've only done this for one project, and maybe it can demonstrate a starting point: https://github.com/David-OConnor/corvus

It does something similar to what you are looking for (In this case, it's G4 and H&), but is clumsy: I have a build.rs config that changes out the memory.x based on the compile feature, but I have to manually change config.toml, and more annoyingly, the interrupt names. (Maybe that should be handled with a script). I use feature flags to adjust pins etc as required.

Ultimately, I have the same questions as you!

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