mirror of https://github.com/ARMmbed/mbed-os.git
Squashed 'features/FEATURE_COMMON_PAL/mbed-trace/' changes from af5f59c..b731d95
b731d95 Clarify mutex type requirement (#77) 7c31aef bumb version number (#72) 75982fc fix dummydefine for mbed_trace_init (#71) 539b80c Update version number. (#69) b0e09f9 output/ added to gitignore list (#66) a5cce88 Added include_directories(${CMAKE_CURRENT_SOURCE_DIR}/) include to resolve compilation error for Linux. (#63) d087dbb Ensure tr_array doesn't print <null> when len == 0 (#65) git-subtree-dir: features/FEATURE_COMMON_PAL/mbed-trace git-subtree-split: b731d954d111d92199b2a0402dc9a3d52f5d4a17pull/4960/head
parent
c8a16cc274
commit
33b0820afc
|
@ -36,3 +36,7 @@ build/
|
|||
test_coverage/
|
||||
**/*.info
|
||||
**/*~
|
||||
output/*
|
||||
|
||||
# Yotta files
|
||||
.yotta.json
|
||||
|
|
|
@ -7,6 +7,7 @@ project(mbedTrace)
|
|||
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/mbed-trace/)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../nanostack-libservice/mbed-client-libservice/)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../nanostack-libservice/)
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ The purpose of the library is to provide a light, simple and general tracing sol
|
|||
* With yotta: set `YOTTA_CFG_MBED_TRACE_FEA_IPV6 = 0`.
|
||||
* With mbed OS 5: set `MBED_CONF_MBED_TRACE_FEA_IPV6 = 0`.
|
||||
* 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.
|
||||
* If [helping functions](#helping-functions) are used the mutex must be **recursive** (counting) so it can be acquired from a single thread repeatedly.
|
||||
* Call the trace initialization (`mbed_trace_init`) once before using any other APIs. It allocates the trace buffer and initializes the internal variables.
|
||||
* 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.
|
||||
|
||||
|
|
|
@ -408,7 +408,7 @@ char* mbed_trace_array(const uint8_t* buf, uint16_t len);
|
|||
#elif !defined(MBED_TRACE_DUMMIES_DEFINED)
|
||||
// define dummies, hiding the real functions
|
||||
#define MBED_TRACE_DUMMIES_DEFINED
|
||||
#define mbed_trace_init(...) ((void) 0)
|
||||
#define mbed_trace_init(...) ((int) 0)
|
||||
#define mbed_trace_free(...) ((void) 0)
|
||||
#define mbed_trace_buffer_sizes(...) ((void) 0)
|
||||
#define mbed_trace_config_set(...) ((void) 0)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "mbed-trace",
|
||||
"version": "1.2.1",
|
||||
"version": "1.3.0",
|
||||
"description": "Trace library for mbed devices",
|
||||
"keywords": [
|
||||
"trace",
|
||||
|
|
|
@ -558,7 +558,7 @@ char *mbed_trace_array(const uint8_t *buf, uint16_t len)
|
|||
int i, bLeft = tmp_data_left();
|
||||
char *str, *wptr;
|
||||
str = m_trace.tmp_data_ptr;
|
||||
if (str == NULL || bLeft == 0) {
|
||||
if (len == 0 || str == NULL || bLeft == 0) {
|
||||
return "";
|
||||
}
|
||||
if (buf == NULL) {
|
||||
|
|
|
@ -91,6 +91,19 @@ TEST(trace, Array)
|
|||
mbed_tracef(TRACE_LEVEL_DEBUG, "mygr", "%s", mbed_trace_array(longStr, 200) );
|
||||
}
|
||||
|
||||
TEST(trace, Null0Array)
|
||||
{
|
||||
static const unsigned char array[2] = { 0x23, 0x45 };
|
||||
mbed_tracef(TRACE_LEVEL_DEBUG, "mygr", "%s", mbed_trace_array(array, 2));
|
||||
STRCMP_EQUAL("23:45", buf);
|
||||
mbed_tracef(TRACE_LEVEL_DEBUG, "mygr", "%s", mbed_trace_array(array, 0));
|
||||
STRCMP_EQUAL("", buf);
|
||||
mbed_tracef(TRACE_LEVEL_DEBUG, "mygr", "%s", mbed_trace_array(NULL, 0));
|
||||
STRCMP_EQUAL("", buf);
|
||||
mbed_tracef(TRACE_LEVEL_DEBUG, "mygr", "%s", mbed_trace_array(NULL, 2));
|
||||
STRCMP_EQUAL("<null>", buf);
|
||||
}
|
||||
|
||||
TEST(trace, LongString)
|
||||
{
|
||||
char longStr[1000] = {0x36};
|
||||
|
|
Loading…
Reference in New Issue