Skip to content

Commit 2fd0c5c

Browse files
author
Cruz Monrreal
authored
Merge pull request ARMmbed#8775 from ARMmbed/release-candidate
Release candidate for mbed-os-5.10.4
2 parents bf6f2c3 + 40a538f commit 2fd0c5c

File tree

153 files changed

+24631
-2897
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+24631
-2897
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
Mbed OS is an open-source, device software platform for the Internet of Things. Contributions are an important part of the platform, and our goal is to make it as simple as possible to become a contributor.
44

5-
To encourage productive collaboration, as well as robust, consistent and maintainable code, we have a set ofguidelines for contributing toMbed OS. Please see: [contributing guidelines](https://os.mbed.com/docs/latest/reference/contributing.html).
5+
To encourage productive collaboration, as well as robust, consistent and maintainable code, we have a set of guidelines for [contributing to Mbed OS](https://os.mbed.com/docs/latest/reference/contributing.html).

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,20 @@
1919
Arm Mbed OS is an open source embedded operating system designed specifically for the "things" in the Internet of Things. It includes all the features you need to develop a connected product based on an Arm Cortex-M microcontroller, including security, connectivity, an RTOS and drivers for sensors and I/O devices.
2020

2121
Mbed OS provides a platform that includes:
22-
* Security foundations.
23-
* Cloud management services.
24-
* Drivers for sensors, I/O devices and connectivity.
22+
23+
- Security foundations.
24+
- Cloud management services.
25+
- Drivers for sensors, I/O devices and connectivity.
2526

2627
## Release notes
2728
The [release notes](https://os.mbed.com/releases) detail the current release. You can also find information about previous versions.
2829

30+
## License and contributions
31+
32+
The software is provided under [Apache-2.0 license](LICENSE). Contributions to this project are accepted under the same license. Please see [contributing.md](CONTRIBUTING.md) for more info.
33+
34+
This project contains code from other projects. The original license text is included in those source files. They must comply with our [license guide](https://os.mbed.com/docs/latest/reference/license.html)
35+
2936
## Getting started for developers
3037

3138
We have a [developer website](https://os.mbed.com) for asking questions, engaging with others, finding information on boards and components, using an online IDE and compiler, reading the documentation and learning about what's new and what's coming next in Mbed OS.
@@ -36,6 +43,7 @@ We also have a [contributing and publishing guide](https://os.mbed.com/contribut
3643

3744
## Documentation
3845

39-
For more information about Mbed OS, please see [our published documentation](https://os.mbed.com/docs/latest). It includes published Doxygen for our APIs, step-by-step tutorials, porting information and background reference materials about our architecture and tools.
46+
For more information about Mbed OS, please see [our published documentation](https://os.mbed.com/docs/latest). It includes Doxygen for our APIs, step-by-step tutorials, porting information and background reference materials about our architecture and tools.
47+
48+
To contribute to this documentation, please see the [mbed-os-5-docs repository](https://github.com/ARMmbed/mbed-os-5-docs).
4049

41-
To contribute to this documentation, please see the [mbed-os-5-docs repo](https://github.com/ARMmbed/mbed-os-5-docs).

TESTS/mbed_hal/rtc_time/main.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,41 @@ void test_local_time_invalid_param()
169169
TEST_ASSERT_EQUAL(false, _rtc_localtime(1, NULL, RTC_4_YEAR_LEAP_YEAR_SUPPORT));
170170
}
171171

172+
/* Test set_time() function called a few seconds apart.
173+
*
174+
* Given is set_time() function.
175+
* When set_time() is used to set the system time two times.
176+
* Then if the value returned from time() is always correct return true, otherwise return false.
177+
*/
178+
#define NEW_TIME 15
179+
void test_set_time_twice()
180+
{
181+
time_t current_time;
182+
183+
/* Set the time to NEW_TIME and check it */
184+
set_time(NEW_TIME);
185+
current_time = time(NULL);
186+
TEST_ASSERT_EQUAL (true, (current_time == NEW_TIME));
187+
188+
/* Wait 2 seconds */
189+
wait_ms(2000);
190+
191+
/* set the time to NEW_TIME again and check it */
192+
set_time(NEW_TIME);
193+
current_time = time(NULL);
194+
TEST_ASSERT_EQUAL (true, (current_time == NEW_TIME));
195+
}
196+
172197
Case cases[] = {
173198
Case("test is leap year - RTC leap years full support", test_is_leap_year<RTC_FULL_LEAP_YEAR_SUPPORT>),
174199
Case("test is leap year - RTC leap years partial support", test_is_leap_year<RTC_4_YEAR_LEAP_YEAR_SUPPORT>),
175200
Case("test make time boundary values - RTC leap years full support", test_mk_time_boundary<RTC_FULL_LEAP_YEAR_SUPPORT>),
176201
Case("test make time boundary values - RTC leap years partial support", test_mk_time_boundary<RTC_4_YEAR_LEAP_YEAR_SUPPORT>),
177202
Case("test make time - invalid param", test_mk_time_invalid_param),
178203
Case("test local time - invalid param", test_local_time_invalid_param),
204+
#if DEVICE_RTC || DEVICE_LPTICKER
205+
Case("test set_time twice", test_set_time_twice),
206+
#endif
179207
};
180208

181209
utest::v1::status_t greentea_test_setup(const size_t number_of_cases)

TESTS/netsocket/tcp/tcpsocket_recv_100k.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,26 +58,34 @@ static nsapi_error_t _tcpsocket_connect_to_chargen_srv(TCPSocket &sock)
5858
* \param offset Start pattern from offset
5959
* \param len Length of pattern to generate.
6060
*/
61-
static void generate_RFC_864_pattern(size_t offset, uint8_t *buf, size_t len)
61+
static void generate_RFC_864_pattern(size_t offset, uint8_t *buf, size_t len, bool is_xinetd)
6262
{
63+
const int row_size = 74; // Number of chars in single row
64+
const int row_count = 95; // Number of rows in pattern after which pattern start from beginning
65+
const int chars_scope = is_xinetd ? 93 : 95; // Number of chars from ASCII table used in pattern
66+
const char first_char = is_xinetd ? '!' : ' '; // First char from ASCII table used in pattern
6367
while (len--) {
64-
if (offset % 74 == 72) {
68+
if (offset % row_size == (row_size - 2)) {
6569
*buf++ = '\r';
66-
} else if (offset % 74 == 73) {
70+
} else if (offset % row_size == (row_size - 1)) {
6771
*buf++ = '\n';
6872
} else {
69-
*buf++ = ' ' + (offset % 74 + offset / 74) % 95 ;
73+
*buf++ = first_char + (offset % row_size + ((offset / row_size) % row_count)) % chars_scope;
7074
}
7175
offset++;
7276
}
7377
}
7478

7579
static void check_RFC_864_pattern(void *rx_buff, const size_t len, const size_t offset)
7680
{
81+
static bool is_xinetd = false;
7782
void *ref_buff = malloc(len);
7883
TEST_ASSERT_NOT_NULL(ref_buff);
7984

80-
generate_RFC_864_pattern(offset, (uint8_t *)ref_buff, len);
85+
if (offset == 0) {
86+
is_xinetd = ((uint8_t *)rx_buff)[0] == '!';
87+
}
88+
generate_RFC_864_pattern(offset, (uint8_t *)ref_buff, len, is_xinetd);
8189
bool match = memcmp(ref_buff, rx_buff, len) == 0;
8290

8391
free(ref_buff);

TESTS/network/emac/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ using namespace utest::v1;
5353
utest::v1::status_t test_setup(const size_t number_of_cases)
5454
{
5555
#if !MBED_CONF_APP_ECHO_SERVER
56-
GREENTEA_SETUP(1200, "default_auto");
56+
GREENTEA_SETUP(1400, "default_auto");
5757
#endif
5858
return verbose_test_setup_handler(number_of_cases);
5959
}

TESTS/network/wifi/wifi_connect_nocredentials.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ using namespace utest::v1;
2626
void wifi_connect_nocredentials(void)
2727
{
2828
WiFiInterface *wifi = get_interface();
29-
nsapi_error_t error;
30-
error = wifi->connect();
31-
TEST_ASSERT(error == NSAPI_ERROR_NO_SSID || error == NSAPI_ERROR_PARAMETER);
29+
nsapi_error_t error_connect, error_disconnect;
30+
error_connect = wifi->connect();
31+
error_disconnect = wifi->disconnect();
32+
TEST_ASSERT(error_connect == NSAPI_ERROR_NO_SSID || error_connect == NSAPI_ERROR_PARAMETER);
33+
TEST_ASSERT(error_disconnect == NSAPI_ERROR_NO_CONNECTION);
3234
}

TESTS/network/wifi/wifi_connect_params_channel.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,12 @@ void wifi_connect_params_channel(void)
3535
}
3636

3737
nsapi_error_t error = wifi->connect(MBED_CONF_APP_WIFI_SECURE_SSID, MBED_CONF_APP_WIFI_PASSWORD, get_security(), MBED_CONF_APP_WIFI_CH_SECURE);
38-
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, error);
3938

4039
wifi->set_channel(0);
40+
41+
wifi->disconnect();
42+
43+
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, error);
4144
}
4245

4346
#endif // defined(MBED_CONF_APP_WIFI_SECURE_SSID)

TESTS/network/wifi/wifi_connect_params_null.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ using namespace utest::v1;
2525

2626
void wifi_connect_params_null(void)
2727
{
28+
nsapi_error_t error;
2829
WiFiInterface *wifi = get_interface();
29-
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_PARAMETER, wifi->connect(NULL, NULL));
30-
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_PARAMETER, wifi->connect("", ""));
30+
error = wifi->connect(NULL, NULL);
31+
wifi->disconnect();
32+
TEST_ASSERT(error == NSAPI_ERROR_PARAMETER);
33+
error = wifi->connect("", "");
34+
wifi->disconnect();
35+
TEST_ASSERT(error == NSAPI_ERROR_PARAMETER);
3136
}

TESTS/network/wifi/wifi_connect_params_valid_secure.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ void wifi_connect_params_valid_secure(void)
3030
WiFiInterface *wifi = get_interface();
3131

3232
if (wifi->connect(MBED_CONF_APP_WIFI_SECURE_SSID, MBED_CONF_APP_WIFI_PASSWORD, get_security()) == NSAPI_ERROR_OK) {
33+
wifi->disconnect();
3334
return;
3435
}
3536

TESTS/network/wifi/wifi_connect_secure.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ void wifi_connect_secure(void)
3232
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->set_credentials(MBED_CONF_APP_WIFI_SECURE_SSID, MBED_CONF_APP_WIFI_PASSWORD, get_security()));
3333

3434
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->connect());
35+
36+
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->disconnect());
3537
}
3638

3739
#endif // defined(MBED_CONF_APP_WIFI_SECURE_SSID)

TESTS/network/wifi/wifi_connect_secure_fail.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ void wifi_connect_secure_fail(void)
3232
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->set_credentials(MBED_CONF_APP_WIFI_SECURE_SSID, "aaaaaaaa", get_security()));
3333
nsapi_error_t error;
3434
error = wifi->connect();
35+
wifi->disconnect();
3536
TEST_ASSERT(error == NSAPI_ERROR_AUTH_FAILURE ||
3637
error == NSAPI_ERROR_CONNECTION_TIMEOUT ||
3738
error == NSAPI_ERROR_NO_CONNECTION);
39+
3840
}
3941

