Skip to content

Commit 1bf6b20

Browse files
authored
Merge pull request #11308 from ARMmbed/release-candidate
Release candidate for mbed-os-5.13.4
2 parents 808c450 + 75ca176 commit 1bf6b20

File tree

463 files changed

+148507
-15132
lines changed

Some content is hidden

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

463 files changed

+148507
-15132
lines changed

TESTS/mbed_drivers/watchdog_reset/main.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,21 @@
2626
#include "mbed.h"
2727

2828
#define TIMEOUT_MS 100UL
29-
#define KICK_ADVANCE_MS 10UL
29+
30+
/* This value is used to calculate the time to kick the watchdog.
31+
* Given the watchdog timeout is set to TIMEOUT_MS, the kick will be performed
32+
* with a delay of (TIMEOUT_MS - KICK_ADVANCE_MS), after the init.
33+
*
34+
* It is common for the watchdog peripheral to use a low precision clock source,
35+
* e.g. the LSI RC acts as a clock source for the IWDG on ST targets.
36+
* According to the ST spec, the 37 kHz LSI is guaranteed to have a frequency
37+
* around 37-38 kHz, but the actual frequency range guaranteed by the production
38+
* tests is 26 kHz up to 56 kHz.
39+
* Bearing that in mind, a 100 ms timeout value may actually last as long as 142 ms
40+
* and as short as 66 ms.
41+
* The value of 35 ms is used to cover the worst case scenario (66 ms).
42+
*/
43+
#define KICK_ADVANCE_MS 35UL
3044

3145
#define MSG_VALUE_DUMMY "0"
3246
#define CASE_DATA_INVALID 0xffffffffUL

TESTS/mbed_hal/common_tickers/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void overflow_protect()
129129
return;
130130
}
131131

132-
while (intf->read() > ticks_now);
132+
while (intf->read() >= ticks_now);
133133
}
134134

135135
void ticker_event_handler_stub(const ticker_data_t *const ticker)

TESTS/mbed_hal/lp_ticker/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ void overflow_protect()
8585
return;
8686
}
8787

88-
while (lp_ticker_read() > ticks_now);
88+
while (lp_ticker_read() >= ticks_now);
8989
}
9090

9191
void ticker_event_handler_stub(const ticker_data_t *const ticker)

TESTS/mbed_hal/us_ticker/main.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,17 @@ void us_ticker_info_test()
3232
const ticker_info_t *p_ticker_info = us_ticker_get_info();
3333

3434
TEST_ASSERT(p_ticker_info->frequency >= 250000);
35-
TEST_ASSERT(p_ticker_info->frequency <= 8000000);
35+
36+
switch (p_ticker_info->bits) {
37+
case 32:
38+
TEST_ASSERT(p_ticker_info->frequency <= 100000000);
39+
break;
40+
41+
default:
42+
TEST_ASSERT(p_ticker_info->frequency <= 8000000);
43+
break;
44+
}
45+
3646
TEST_ASSERT(p_ticker_info->bits >= 16);
3747

3848
#ifdef US_TICKER_PERIOD_NUM

