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

Nanostack release for Mbed OS 5.11 #8647

Merged
merged 22 commits into from
Nov 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
66620a2
Merge commit '0ca91df5905111270a6ec1343be5c726c97fe571' into mbedos511
Nov 5, 2018
0ca91df
Squashed 'features/frameworks/nanostack-libservice/' changes from 5eb…
Nov 5, 2018
7fab5ab
Squashed 'features/frameworks/mbed-trace/' changes from 6df2572..9eaf0d1
Nov 5, 2018
d7e2bd3
Merge commit '7fab5abace6aa9d6fc6c335fa6fcab15a108d646' into mbedos511
Nov 5, 2018
3c37456
Merge commit '6a6dc452aa482a87421de660b3c57590cd43d6fa' into mbedos511
Nov 5, 2018
6a6dc45
Squashed 'features/nanostack/coap-service/' changes from cbe656a..bc3…
Nov 5, 2018
ef39a19
Merge commit '6dd01c679db4deb0a4a2c55832f3abe7b19bc51b' into mbedos511
Nov 5, 2018
6dd01c6
Squashed 'features/nanostack/sal-stack-nanostack/' changes from 2535a…
Nov 5, 2018
2457efc
Remove sal-stack-nanostack-eventloop
Nov 9, 2018
623607c
Squashed 'features/nanostack/sal-stack-nanostack-eventloop/' content …
Nov 9, 2018
9e661a9
Merge commit '623607c9da4ccd5cc1d3d75ff185b3f8d29a473b' as 'features/…
Nov 9, 2018
72fc5fa
Remove mbed-client-randlib
Nov 9, 2018
5d162a0
Squashed 'features/frameworks/mbed-client-randlib/' content from comm…
Nov 9, 2018
ce2ecd5
Merge commit '5d162a08ffd383c97b49e35f3065fcd4638ac87c' as 'features/…
Nov 9, 2018
1374a5e
Squashed 'features/frameworks/mbed-trace/' changes from 9eaf0d1..7a1bd34
Nov 9, 2018
9a13e9d
Merge commit '1374a5e5e6775dd6db9533075f25b3112c984b22' into mbedos511
Nov 9, 2018
e6a851f
Squashed 'features/nanostack/coap-service/' changes from bc331ca..c45…
Nov 9, 2018
e1ef0e4
Merge commit 'e6a851f0a7310462f5f65e9f7955f9fdc71b84f0' into mbedos511
Nov 9, 2018
661681f
Squashed 'features/frameworks/nanostack-libservice/' changes from bb5…
Nov 10, 2018
923ce13
Merge commit '661681f65c3fb61aec2e4605bef0fc075cc8cb0d' into mbedos511
Nov 10, 2018
7781856
Squashed 'features/nanostack/sal-stack-nanostack/' changes from ccd30…
Nov 10, 2018
d879422
Merge commit '77818568c6d9389ef1eb82e40ebfbbf26626c9d3' into mbedos511
Nov 10, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions features/frameworks/mbed-client-randlib/.yotta_ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test/*
8 changes: 4 additions & 4 deletions features/frameworks/mbed-client-randlib/source/randLIB.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void randLIB_seed_random(void)

/* Spell out expressions so we get known ordering of 4 seed calls */
uint64_t s = (uint64_t) arm_random_seed_get() << 32;
state[0] ^= ( s | arm_random_seed_get());
state[0] ^= (s | arm_random_seed_get());

s = (uint64_t) arm_random_seed_get() << 32;
state[1] ^= s | arm_random_seed_get();
Expand Down Expand Up @@ -129,19 +129,19 @@ void randLIB_add_seed(uint64_t seed)
uint8_t randLIB_get_8bit(void)
{
uint64_t r = randLIB_get_64bit();
return (uint8_t) (r >> 56);
return (uint8_t)(r >> 56);
}

uint16_t randLIB_get_16bit(void)
{
uint64_t r = randLIB_get_64bit();
return (uint16_t) (r >> 48);
return (uint16_t)(r >> 48);
}

