Skip to content

Commit 71a769a

Browse files
author
Hasnain Virk
committed
Removing COMMON_PAL check for trace
As of 5.9, mbed trace is always present. We need now to check if the tracing was enabled in the app config. If not, setup_trace() does nothing.
1 parent 49d6ab1 commit 71a769a

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

trace_helper.cpp

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -20,53 +20,53 @@
2020
* stack. The library could be made unavailable by removing FEATURE_COMMON_PAL
2121
* from the mbed_app.json to save RAM.
2222
*/
23-
#if defined(FEATURE_COMMON_PAL)
2423

25-
#include "platform/PlatformMutex.h"
26-
#include "mbed_trace.h"
24+
#include "mbed_trace.h"
2725

28-
/**
29-
* Local mutex object for synchronization
30-
*/
31-
static PlatformMutex mutex;
26+
#ifdef FEA_TRACE_SUPPORT
27+
#include "platform/PlatformMutex.h"
3228

33-
static void serial_lock();
34-
static void serial_unlock();
29+
/**
30+
* Local mutex object for synchronization
31+
*/
32+
static PlatformMutex mutex;
3533

36-
/**
37-
* Sets up trace for the application
38-
* Wouldn't do anything if the FEATURE_COMMON_PAL is not added
39-
* or if the trace is disabled using mbed_app.json
40-
*/
41-
void setup_trace()
42-
{
43-
// setting up Mbed trace.
44-
mbed_trace_mutex_wait_function_set(serial_lock);
45-
mbed_trace_mutex_release_function_set(serial_unlock);
46-
mbed_trace_init();
47-
}
34+
static void serial_lock();
35+
static void serial_unlock();
4836

49-
/**
50-
* Lock provided for serial printing used by trace library
51-
*/
52-
static void serial_lock()
53-
{
54-
mutex.lock();
55-
}
37+
/**
38+
* Sets up trace for the application
39+
* Wouldn't do anything if the FEATURE_COMMON_PAL is not added
40+
* or if the trace is disabled using mbed_app.json
41+
*/
42+
void setup_trace()
43+
{
44+
// setting up Mbed trace.
45+
mbed_trace_mutex_wait_function_set(serial_lock);
46+
mbed_trace_mutex_release_function_set(serial_unlock);
47+
mbed_trace_init();
48+
}
5649

57-
/**
58-
* Releasing lock provided for serial printing used by trace library
59-
*/
60-
static void serial_unlock()
61-
{
62-
mutex.unlock();
63-
}
50+
/**
51+
* Lock provided for serial printing used by trace library
52+
*/
53+
static void serial_lock()
54+
{
55+
mutex.lock();
56+
}
6457

58+
/**
59+
* Releasing lock provided for serial printing used by trace library
60+
*/
61+
static void serial_unlock()
62+
{
63+
mutex.unlock();
64+
}
6565
#else
66+
void setup_trace()
67+
{
6668

67-
void setup_trace()
68-
{
69-
}
70-
69+
}
7170
#endif
7271

72+

0 commit comments

Comments
 (0)