TESTS/mbed_hal/us_ticker/us_ticker_api_tests.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ extern "C" {
3131
*
3232
* Given ticker is available.
3333
* When ticker information data is obtained.
34-
* Then ticker information indicate that frequency between 250KHz and 8MHz and the counter is at least 16 bits wide.
34+
* Then ticker information indicate that:
35+
* - counter frequency is between 250KHz and 8MHz for counters which are less than 32 bits wide
36+
* - counter frequency is up to 100MHz for counters which are 32 bits wide
37+
* - the counter is at least 16 bits wide.
3538
*/
3639
void us_ticker_info_test(void);
3740

TESTS/mbed_hal/watchdog_reset/main.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,21 @@
2626
#include "mbed.h"
2727

2828
#define TIMEOUT_MS 100UL
29-
#define KICK_ADVANCE_MS 10UL
29+
30+
/* This value is used to calculate the time to kick the watchdog.
31+
* Given the watchdog timeout is set to TIMEOUT_MS, the kick will be performed
32+
* with a delay of (TIMEOUT_MS - KICK_ADVANCE_MS), after the init.
33+
*
34+
* It is common for the watchdog peripheral to use a low precision clock source,
35+
* e.g. the LSI RC acts as a clock source for the IWDG on ST targets.
36+
* According to the ST spec, the 37 kHz LSI is guaranteed to have a frequency
37+
* around 37-38 kHz, but the actual frequency range guaranteed by the production
38+
* tests is 26 kHz up to 56 kHz.
39+
* Bearing that in mind, a 100 ms timeout value may actually last as long as 142 ms
40+
* and as short as 66 ms.
41+
* The value of 35 ms is used to cover the worst case scenario (66 ms).
42+
*/
43+
#define KICK_ADVANCE_MS 35UL
3044

3145
#define MSG_VALUE_DUMMY "0"
3246
#define CASE_DATA_INVALID 0xffffffffUL

TESTS/mbed_platform/atomic/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ void test_atomic_add()
145145

146146
utest::v1::status_t test_setup(const size_t number_of_cases)
147147
{
148-
GREENTEA_SETUP(30, "default_auto");
148+
GREENTEA_SETUP(60, "default_auto");
149149
return utest::v1::verbose_test_setup_handler(number_of_cases);
150150
}
151151

TESTS/network/wifi/README.md

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,16 @@ Please refer to the following table for priorities of test cases. Priorities are
6262
| 9 | WIFI_CONNECT_PARAMS_CHANNEL | | SHOULD |
6363
| 10 | WIFI_CONNECT_PARAMS_CHANNEL_FAIL | | SHOULD |
6464
| 11 | WIFI_CONNECT | | MUST |
65-
| 12 | WIFI_CONNECT_SECURE | With security type: | |
65+
| 12 | WIFI_CONNECT_NONBLOCK | | SHOULD |
66+
| 13 | WIFI_CONNECT_SECURE | With security type: | |
6667
| | | NSAPI_SECURITY_WEP | SHOULD |
6768
| | | NSAPI_SECURITY_WPA | SHOULD |
6869
| | | NSAPI_SECURITY_WPA2 | SHOULD |
6970
| | | NSAPI_SECURITY_WPA_WPA2 | MUST |
70-
| 13 | WIFI_CONNECT_SECURE_FAIL | | MUST |
71-
| 14 | WIFI_CONNECT_DISCONNECT_REPEAT | | MUST |
72-
| 15 | WIFI_SCAN_NULL | | SHOULD |
73-
| 16 | WIFI_SCAN | | SHOULD |
71+
| 14 | WIFI_CONNECT_SECURE_FAIL | | MUST |
72+
| 15 | WIFI_CONNECT_DISCONNECT_REPEAT | | MUST |
73+
| 16 | WIFI_SCAN_NULL | | SHOULD |
74+
| 17 | WIFI_SCAN | | SHOULD |
7475

7576
Building test binaries
7677
----------------------
@@ -372,7 +373,7 @@ Test `WiFiInterface::connect()` without parameters. Use `set_credentials()` for
372373
2. `Call WiFiInterface::set_credentials( <ssid:unsecure>, NULL)`.
373374
3. `Call WiFiInterface::connect()`.
374375
4. `disconnect()`.
375-
5. `Call WiFiInterface::set_credentials( <ssid:unsecure>, "")`.
376+
5. `Call WiFiInterface::set_credentials( <ssid:unsecure>, "")`.
376377
6. `Call WiFiInterface::connect()`.
377378
7. `disconnect()`.
378379
8. Trash the memory storing SSID.
@@ -384,6 +385,33 @@ Test `WiFiInterface::connect()` without parameters. Use `set_credentials()` for
384385

385386
`connect()` calls return `NSAPI_ERROR_OK`.
386387

388+
### WIFI_CONNECT_NONBLOCK
389+
390+
**Description:**
391+
392+
Test `WiFiInterface::connect()` and `WiFiInterface::disconnect()` in non-blocking mode. It checks that driver can connect and disconnect in nonblocking mode.
393+
394+
**Preconditions:**
395+
396+
1. Test enviroment is set up as specified in the "Test Environment" chapter.
397+
398+
**Test steps:**
399+
400+
1. Initialize the driver.
401+
2. `Call WiFiInterface::set_credentials( <ssid:unsecure>, NULL)`.
402+
3. `Call WiFiInterface::connect()`.
403+
4. `Call WiFiInterface::set_blocking(false)`
404+
5. `Call WiFiInterface::get_connection_status()`
405+
6. `disconnect()`
406+
7. `Call WiFiInterface::get_connection_status()`
407+
8. `Call WiFiInterface::set_blocking(true)`
408+
409+
**Expected result:**
410+
411+
In case of drivers which do not support asynchronous mode `set_blocking(false)` call returns `NSAPI_ERROR_UNSUPPORTED` and skips test case, otherwise:
412+
`connect()` call returns `NSAPI_ERROR_OK`. To confirm connection `get_connection_status()` calls return `NSAPI_STATUS_GLOBAL_UP` or `NSAPI_STATUS_LOCAL_UP`.
413+
`disconnect()` call returns `NSAPI_ERROR_OK`. To confirm disconnection `get_connection_status()` calls return `NSAPI_STATUS_DISCONNECTED`.
414+
387415
### WIFI_CONNECT_SECURE
388416

389417
**Description:**

TESTS/network/wifi/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ Case cases[] = {
7474
Case("WIFI-GET-RSSI", wifi_get_rssi),
7575
Case("WIFI-CONNECT-PARAMS-VALID-UNSECURE", wifi_connect_params_valid_unsecure),
7676
Case("WIFI-CONNECT", wifi_connect),
77+
//Most boards are not passing this test, but they should if they support non-blocking API.
78+
//Case("WIFI-CONNECT-NONBLOCKING", wifi_connect_nonblock),
7779
Case("WIFI-CONNECT-DISCONNECT-REPEAT", wifi_connect_disconnect_repeat),
7880
#endif
7981
#if defined(MBED_CONF_APP_WIFI_SECURE_SSID)
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* Copyright (c) 2019, ARM Limited, All Rights Reserved
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
6+
* not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#include "mbed.h"
19+
#include "greentea-client/test_env.h"
20+
#include "unity.h"
21+
#include "utest.h"
22+
#include "wifi_tests.h"
23+
24+
using namespace utest::v1;
25+
26+
#if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)
27+
28+
#define SSID_MAX_LEN 32
29+
nsapi_connection_status_t status_connection;
30+
Semaphore sem_conn(0, 1);
31+
Semaphore sem_disconn(0, 1);
32+
void status_callback(nsapi_event_t e, intptr_t d)
33+
{
34+
if (d == NSAPI_STATUS_LOCAL_UP || d == NSAPI_STATUS_GLOBAL_UP) {
35+
status_connection = (nsapi_connection_status_t)d;
36+
sem_conn.release();
37+
}
38+
39+
if (d == NSAPI_STATUS_DISCONNECTED) {
40+
status_connection = (nsapi_connection_status_t)d;
41+
sem_disconn.release();
42+
}
43+
}
44+
45+
void wifi_connect_nonblock(void)
46+
{
47+
WiFiInterface *wifi = get_interface();
48+
char ssid[SSID_MAX_LEN + 1] = MBED_CONF_APP_WIFI_UNSECURE_SSID;
49+
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->set_credentials(ssid, NULL));
50+
wifi->attach(status_callback);
51+
TEST_SKIP_UNLESS(wifi->set_blocking(false) != NSAPI_ERROR_UNSUPPORTED);
52+
nsapi_error_t ret = wifi->connect();
53+
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, ret);
54+
bool res = sem_conn.try_acquire_for(30000);
55+
TEST_ASSERT_TRUE(res == true);
56+
TEST_ASSERT_TRUE(status_connection == NSAPI_STATUS_GLOBAL_UP || status_connection == NSAPI_STATUS_LOCAL_UP);
57+
ret = wifi->disconnect();
58+
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, ret);
59+
res = sem_disconn.try_acquire_for(30000);
60+
TEST_ASSERT_TRUE(res == true);
61+
TEST_ASSERT_EQUAL_INT(NSAPI_STATUS_DISCONNECTED, status_connection);
62+
wifi->set_blocking(true);
63+
}
64+
65+
#endif // defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)

