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 support for defmt 0.3 #47

Merged
merged 2 commits into from
Nov 15, 2021
Merged

Add support for defmt 0.3 #47

merged 2 commits into from
Nov 15, 2021

Conversation

newAM
Copy link
Member

@newAM newAM commented Nov 11, 2021

Update defmt (and other knurling-rs tools) to 0.3, see https://ferrous-systems.com/blog/defmt-3/

Copy link

@talhaHavadar talhaHavadar left a comment

Choose a reason for hiding this comment

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

Looks ok to me, but there is a failure in build.

@korken89
Copy link

This is how I'm solving it in heapless to support both 0.2 and 0.3: rust-embedded/heapless#251
Might be of interest.

@newAM
Copy link
Member Author

newAM commented Nov 11, 2021

This is how I'm solving it in heapless to support both 0.2 and 0.3: japaric/heapless#251 Might be of interest.

That's a good idea, I updated it to use a range.

Looks ok to me, but there is a failure in build.

I cannot reproduce the same failure on Linux, and unfortunately I don't have a Windows install easily accessible right now.

Are you able to help me out with this?

@jonas-schievink
Copy link
Contributor

please ping me once CI is fixed

@newAM newAM changed the title Update defmt from 0.2 to 0.3 Add support for defmt 0.3 Nov 11, 2021
@newAM
Copy link
Member Author

newAM commented Nov 11, 2021

Somebody on matrix pointed out the Windows build is not building for an embedded target, which is not supported by defmt: knurling-rs/defmt#463

I fixed the failure by removing that build for Windows 😅.

@jonas-schievink CI is fixed.

@jonas-schievink
Copy link
Contributor

hmm, why did it work with 0.2?

@newAM
Copy link
Member Author

newAM commented Nov 11, 2021

hmm, why did it work with 0.2?

I did a quick scan through the code.

defmt 0.3 introduced some new global symbols for flushing:

https://github.com/knurling-rs/defmt/blob/124a6f6f3abe4e77e885d6fab001872a2da08ee8/defmt/src/lib.rs#L377-L382

These symbols get defined by the global logger:

https://github.com/knurling-rs/defmt/blob/8a6e8eebe40f943d9b0ba8725cd6da033b9c399e/macros/src/lib.rs#L24-L28

https://github.com/knurling-rs/defmt/blob/e240ba99bc0c2258bc8ba2d7e4694e568f19c758/macros/src/attributes/global_logger.rs#L41-L45

I am guessing there is something about Windows that doesn't like GNU linker script or the export_name attributes that were introduced for these new symbols.

@jonas-schievink
Copy link
Contributor

bors r+

@bors
Copy link
Contributor

bors bot commented Nov 15, 2021

Build succeeded:

@bors bors bot merged commit fa66e62 into stm32-rs:master Nov 15, 2021
@newAM
Copy link
Member Author

newAM commented Nov 15, 2021

Thanks for the review & merge!

Would it be possible to get a 0.6.1 release with this change?

@jonas-schievink
Copy link
Contributor

Published 0.6.1

Regarding the linker error, I don't think that's a problem with defmt 0.3.0 specifically, since #49 also fails to link again defmt 0.2.3 (https://github.com/stm32-rs/bxcan/runs/4213689874?check_suite_focus=true)

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