You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: features/FEATURE_COMMON_PAL/mbed-trace/README.md
+45-15Lines changed: 45 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -43,13 +43,37 @@ The purpose of the library is to provide a light, simple and general tracing sol
43
43
### Prerequisites
44
44
45
45
* Initialize the serial port so that `stdout` works. You can verify that the serial port works using the `printf()` function.
46
-
* if you want to redirect the traces somewhere else, see the [trace API](https://github.com/ARMmbed/mbed-trace/blob/master/mbed-trace/mbed_trace.h#L170).
47
-
* to activate traces, configure yotta with flag: `YOTTA_CFG_MBED_TRACE` set to 1 or true. Setting the flag to 0 or false disables tracing.
48
-
* By default trace uses 1024 bytes buffer for trace lines, but it can be configure by yotta with: `YOTTA_CFG_MBED_TRACE_LINE_LENGTH`. Default length: 1024.
49
-
* To disable ipv6 convertion, set `YOTTA_CFG_MBED_TRACE_FEA_IPV6 = 0` from yotta configurations.
50
-
* If thread safety is needed, configure the wait and release callback functions before initialization so that the protection is in place as soon as the library is initialized. This should usually only be done once in the application's lifetime.
46
+
* if you want to redirect the traces somewhere else, see the [trace API](https://github.com/ARMmbed/mbed-trace/blob/master/mbed-trace/mbed_trace.h#L170).
47
+
* To enable the tracing API:
48
+
* With yotta: set `YOTTA_CFG_MBED_TRACE` to 1 or true. Setting the flag to 0 or false disables tracing.
49
+
*[With mbed OS 5](#enabling-the-tracing-api-in-mbed-os-5)
50
+
* By default, trace uses 1024 bytes buffer for trace lines, but you can change it by yotta with: `YOTTA_CFG_MBED_TRACE_LINE_LENGTH`.
51
+
* To disable the IPv6 conversion, set `YOTTA_CFG_MBED_TRACE_FEA_IPV6 = 0`.
52
+
* If thread safety is needed, configure the wait and release callback functions before initialization to enable the protection. Usually, this needs to be done only once in the application's lifetime.
51
53
* Call the trace initialization (`mbed_trace_init`) once before using any other APIs. It allocates the trace buffer and initializes the internal variables.
52
-
* Define `TRACE_GROUP` in your source code (not in the header!) to use traces. `TRACE_GROUP` is a 1-4 character long char-array (for example `#define TRACE_GROUP "APPL"`). This will be printed on every trace line.
54
+
* Define `TRACE_GROUP` in your source code (not in the header!) to use traces. It is a 1-4 characters long char-array (for example `#define TRACE_GROUP "APPL"`). This will be printed on every trace line.
55
+
56
+
### Enabling the tracing API in mbed OS 5
57
+
58
+
* Add the feature COMMON_PAL into the build
59
+
* Set `MBED_CONF_MBED_TRACE_ENABLE` to 1 or true
60
+
61
+
To do so, add the following to your mbed_app.json:
62
+
63
+
```json
64
+
{
65
+
"target_overrides": {
66
+
"*": {
67
+
"target.features_add": ["COMMON_PAL"],
68
+
"mbed-trace.enable": 1
69
+
}
70
+
}
71
+
}
72
+
```
73
+
74
+
Don't forget to fulfill the other [prerequisites](#prerequisites)!
75
+
76
+
([Click here for more information on the configuration system](https://github.com/ARMmbed/mbed-os/blob/master/docs/config_system.md))
53
77
54
78
### Traces
55
79
@@ -63,31 +87,35 @@ Available levels:
63
87
* info
64
88
* cmdline (special behavior, should not be used)
65
89
66
-
Set mutex wait and release functions, if thread safety is needed. Do this before initialization so the functions are immediately available:
90
+
For the thread safety, set the mutex wait and release functions. You need do this before the initialization to have the functions available right away:
The purpose of the helping functions is to provide simple conversions, for example from an array to C string, so that you can print everything to single trace line.
88
-
These must be called inside actual trace calls, e.g. ```tr_debug("My IP6 address: %s", mbed_trace_ipv6(addr));```.
111
+
The purpose of the helping functions is to provide simple conversions, for example from an array to C string, so that you can print everything to single trace line. They must be called inside the actual trace calls, for example:
0 commit comments