TESTS/network/wifi/wifi_tests.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ void wifi_connect_params_channel_fail(void);
6363
/** Test WiFiInterface::connect() without parameters. Use set_credentials() for setting parameters. */
6464
void wifi_connect(void);
6565

66+
/** Test WiFiInterface::connect() in nonblocking mode. Use set_credentials() for setting parameters. */
67+
void wifi_connect_nonblock(void);
68+
6669
/** Test WiFiInterface::connect() without parameters. Don't set parameters with set_credentials() */
6770
void wifi_connect_nocredentials(void);
6871

UNITTESTS/features/netsocket/TLSSocketWrapper/test_TLSSocketWrapper.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ TEST_F(TestTLSSocketWrapper, recv_from)
307307
EXPECT_EQ(wrapper->connect(a), NSAPI_ERROR_OK);
308308
SocketAddress b;
309309
EXPECT_EQ(wrapper->recvfrom(&b, dataBuf, dataSize), NSAPI_ERROR_OK);
310+
EXPECT_EQ(a, b);
310311
}
311312

312313
TEST_F(TestTLSSocketWrapper, recv_from_null)

UNITTESTS/features/netsocket/TLSSocketWrapper/unittest.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ set(unittest-test-sources
2828
stubs/mbed_shared_queues_stub.cpp
2929
stubs/nsapi_dns_stub.cpp
3030
stubs/EventFlags_stub.cpp
31-
stubs/stoip4_stub.c
32-
stubs/ip4tos_stub.c
3331
stubs/SocketStats_Stub.cpp
3432
)
3533

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test/*

components/storage/blockdevice/COMPONENT_SD/mbed_lib.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@
165165
"SPI_MISO": "D12",
166166
"SPI_CLK": "D13",
167167
"SPI_CS": "D10"
168+
},
169+
"CC3220SF_LAUNCHXL": {
170+
"SPI_MOSI": "D11",
171+
"SPI_MISO": "D12",
172+
"SPI_CLK": "D13",
173+
"SPI_CS": "D10"
168174
}
169175
}
170176
}

features/FEATURE_BLE/ble/gap/AdvertisingDataParser.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ class AdvertisingDataParser {
7070
if (position >= data.size()) {
7171
return false;
7272
}
73+
74+
/* early termination of packet, no more meaningful octets */
75+
if (current_length() == 0) {
76+
return false;
77+
}
7378

