Skip to content

Refactor blethrs into a library. Add stm32-eth implementation. Prepare for supporting other stm32f devices. #3

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mitchmindtree
Copy link

@mitchmindtree mitchmindtree commented Jul 30, 2020

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
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 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.lock as 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 separate Cargo.lock for 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-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 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`.
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.

1 participant