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

Allow printing defmt output to the RTT console #880

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xoviat
Copy link

@xoviat xoviat commented May 17, 2023

defmt is widely used as a logger in the rust embedded ecosystem. This allows seamlessly debugging a rust program while printing defmt output at the same time.

@xoviat
Copy link
Author

xoviat commented May 17, 2023

Oh, and defmt-print must be installed for this to work. Maybe add a tooltip for that?

@xoviat xoviat marked this pull request as ready for review May 17, 2023 21:17
@xoviat
Copy link
Author

xoviat commented May 25, 2023

@haneefdm Do you have questions about this?

@haneefdm
Copy link
Collaborator

haneefdm commented Sep 1, 2023

Thank you for the PR and I agree it will be very useful for Rust developers Before I look at it, I have a request. I need an example project available on github for me to begin looking at it.

It will be my test case as well. Your github example project should be ready to run with minimal effort on my part (preferably on a Mac). I cannot accept what I cannot test. I am not Rust-educated either.

I you can also update the source code to add a reference to the example github then that would be nice.

Sorry, it took me a long time to get to it. Personal health reasons.

super(tcpPort, channel);

this.cwd = wsPath;
this.executable = Path.relative(wsPath, executable);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why?

Copy link

Choose a reason for hiding this comment

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

@haneefdm I checked the source of defmt and probe-rs. This is because by default, defmt's message is compressed. The detailed info is stored in .elf file, that's why the executable is needed: without .elf, the message cannot be parsed.

See https://github.com/knurling-rs/defmt/blob/main/decoder/src/lib.rs#L157 . The Table is what's stored in .elf file

@haneefdm
Copy link
Collaborator

haneefdm commented Sep 1, 2023

I lied. I did a cursory review. I don't know what is going on with the executable in the RTTConfigureEvent.

And, then in the constructor of the DefmtSocketRTTSource, you are trying to re-resolve the executable. How can we be assured that the debugger and the RTT decoder is looking at the same executable? Do you need help from the debugger?

Also, I think that the executable property in launch.json is optional if you have the symbolFiles property.

@xoviat
Copy link
Author

xoviat commented Sep 3, 2023

I'll get back to this in a few days. I need to refresh my memory after taking care of some other stuff.

@HaoboGu
Copy link

HaoboGu commented Jan 23, 2024

Any updates? I got the same problem, cortex-debug cannot print defmt's RTT log

@hazer-hazer
Copy link

Installed extension from this PR, everything works perfectly, except vscode does not hint to set defmt as type option in rttConfig.decoders.
@Marus Any chance to see this changes in master? 💌

@haneefdm
Copy link
Collaborator

haneefdm commented Jul 6, 2024

@xoviat I am still waiting for the PRs original author.

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.

None yet

4 participants