7479
if (position + current_length() >= data.size()) {
7580
return false;

features/FEATURE_BLE/ble/gap/Types.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ struct advertising_type_t : SafeEnum<advertising_type_t, uint8_t> {
152152
/**
153153
* Device is connectable, scannable and doesn't expect connection from a
154154
* specific peer.
155+
* @note Cannot carry extended advertising payload, only legacy PDUs.
156+
* Use CONNECTABLE_NON_SCANNABLE_UNDIRECTED for non-legacy payload.
155157
*
156158
* @see Vol 3, Part C, Section 9.3.4 and Vol 6, Part B, Section 2.3.1.1.
157159
*/
@@ -183,13 +185,21 @@ struct advertising_type_t : SafeEnum<advertising_type_t, uint8_t> {
183185
*/
184186
CONNECTABLE_DIRECTED_LOW_DUTY = 0x04,
185187

188+
/**
189+
* Device is connectable, but not scannable and doesn't expect connection from a specific peer.
190+
* @note Only for use with extended advertising payload, will not allow legacy PDUs
191+
* (use CONNECTABLE_UNDIRECTED for legacy PDU).
192+
*/
193+
CONNECTABLE_NON_SCANNABLE_UNDIRECTED = 0x05,
194+
186195
#if !defined(DOXYGEN_ONLY)
187196
// used by the PAL; naming in line with the the spec.
188197
ADV_IND = 0x00,
189198
ADV_DIRECT_IND = 0x01,
190199
ADV_SCAN_IND = 0x02,
191200
ADV_NONCONN_IND = 0x03,
192-
ADV_DIRECT_IND_LOW_DUTY_CYCLE = 0x04
201+
ADV_DIRECT_IND_LOW_DUTY_CYCLE = 0x04,
202+
ADV_NONSCAN_IND = 0x05
193203
#endif
194204
};
195205

features/FEATURE_BLE/ble/pal/GapTypes.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,9 @@ struct advertising_event_properties_t {
446446
break;
447447
case advertising_type_t::ADV_NONCONN_IND:
448448
break;
449+
case advertising_type_t::ADV_NONSCAN_IND:
450+
connectable = true;
451+
break;
449452
}
450453
}
451454

features/FEATURE_BLE/ble/pal/PalGap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ struct Gap {
655655
periodic_advertising_interval_t periodic_advertising_max,
656656
bool advertise_power
657657
) {
658-
return impl()->set_periodic_advertising_parameters(
658+
return impl()->set_periodic_advertising_parameters_(
659659
advertising_handle,
660660
periodic_advertising_min,
661661
periodic_advertising_max,

0 commit comments

Comments
 (0)