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

Add optional rzCOBS encoding+framing #539

Merged
merged 3 commits into from
Jul 20, 2021
Merged

Add optional rzCOBS encoding+framing #539

merged 3 commits into from
Jul 20, 2021

Conversation

Dirbaio
Copy link
Contributor

@Dirbaio Dirbaio commented Jul 17, 2021

Part of #492

Encoding is chosen with the encoding-raw, encoding-rzcobs features. If no encoding is chosen, rzcobs is used.

The used encoding is stored in the ELF symbol table, and the decoder automatically picks the correct version.

@Dirbaio Dirbaio marked this pull request as ready for review July 18, 2021 04:59
@Dirbaio Dirbaio changed the title WIP: Add optional rzCOBS encoding+framing Add optional rzCOBS encoding+framing Jul 18, 2021
Copy link
Member

@japaric japaric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left some inline comments / questions. does probe-run need changes after this has landed? IOW, will landing this break (e.g. not compile / fail to decode) probe-run even if it uses the right decoder version?

EDIT: would sticking to the "raw" encoder / decoder for a bit not immediately break probe-run?

decoder/src/elf2table/mod.rs Show resolved Hide resolved
decoder/src/stream/rzcobs.rs Show resolved Hide resolved
src/encoding/rzcobs.rs Show resolved Hide resolved
firmware/defmt-rtt/src/lib.rs Show resolved Hide resolved
@Dirbaio
Copy link
Contributor Author

Dirbaio commented Jul 19, 2021

will landing this break (e.g. not compile / fail to decode) probe-run even if it uses the right decoder version?

I think it'll still build because I've left Table::decode as-is. Since the default is rzcobs, it will fail to decode, though. It should switch to the StreamDecoder API.

EDIT: would sticking to the "raw" encoder / decoder for a bit not immediately break probe-run?

Yes, raw is identical to the previous behavior, just concatenating all frames with no framing. But since it'll need a release anyway to update to the new defmt-decoder (wire format has breaking changes) it might as well be updated to StreamDecoder from day 1, the required changes are tiny.

@japaric
Copy link
Member

japaric commented Jul 20, 2021

Yes, this is from the rzcobs crate. For encoding it's not quite right, for decoding we could use it as-is. I thought it was strange to have an in-tree impl for encoding and a crate for decoding, but can change it if you think it's better to use external crates.

In that case, it seems fine to "vendor" that code. This looks good to me.

bors r+

@bors
Copy link
Contributor

bors bot commented Jul 20, 2021

Build succeeded:

@bors bors bot merged commit 1a3ab60 into knurling-rs:main Jul 20, 2021
bors bot added a commit that referenced this pull request Jul 27, 2021
540: Separate "crate version" from "wire format version"  r=jonas-schievink a=Dirbaio

Depends on #539. Fixes #287.

This decouples the "wire format version" from the crate version (Cargo package version or git commit). Wire format version can now be bumped independently. This alleviates pains listed in #539., and more importantly it will allow making breaking changes to the wire format in a semver-minor `defmt` crate release. See #426.

Version is `3` to be able to retroactively number `0.1.x = 1, 0.2.x = 2`. A followup PR will add support to `defmt-decoder` to decode both version 2 and 3 concurrently.


Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
@Urhengulas
Copy link
Member

@Dirbaio Can you please fill the empty doc-comments on the methods of the encoder?

#539 (comment)

@Dirbaio
Copy link
Contributor Author

Dirbaio commented Sep 5, 2021

Added missing docs in #568

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.

4 participants