Refactor blethrs into a library. Add stm32-eth implementation. Prepare for supporting other stm32f devices.#3
Open
mitchmindtree wants to merge 4 commits intoAirborneEngineering:masterfrom
Conversation
This separates the flash, bootload and command-related items of `blethrs` into a separate `blethrs` library. The original `blethrs` bin target has been renamed to `blethrs-bin` and has been refactored to depend on the new `blethrs` library. A new `blethrs-stm32-eth` bin target has been added that demonstrates using the `stm32-eth` crate for handling the ethernet driver and providing the smoltcp integration. The `UserConfig::write_to_semihosting` method has been removed in favour of a `ufmt::uDisplay` implementation for `UserConfig` that has is now gated behind a `ufmt` feature (disabled by default).
This begins the refactoring required in order to support devices other than the stm32f407. A module for the stm32f107 has been added however the feature is entirely untested and currently does not compile. TODO - Refactor device-specific flash code into stm-specific modules. - Address issue of sharing device-specific constants between blethrs and python script.
This adds a new `blethrs-link` crate. The crate acts as a toolkit that can be used for communicating with a `blethrs` bootloader instance. The crate benefits by sharing declared constants (such as flash addresses, magic values and error types) with the bootloader itself via a new `blethrs-shared` crate. An example `demo` CLI program has been added that behaves like the python script. It should be noted that the example's `configure` command currently only supports hard-coded values and does not allow for specifying configuration parameters via CLI args. The `blethrs-link` CRC checksum generation does not yet match the CRC generation performed by the STM32F407. This could potentially be solved by copying the CRC implementation performed by `crcmod` in `blethrs.py`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Disclaimer: This is quite a large change and potentially a bit too much to comfortably review, however I thought I'd open a PR just in case you were interested. Feel free to ignore or close this, I'm happy to continue development on a fork if you would prefer. However, if you are interested in seeing this work land, please let me know what kinds of changes you would like to see and I'll be happy to address them. Edit: And of course, I'll update the README.
This separates the flash, bootload and command-related items of
blethrsinto a separateblethrslibrary.The original
blethrsbin target has been renamed toblethrs-binandhas been refactored to depend on the new
blethrslibrary.A new
blethrs-stm32-ethbin target has been added that demonstratesusing the
stm32-ethcrate for handling the ethernet driver andproviding the smoltcp integration.
The
UserConfig::write_to_semihostingmethod has been removed in favourof a
ufmt::uDisplayimplementation forUserConfigthat has is nowgated behind a
ufmtfeature (disabled by default).This also begins the refactoring required in order to support devices other
than the stm32f407. A module for the stm32f107 has been added however
the feature is entirely untested and currently does not compile.
Also, I've removed the
Cargo.lockas it appears that the entire workspace shares a single lock file, and I thought it best to remove it to ease development of the lib target. Perhaps it's worth removing the workspace in order to allow for a separateCargo.lockfor each of the bin targets? That said, sharing build artifacts between the three crates is nice for speeding up dev.blethrs-link
This adds a new
blethrs-linkcrate. The crate acts as a toolkit thatcan be used for communicating with a
blethrsbootloader instance.The crate benefits by sharing declared constants (such as flash
addresses, magic values and error types) with the bootloader itself via
a new
blethrs-sharedcrate.An example
demoCLI program has been added that behaves like thepython script. It should be noted that the example's
configurecommandcurrently only supports hard-coded values and does not allow for
specifying configuration parameters via CLI args.
The
blethrs-linkCRC checksum generation does not yet match the CRCgeneration performed by the STM32F407. This could potentially be solved
by copying the CRC implementation performed by
crcmodinblethrs.py.