4042
#endif // defined(MBED_CONF_APP_WIFI_SECURE_SSID)

TESTS/network/wifi/wifi_get_rssi.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ void wifi_get_rssi(void)
3636
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->connect());
3737

3838
TEST_ASSERT_INT8_WITHIN(-10, -100, wifi->get_rssi());
39+
40+
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->disconnect());
3941
}
4042

4143
#endif // defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)

TEST_APPS/device/socket_app/cmd_socket.cpp

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class SInfo {
152152
{
153153
assert(sock);
154154
}
155-
SInfo(Socket* sock, bool delete_on_exit=true):
155+
SInfo(Socket *sock, bool delete_on_exit = true):
156156
_id(id_count++),
157157
_sock(sock),
158158
_type(SInfo::OTHER),
@@ -408,31 +408,42 @@ static void print_data_as_hex(const uint8_t *buf, int len, int col_width);
408408
* \param offset Start pattern from offset
409409
* \param len Length of pattern to generate.
410410
*/
411-
static void generate_RFC_864_pattern(size_t offset, uint8_t *buf, size_t len)
411+
static void generate_RFC_864_pattern(size_t offset, uint8_t *buf, size_t len, bool is_xinetd)
412412
{
413+
const int row_size = 74; // Number of chars in single row
414+
const int row_count = 95; // Number of rows in pattern after which pattern start from beginning
415+
const int chars_scope = is_xinetd ? 93 : 95; // Number of chars from ASCII table used in pattern
416+
const char first_char = is_xinetd ? '!' : ' '; // First char from ASCII table used in pattern
413417
while (len--) {
414-
if (offset % 74 == 72) {
418+
if (offset % row_size == (row_size - 2)) {
415419
*buf++ = '\r';
416-
} else if (offset % 74 == 73) {
420+
} else if (offset % row_size == (row_size - 1)) {
417421
*buf++ = '\n';
418422
} else {
419-
*buf++ = ' ' + (offset % 74 + offset / 74) % 95 ;
423+
*buf++ = first_char + (offset % row_size + ((offset / row_size) % row_count)) % chars_scope;
420424
}
421425
offset++;
422426
}
423427
}
424428

425429
bool SInfo::check_pattern(void *buffer, size_t len)
426430
{
431+
static bool is_xinetd = false;
427432
if (!_check_pattern) {
428433
return true;
429434
}
430435
void *buf = malloc(len);
431436
if (!buf) {
432437
return false;
433438
}
439+
434440
size_t offset = _receivedTotal;
435-
generate_RFC_864_pattern(offset, (uint8_t *)buf, len);
441+
442+
if (offset == 0) {
443+
is_xinetd = ((uint8_t *)buffer)[0] == '!';
444+
}
445+
446+
generate_RFC_864_pattern(offset, (uint8_t *)buf, len, is_xinetd);
436447
bool match = memcmp(buf, buffer, len) == 0;
437448
if (!match) {
438449
cmd_printf("Pattern check failed\r\nWAS:%.*s\r\nREF:%.*s\r\n", len, (char *)buffer, len, (char *)buf);
@@ -1162,11 +1173,11 @@ static int cmd_socket(int argc, char *argv[])
11621173
cmd_printf("Invalid socket id\r\n");
11631174
return CMDLINE_RETCODE_FAIL;
11641175
}
1165-
TCPSocket *new_sock = static_cast<TCPSocket*>(&new_info->socket());
1166-
nsapi_error_t ret = static_cast<TCPServer&>(info->socket()).accept(new_sock, &addr);
1176+
TCPSocket *new_sock = static_cast<TCPSocket *>(&new_info->socket());
1177+
nsapi_error_t ret = static_cast<TCPServer &>(info->socket()).accept(new_sock, &addr);
11671178
if (ret == NSAPI_ERROR_OK) {
11681179
cmd_printf("TCPServer::accept() new socket sid: %d connection from %s port %d\r\n",
1169-
new_info->id(), addr.get_ip_address(), addr.get_port());
1180+
new_info->id(), addr.get_ip_address(), addr.get_port());
11701181
}
11711182
return handle_nsapi_error("TCPServer::accept()", ret);
11721183
}

UNITTESTS/features/lorawan/lorawantimer/unittest.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ set(unittest-test-sources
3737
stubs/equeue_stub.c
3838
)
3939

40+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNDEBUG=1")
41+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNDEBUG=1")
42+

0 commit comments

Comments
 (0)