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

How to use with SWD / SWO / semihosting? #67

Closed
amq opened this issue Apr 14, 2017 · 4 comments
Closed

How to use with SWD / SWO / semihosting? #67

amq opened this issue Apr 14, 2017 · 4 comments

Comments

@amq
Copy link

amq commented Apr 14, 2017

See also ARMmbed/mbed-drivers#188

@ciarmcom
Copy link

ARM Internal Ref: IOTSYST-2179

@jupe
Copy link
Contributor

jupe commented Apr 24, 2017

Here is examples how to set up SWO traces:
https://developer.mbed.org/users/wim/code/SWO/docs/e5af2e131b95/SWO_8cpp_source.html

So all what you have to do is just redirect mbed-traces to use something like SWO_PrintString() -function using mbed_trace_print_function_set() -API.

related to: ARMmbed/DAPLink#259

Is this what you are looking for?

@zxfeei
Copy link

zxfeei commented May 1, 2017

@jupe Thanks for your help. I want to kown DAPlink how to support SWO trace ,but not ST-LINK and Segger J-Link.

@amq
Copy link
Author

amq commented May 8, 2017

@jupe, thanks!

For those who are looking for a full example:

#if MBED_CONF_MBED_TRACE_ENABLE
#include "mbed-trace/mbed_trace.h"
#include "swo.h"
// #include "swo-platform/swo-platform.h" // for efm32

#define TRACE_GROUP "main"

void trace_printer(const char* str) {
    swoprintf("%s\n", str);
}
#endif

int main() {
    mbed_trace_init();
    mbed_trace_print_function_set(trace_printer);

    float x = 1.2;
    tr_debug("Result:");
    tr_debug("%f", x * x);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants