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

Advanced course - instructions for starting VSCode do not make sense #185

Open
rod-chapman opened this issue Nov 11, 2021 · 10 comments
Open

Comments

@rod-chapman
Copy link

In src/hello-world.md, it says to "open the src/bin/hello.rs file from the advanced/apps folder" but there is no "apps" folder below "advanced"

Should that be "advanced/firmware" instead?

@rod-chapman
Copy link
Author

Secondly, the advanced/firmware/.vscode directory appears to me missing its launch.json file, so (cross) debugging and running on the Nordic target doesn't work at all for me...

I also found I needed to download the Cortex-Debug extension for VSCode, and then tell it to use "gdb-multiarch" as its gdbPath before anything would work...

@rod-chapman
Copy link
Author

With Cortex-Debug, gdb-multiarch, and a self-written launch.json file, it sort-of works now...

Running a program, setting breakpoints and single-stepping all seems to work OK.

But... display of variable values does not work. (If I hover the mouse pointer over the name of a variable, then I get a little empty, blank box...) Also, the output from the various "log::info!()" macros seems to go no-where... at least no-where that I can see in any of the VSCode windows.

Have I done something wrong?

@rod-chapman
Copy link
Author

For what it's worth, I am running VSCode 1.62.3 on Ubuntu 21.10, which is itself running in a Parallels VM on top of MacOS.

@jonas-schievink
Copy link
Contributor

In src/hello-world.md, it says to "open the src/bin/hello.rs file from the advanced/apps folder" but there is no "apps" folder below "advanced"

Ah, yeah, that's somewhat confusing. The second part of the sentence shouldn't be needed as the right directory is already opened though, so I've removed it in #186.

But... display of variable values does not work.

That is because all firmware binaries are compiled with debug = 1 in Cargo.toml, which generates line info and some other debug information, but no type information and information about local variables. You can change it to debug = 2 to hopefully fix it.

@rod-chapman
Copy link
Author

Got it... debug=2 seems to do the trick for watching local variables. Perhaps that level should be the default for the course material?

@rod-chapman
Copy link
Author

So... what's going on with the "log::info!()" output?

@rod-chapman
Copy link
Author

I tried again using "defmt::log!()" and same result - no sign of the output in any of the VSCode windows...

@jonas-schievink
Copy link
Contributor

Logging uses RTT, and the configured Cargo runner, probe-run, should print these messages to stdout. I know that OpenOCD also supports RTT, so you might be able to configure that if you use it.

@rod-chapman
Copy link
Author

Ah... so "cargo run" (on the command-line) invokes "probe-run", but VSCode uses the Cortex-Debug extension, which uses openocd, right? If that's right, then I will look at the openocd manual to see if I can get it to listen for RTT.

@rod-chapman
Copy link
Author

Some discussion here: Marus/cortex-debug#456
Looks like it should work, but some magic is required in the launch.json file...

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

No branches or pull requests

2 participants