uint32_t randLIB_get_32bit(void)
{
uint64_t r = randLIB_get_64bit();
return (uint32_t) (r >> 32);
return (uint32_t)(r >> 32);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ INCLUDE_DIRS =\
../../../..\
../../../../source\
../../../../mbed-client-randlib\
../../../../../../../libService/libService\
/usr/include\
$(CPPUTEST_HOME)/include\

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "CppUTest/TestPlugin.h"
#include "CppUTest/TestRegistry.h"
#include "CppUTestExt/MockSupportPlugin.h"
int main(int ac, char** av)
int main(int ac, char **av)
{
return CommandLineTestRunner::RunAllTests(ac, av);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@

TEST_GROUP(randLIB)
{
void setup()
{
void setup() {
}

void teardown()
{
void teardown() {
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ bool test_randLIB_get_8bit()
randLIB_reset();
randLIB_seed_random();
uint8_t test = randLIB_get_8bit();
if( test == 0 ) {
if (test == 0) {
test = randLIB_get_8bit();
if( test == 0 ) {
if (test == 0) {
return false;
}
}
Expand All @@ -32,9 +32,9 @@ bool test_randLIB_get_16bit()
randLIB_reset();
randLIB_seed_random();
uint16_t test = randLIB_get_16bit();
if( test == 0 ) {
if (test == 0) {
test = randLIB_get_16bit();
if( test == 0 ) {
if (test == 0) {
return false;
}
}
Expand All @@ -46,9 +46,9 @@ bool test_randLIB_get_32bit()
randLIB_reset();
randLIB_seed_random();
uint32_t test = randLIB_get_32bit();
if( test == 0 ) {
if (test == 0) {
test = randLIB_get_32bit();
if( test == 0 ) {
if (test == 0) {
return false;
}
}
Expand Down Expand Up @@ -145,7 +145,7 @@ bool test_randLIB_get_n_bytes_random()

uint8_t dat[5];
void *ret = randLIB_get_n_bytes_random(dat, 5);
if(ret != dat){
if (ret != dat) {
return false;
}

Expand All @@ -164,12 +164,12 @@ bool test_randLIB_get_random_in_range()
randLIB_seed_random();

uint16_t ret = randLIB_get_random_in_range(2, 2);
if( ret != 2 ){
if (ret != 2) {
return false;
}

ret = randLIB_get_random_in_range(2, 3);
if( ret != 2 && ret != 3){
if (ret != 2 && ret != 3) {
return false;
}

Expand All @@ -183,12 +183,12 @@ bool test_randLIB_randomise_base()
randLIB_reset();
randLIB_seed_random();

uint32_t ret = randLIB_randomise_base(0,0,0);
if( ret ){
uint32_t ret = randLIB_randomise_base(0, 0, 0);
if (ret) {
return false;
}
ret = randLIB_randomise_base(0xffff0000,0x8888,0x8888);
if( ret != 0xffffffff ){
ret = randLIB_randomise_base(0xffff0000, 0x8888, 0x8888);
if (ret != 0xffffffff) {
return false;
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ bool allow_open = true;
int __real_open(const char *path, int flags, ...);
int __wrap_open(const char *path, int flags, ...)
{
if (allow_open) {
if (flags & O_CREAT) {
va_list vl;
va_start(vl,flags);
mode_t mode = va_arg(vl, mode_t);
va_end(vl);
return __real_open(path, flags, mode);
} else {
return __real_open(path, flags);
}
} else {
return -1;
}
if (allow_open) {
if (flags & O_CREAT) {
va_list vl;
va_start(vl, flags);
mode_t mode = va_arg(vl, mode_t);
va_end(vl);
return __real_open(path, flags, mode);
} else {
return __real_open(path, flags);
}
} else {
return -1;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*
* Copyright (c) 2016, ARM Limited, All Rights Reserved
*/
#include "random_stub.h"

#include "ns_types.h"

static uint32_t seed_value = 4;
static bool seed_inc = false;
Expand Down
37 changes: 37 additions & 0 deletions features/frameworks/mbed-trace/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,43 @@ Set the output function, `printf` by default:
mbed_trace_print_function_set(printf)
```

### Tracing level

Run time tracing level is set using `mbed_trace_set_config()` function. Possible levels and examples how to set them is presented below.

```c
//mbed_trace_config_set(TRACE_ACTIVE_LEVEL_ALL);
//mbed_trace_config_set(TRACE_ACTIVE_LEVEL_DEBUG); // (same as ALL)
mbed_trace_config_set(TRACE_ACTIVE_LEVEL_INFO);
//mbed_trace_config_set(TRACE_ACTIVE_LEVEL_WARN);
//mbed_trace_config_set(TRACE_ACTIVE_LEVEL_ERROR);
//mbed_trace_config_set(TRACE_ACTIVE_LEVEL_CMD);
//mbed_trace_config_set(TRACE_ACTIVE_LEVEL_NONE);
```

Build time optimization can be done with `MBED_TRACE_MAX_LEVEL` definition. Setting max level to `TRACE_LEVEL_DEBUG` includes all traces to the build. Setting max level to `TRACE_LEVEL_INFO` includes all but `tr_debug()` traces to the build. Other maximum tracing levels follow the same behavior and no messages above the selected level are included in the build.

```c
#define MBED_TRACE_MAX_LEVEL TRACE_LEVEL_DEBUG
#define MBED_TRACE_MAX_LEVEL TRACE_LEVEL_INFO
#define MBED_TRACE_MAX_LEVEL TRACE_LEVEL_WARN
#define MBED_TRACE_MAX_LEVEL TRACE_LEVEL_ERROR
#define MBED_TRACE_MAX_LEVEL TRACE_LEVEL_CMD
```

In Mbed OS, the build time maximum tracing level can be set through `mbed_app.json` as shown below.

```
{
"target_overrides":{
"*":{
"mbed-trace.enable": true,
"mbed-trace.max-level": "TRACE_LEVEL_INFO"
}
}
}
```

### Helping functions

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:
Expand Down
36 changes: 18 additions & 18 deletions features/frameworks/mbed-trace/mbed-trace/mbed_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,11 @@ extern "C" {
* Initialize trace functionality
* @return 0 when all success, otherwise non zero
*/
int mbed_trace_init( void );
int mbed_trace_init(void);
/**
* Free trace memory
*/
void mbed_trace_free( void );
void mbed_trace_free(void);
/**
* Resize buffers (line / tmp ) sizes
* @param lineLength new maximum length for trace line (0 = do no resize)
Expand Down Expand Up @@ -226,7 +226,7 @@ uint8_t mbed_trace_config_get(void);
* char* trace_time(){ return "rtc-time-in-string"; }
* mbed_trace_prefix_function_set( &trace_time );
*/
void mbed_trace_prefix_function_set( char* (*pref_f)(size_t) );
void mbed_trace_prefix_function_set(char *(*pref_f)(size_t));
/**
* Set trace suffix function
* suffix -function return string with null terminated
Expand All @@ -235,18 +235,18 @@ void mbed_trace_prefix_function_set( char* (*pref_f)(size_t) );
* char* trace_suffix(){ return " END"; }
* mbed_trace_suffix_function_set( &trace_suffix );
*/
void mbed_trace_suffix_function_set(char* (*suffix_f)(void) );
void mbed_trace_suffix_function_set(char *(*suffix_f)(void));
/**
* Set trace print function
* By default, trace module print using printf() function,
* but with this you can write own print function,
* for e.g. to other IO device.
*/
void mbed_trace_print_function_set( void (*print_f)(const char*) );
void mbed_trace_print_function_set(void (*print_f)(const char *));
/**
* Set trace print function for tr_cmdline()
*/
void mbed_trace_cmdprint_function_set( void (*printf)(const char*) );
void mbed_trace_cmdprint_function_set(void (*printf)(const char *));
/**
* Set trace mutex wait function
* By default, trace calls are not thread safe.
Expand All @@ -270,10 +270,10 @@ void mbed_trace_mutex_release_function_set(void (*mutex_release_f)(void));
* mbed_trace_exclude_filters_set("mygr");
* mbed_tracef(TRACE_ACTIVE_LEVEL_DEBUG, "ougr", "This is not printed");
*/
void mbed_trace_exclude_filters_set(char* filters);
void mbed_trace_exclude_filters_set(char *filters);
/** get trace exclude filters
*/
const char* mbed_trace_exclude_filters_get(void);
const char *mbed_trace_exclude_filters_get(void);
/**
* When trace group contains text in filter,
* trace will be printed.
Expand All @@ -282,10 +282,10 @@ const char* mbed_trace_exclude_filters_get(void);
* mbed_tracef(TRACE_ACTIVE_LEVEL_DEBUG, "mygr", "Hi There");
* mbed_tracef(TRACE_ACTIVE_LEVEL_DEBUG, "grp2", "This is not printed");
*/
void mbed_trace_include_filters_set(char* filters);
void mbed_trace_include_filters_set(char *filters);
/** get trace include filters
*/
const char* mbed_trace_include_filters_get(void);
const char *mbed_trace_include_filters_get(void);
/**
* General trace function
* This should be used every time when user want to print out something important thing
Expand All @@ -298,9 +298,9 @@ const char* mbed_trace_include_filters_get(void);
* @param ... variable arguments related to fmt
*/
#if defined(__GNUC__) || defined(__CC_ARM)
void mbed_tracef(uint8_t dlevel, const char* grp, const char *fmt, ...) __attribute__ ((__format__(__printf__, 3, 4)));
void mbed_tracef(uint8_t dlevel, const char *grp, const char *fmt, ...) __attribute__((__format__(__printf__, 3, 4)));
#else
void mbed_tracef(uint8_t dlevel, const char* grp, const char *fmt, ...);
void mbed_tracef(uint8_t dlevel, const char *grp, const char *fmt, ...);
#endif
/**
* General trace function
Expand All @@ -318,16 +318,16 @@ void mbed_tracef(uint8_t dlevel, const char* grp, const char *fmt, ...);
* @param ap variable arguments list (like vprintf)
*/
#if defined(__GNUC__) || defined(__CC_ARM)
void mbed_vtracef(uint8_t dlevel, const char* grp, const char *fmt, va_list ap) __attribute__ ((__format__(__printf__, 3, 0)));
void mbed_vtracef(uint8_t dlevel, const char *grp, const char *fmt, va_list ap) __attribute__((__format__(__printf__, 3, 0)));
#else
void mbed_vtracef(uint8_t dlevel, const char* grp, const char *fmt, va_list ap);
void mbed_vtracef(uint8_t dlevel, const char *grp, const char *fmt, va_list ap);
#endif


/**
* Get last trace from buffer
*/
const char* mbed_trace_last(void);
const char *mbed_trace_last(void);
#if MBED_CONF_MBED_TRACE_FEA_IPV6 == 1
/**
* mbed_tracef helping function for convert ipv6
Expand All @@ -339,7 +339,7 @@ const char* mbed_trace_last(void);
* @param add_ptr IPv6 Address pointer
* @return temporary buffer where ipv6 is in string format
*/
char* mbed_trace_ipv6(const void *addr_ptr);
char *mbed_trace_ipv6(const void *addr_ptr);
/**
* mbed_tracef helping function for print ipv6 prefix
* usage e.g.
Expand All @@ -350,7 +350,7 @@ char* mbed_trace_ipv6(const void *addr_ptr);
* @param prefix_len prefix length
* @return temporary buffer where ipv6 is in string format
*/
char* mbed_trace_ipv6_prefix(const uint8_t *prefix, uint8_t prefix_len);
char *mbed_trace_ipv6_prefix(const uint8_t *prefix, uint8_t prefix_len);
#endif
/**
* mbed_tracef helping function for convert hex-array to string.
Expand All @@ -364,7 +364,7 @@ char* mbed_trace_ipv6_prefix(const uint8_t *prefix, uint8_t prefix_len);
* if array as string not fit to temp buffer, this function write '*' as last character,
* which indicate that buffer is too small for array.
*/
char* mbed_trace_array(const uint8_t* buf, uint16_t len);
char *mbed_trace_array(const uint8_t *buf, uint16_t len);

#ifdef __cplusplus
}
Expand Down
6 changes: 6 additions & 0 deletions features/frameworks/mbed-trace/mbed_lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
"help": "Used to globally enable traces.",
"value": null
},
"max-level": {
"help": "This flag is used to optimize the code size. For example, setting trace optimization level to TRACE_LEVEL_INFO will define all tr_debug() macros empty, which reduces the binary size. The possible optimization levels are TRACE_LEVEL_DEBUG, TRACE_LEVEL_INFO, TRACE_LEVEL_WARN, TRACE_LEVEL_ERROR and TRACE_LEVEL_CMD. To set the output tracing level, please use mbed_trace_config_set(TRACE_ACTIVE_LEVEL_INFO). The possible tracing levels for mbed_trace_config_set() are TRACE_ACTIVE_LEVEL_ALL, TRACE_ACTIVE_LEVEL_DEBUG (same as ALL), TRACE_ACTIVE_LEVEL_INFO, TRACE_ACTIVE_LEVEL_WARN, TRACE_ACTIVE_LEVEL_ERROR, TRACE_ACTIVE_LEVEL_CMD and TRACE_LEVEL_NONE.",
"value": null,
"macro_name": "MBED_TRACE_MAX_LEVEL"

},
"fea-ipv6": {
"help": "Used to globally disable ipv6 tracing features.",
"value": null
Expand Down
Loading