Skip to content

Add semihosting and SWO examples to mbed_override_console(). #1063

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

Merged
merged 2 commits into from
May 24, 2019

Conversation

korjaa
Copy link
Contributor

@korjaa korjaa commented May 10, 2019

@korjaa korjaa requested a review from kjbracey May 10, 2019 07:20
@korjaa
Copy link
Contributor Author

korjaa commented May 10, 2019

@TeroJaasko semihosting example in docs.

@iriark01 iriark01 requested a review from AnotherButler May 10, 2019 07:22
}
```

Then any program using `printf` on that target sends its output over the SWO, rather than serial. It is also possible to redirect the console by using semihosting which enables the console logs to be captured by a debugger:
Copy link
Contributor

Choose a reason for hiding this comment

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

The above example's text was talking about the case where a target is using SerialWireOutput.

Both the new examples are probably/definitely the case where the developer/application is deciding to redirect. (The semihosting would crash without debugger attached, so it's probably only a temporary thing by the developer, and the other one is talking about the target default not being suitable).

So those two should be overriding mbed_override_console, and/or maybe the text should be shuffled a bit. Otherwise you'd have a horrible collision in the case where the target had the SerialWireOutput override above, and you tried to override to semihosting.

In an out-of-the-box Mbed OS, the WEAK target defaults may or may not be already overridden by the target's support code - they're reserved for target code.

The WEAK non-target defaults are always ready to be overridden by application code on any target. Or some libraries may offer an option to do the override for you - eg "esp8266.provide_default".

We could have platform.localfilesystem.provide_default_console or something to provide this example behaviour.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good good, I'll update this.

Copy link
Contributor

Choose a reason for hiding this comment

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

was this updated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not yet.

Copy link
Contributor Author

@korjaa korjaa May 23, 2019

Choose a reason for hiding this comment

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

Now it makes sense to me, I was initially using the wrong mbed_target_override_console() in my main.cpp . I juggled the text around to better support this new understanding.

@kjbracey-arm any comments?

@korjaa
Copy link
Contributor Author

korjaa commented May 23, 2019

Please don't merge this until I rebase the fixup commits. I'll rebase after the changes are approved.
Nvm, decided to rebase already.

@korjaa korjaa force-pushed the semihosting_docs branch from ab5ee49 to c6c3621 Compare May 23, 2019 07:31
Make minor copy edits, mostly for active voice.
@AnotherButler
Copy link
Contributor

Is this relevant to both 5.12 and 5.13?

@korjaa
Copy link
Contributor Author

korjaa commented May 24, 2019

mbed_console_override() was introduced in ARMmbed/mbed-os@f79bfdd (tools-release-5.8.5) so if I'm not mistaken, this is relevant starting from 5.8.5.

@AnotherButler AnotherButler merged commit e0bbf8f into development May 24, 2019
@AnotherButler AnotherButler deleted the semihosting_docs branch May 24, 2019 14:30
AnotherButler pushed a commit that referenced this pull request May 24, 2019
Add semihosting and SWO examples to mbed_override_console() by applying changes from PR #1063
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