Skip to content

Commit

Permalink
Merge pull request #11308 from ARMmbed/release-candidate
Browse files Browse the repository at this point in the history
Release candidate for mbed-os-5.13.4
  • Loading branch information
0xc0170 authored Aug 26, 2019
2 parents 808c450 + 75ca176 commit 1bf6b20
Show file tree
Hide file tree
Showing 463 changed files with 148,507 additions and 15,132 deletions.
16 changes: 15 additions & 1 deletion TESTS/mbed_drivers/watchdog_reset/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,21 @@
#include "mbed.h"

#define TIMEOUT_MS 100UL
#define KICK_ADVANCE_MS 10UL

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

#define MSG_VALUE_DUMMY "0"
#define CASE_DATA_INVALID 0xffffffffUL
Expand Down
2 changes: 1 addition & 1 deletion TESTS/mbed_hal/common_tickers/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void overflow_protect()
return;
}

while (intf->read() > ticks_now);
while (intf->read() >= ticks_now);
}

void ticker_event_handler_stub(const ticker_data_t *const ticker)
Expand Down
2 changes: 1 addition & 1 deletion TESTS/mbed_hal/lp_ticker/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void overflow_protect()
return;
}

while (lp_ticker_read() > ticks_now);
while (lp_ticker_read() >= ticks_now);
}

void ticker_event_handler_stub(const ticker_data_t *const ticker)
Expand Down
12 changes: 11 additions & 1 deletion TESTS/mbed_hal/us_ticker/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,17 @@ void us_ticker_info_test()
const ticker_info_t *p_ticker_info = us_ticker_get_info();

TEST_ASSERT(p_ticker_info->frequency >= 250000);
TEST_ASSERT(p_ticker_info->frequency <= 8000000);

switch (p_ticker_info->bits) {
case 32:
TEST_ASSERT(p_ticker_info->frequency <= 100000000);
break;

default:
TEST_ASSERT(p_ticker_info->frequency <= 8000000);
break;
}

TEST_ASSERT(p_ticker_info->bits >= 16);

#ifdef US_TICKER_PERIOD_NUM
Expand Down
5 changes: 4 additions & 1 deletion TESTS/mbed_hal/us_ticker/us_ticker_api_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ extern "C" {
*
* Given ticker is available.
* When ticker information data is obtained.
* Then ticker information indicate that frequency between 250KHz and 8MHz and the counter is at least 16 bits wide.
* Then ticker information indicate that:
* - counter frequency is between 250KHz and 8MHz for counters which are less than 32 bits wide
* - counter frequency is up to 100MHz for counters which are 32 bits wide
* - the counter is at least 16 bits wide.
*/
void us_ticker_info_test(void);

Expand Down
16 changes: 15 additions & 1 deletion TESTS/mbed_hal/watchdog_reset/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,21 @@
#include "mbed.h"

#define TIMEOUT_MS 100UL
#define KICK_ADVANCE_MS 10UL

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

#define MSG_VALUE_DUMMY "0"
#define CASE_DATA_INVALID 0xffffffffUL
Expand Down
2 changes: 1 addition & 1 deletion TESTS/mbed_platform/atomic/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void test_atomic_add()

utest::v1::status_t test_setup(const size_t number_of_cases)
{
GREENTEA_SETUP(30, "default_auto");
GREENTEA_SETUP(60, "default_auto");
return utest::v1::verbose_test_setup_handler(number_of_cases);
}

Expand Down
40 changes: 34 additions & 6 deletions TESTS/network/wifi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,16 @@ Please refer to the following table for priorities of test cases. Priorities are
| 9 | WIFI_CONNECT_PARAMS_CHANNEL | | SHOULD |
| 10 | WIFI_CONNECT_PARAMS_CHANNEL_FAIL | | SHOULD |
| 11 | WIFI_CONNECT | | MUST |
| 12 | WIFI_CONNECT_SECURE | With security type: | |
| 12 | WIFI_CONNECT_NONBLOCK | | SHOULD |
| 13 | WIFI_CONNECT_SECURE | With security type: | |
| | | NSAPI_SECURITY_WEP | SHOULD |
| | | NSAPI_SECURITY_WPA | SHOULD |
| | | NSAPI_SECURITY_WPA2 | SHOULD |
| | | NSAPI_SECURITY_WPA_WPA2 | MUST |
| 13 | WIFI_CONNECT_SECURE_FAIL | | MUST |
| 14 | WIFI_CONNECT_DISCONNECT_REPEAT | | MUST |
| 15 | WIFI_SCAN_NULL | | SHOULD |
| 16 | WIFI_SCAN | | SHOULD |
| 14 | WIFI_CONNECT_SECURE_FAIL | | MUST |
| 15 | WIFI_CONNECT_DISCONNECT_REPEAT | | MUST |
| 16 | WIFI_SCAN_NULL | | SHOULD |
| 17 | WIFI_SCAN | | SHOULD |

Building test binaries
----------------------
Expand Down Expand Up @@ -372,7 +373,7 @@ Test `WiFiInterface::connect()` without parameters. Use `set_credentials()` for
2. `Call WiFiInterface::set_credentials( <ssid:unsecure>, NULL)`.
3. `Call WiFiInterface::connect()`.
4. `disconnect()`.
5. `Call WiFiInterface::set_credentials( <ssid:unsecure>, "")`.
5. `Call WiFiInterface::set_credentials( <ssid:unsecure>, "")`.
6. `Call WiFiInterface::connect()`.
7. `disconnect()`.
8. Trash the memory storing SSID.
Expand All @@ -384,6 +385,33 @@ Test `WiFiInterface::connect()` without parameters. Use `set_credentials()` for

`connect()` calls return `NSAPI_ERROR_OK`.

### WIFI_CONNECT_NONBLOCK

**Description:**

Test `WiFiInterface::connect()` and `WiFiInterface::disconnect()` in non-blocking mode. It checks that driver can connect and disconnect in nonblocking mode.

**Preconditions:**

1. Test enviroment is set up as specified in the "Test Environment" chapter.

**Test steps:**

1. Initialize the driver.
2. `Call WiFiInterface::set_credentials( <ssid:unsecure>, NULL)`.
3. `Call WiFiInterface::connect()`.
4. `Call WiFiInterface::set_blocking(false)`
5. `Call WiFiInterface::get_connection_status()`
6. `disconnect()`
7. `Call WiFiInterface::get_connection_status()`
8. `Call WiFiInterface::set_blocking(true)`

**Expected result:**

In case of drivers which do not support asynchronous mode `set_blocking(false)` call returns `NSAPI_ERROR_UNSUPPORTED` and skips test case, otherwise:
`connect()` call returns `NSAPI_ERROR_OK`. To confirm connection `get_connection_status()` calls return `NSAPI_STATUS_GLOBAL_UP` or `NSAPI_STATUS_LOCAL_UP`.
`disconnect()` call returns `NSAPI_ERROR_OK`. To confirm disconnection `get_connection_status()` calls return `NSAPI_STATUS_DISCONNECTED`.

### WIFI_CONNECT_SECURE

**Description:**
Expand Down
2 changes: 2 additions & 0 deletions TESTS/network/wifi/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ Case cases[] = {
Case("WIFI-GET-RSSI", wifi_get_rssi),
Case("WIFI-CONNECT-PARAMS-VALID-UNSECURE", wifi_connect_params_valid_unsecure),
Case("WIFI-CONNECT", wifi_connect),
//Most boards are not passing this test, but they should if they support non-blocking API.
//Case("WIFI-CONNECT-NONBLOCKING", wifi_connect_nonblock),
Case("WIFI-CONNECT-DISCONNECT-REPEAT", wifi_connect_disconnect_repeat),
#endif
#if defined(MBED_CONF_APP_WIFI_SECURE_SSID)
Expand Down
65 changes: 65 additions & 0 deletions TESTS/network/wifi/wifi_connect_nonblock.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Copyright (c) 2019, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "mbed.h"
#include "greentea-client/test_env.h"
#include "unity.h"
#include "utest.h"
#include "wifi_tests.h"

using namespace utest::v1;

#if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)

#define SSID_MAX_LEN 32
nsapi_connection_status_t status_connection;
Semaphore sem_conn(0, 1);
Semaphore sem_disconn(0, 1);
void status_callback(nsapi_event_t e, intptr_t d)
{
if (d == NSAPI_STATUS_LOCAL_UP || d == NSAPI_STATUS_GLOBAL_UP) {
status_connection = (nsapi_connection_status_t)d;
sem_conn.release();
}

if (d == NSAPI_STATUS_DISCONNECTED) {
status_connection = (nsapi_connection_status_t)d;
sem_disconn.release();
}
}

void wifi_connect_nonblock(void)
{
WiFiInterface *wifi = get_interface();
char ssid[SSID_MAX_LEN + 1] = MBED_CONF_APP_WIFI_UNSECURE_SSID;
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, wifi->set_credentials(ssid, NULL));
wifi->attach(status_callback);
TEST_SKIP_UNLESS(wifi->set_blocking(false) != NSAPI_ERROR_UNSUPPORTED);
nsapi_error_t ret = wifi->connect();
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, ret);
bool res = sem_conn.try_acquire_for(30000);
TEST_ASSERT_TRUE(res == true);
TEST_ASSERT_TRUE(status_connection == NSAPI_STATUS_GLOBAL_UP || status_connection == NSAPI_STATUS_LOCAL_UP);
ret = wifi->disconnect();
TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, ret);
res = sem_disconn.try_acquire_for(30000);
TEST_ASSERT_TRUE(res == true);
TEST_ASSERT_EQUAL_INT(NSAPI_STATUS_DISCONNECTED, status_connection);
wifi->set_blocking(true);
}

#endif // defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)
3 changes: 3 additions & 0 deletions TESTS/network/wifi/wifi_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ void wifi_connect_params_channel_fail(void);
/** Test WiFiInterface::connect() without parameters. Use set_credentials() for setting parameters. */
void wifi_connect(void);

/** Test WiFiInterface::connect() in nonblocking mode. Use set_credentials() for setting parameters. */
void wifi_connect_nonblock(void);

/** Test WiFiInterface::connect() without parameters. Don't set parameters with set_credentials() */
void wifi_connect_nocredentials(void);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ TEST_F(TestTLSSocketWrapper, recv_from)
EXPECT_EQ(wrapper->connect(a), NSAPI_ERROR_OK);
SocketAddress b;
EXPECT_EQ(wrapper->recvfrom(&b, dataBuf, dataSize), NSAPI_ERROR_OK);
EXPECT_EQ(a, b);
}

TEST_F(TestTLSSocketWrapper, recv_from_null)
Expand Down
2 changes: 0 additions & 2 deletions UNITTESTS/features/netsocket/TLSSocketWrapper/unittest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ set(unittest-test-sources
stubs/mbed_shared_queues_stub.cpp
stubs/nsapi_dns_stub.cpp
stubs/EventFlags_stub.cpp
stubs/stoip4_stub.c
stubs/ip4tos_stub.c
stubs/SocketStats_Stub.cpp
)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test/*
6 changes: 6 additions & 0 deletions components/storage/blockdevice/COMPONENT_SD/mbed_lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@
"SPI_MISO": "D12",
"SPI_CLK": "D13",
"SPI_CS": "D10"
},
"CC3220SF_LAUNCHXL": {
"SPI_MOSI": "D11",
"SPI_MISO": "D12",
"SPI_CLK": "D13",
"SPI_CS": "D10"
}
}
}
5 changes: 5 additions & 0 deletions features/FEATURE_BLE/ble/gap/AdvertisingDataParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ class AdvertisingDataParser {
if (position >= data.size()) {
return false;
}

/* early termination of packet, no more meaningful octets */
if (current_length() == 0) {
return false;
}

if (position + current_length() >= data.size()) {
return false;
Expand Down
12 changes: 11 additions & 1 deletion features/FEATURE_BLE/ble/gap/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ struct advertising_type_t : SafeEnum<advertising_type_t, uint8_t> {
/**
* Device is connectable, scannable and doesn't expect connection from a
* specific peer.
* @note Cannot carry extended advertising payload, only legacy PDUs.
* Use CONNECTABLE_NON_SCANNABLE_UNDIRECTED for non-legacy payload.
*
* @see Vol 3, Part C, Section 9.3.4 and Vol 6, Part B, Section 2.3.1.1.
*/
Expand Down Expand Up @@ -183,13 +185,21 @@ struct advertising_type_t : SafeEnum<advertising_type_t, uint8_t> {
*/
CONNECTABLE_DIRECTED_LOW_DUTY = 0x04,

/**
* Device is connectable, but not scannable and doesn't expect connection from a specific peer.
* @note Only for use with extended advertising payload, will not allow legacy PDUs
* (use CONNECTABLE_UNDIRECTED for legacy PDU).
*/
CONNECTABLE_NON_SCANNABLE_UNDIRECTED = 0x05,

#if !defined(DOXYGEN_ONLY)
// used by the PAL; naming in line with the the spec.
ADV_IND = 0x00,
ADV_DIRECT_IND = 0x01,
ADV_SCAN_IND = 0x02,
ADV_NONCONN_IND = 0x03,
ADV_DIRECT_IND_LOW_DUTY_CYCLE = 0x04
ADV_DIRECT_IND_LOW_DUTY_CYCLE = 0x04,
ADV_NONSCAN_IND = 0x05
#endif
};

Expand Down
3 changes: 3 additions & 0 deletions features/FEATURE_BLE/ble/pal/GapTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,9 @@ struct advertising_event_properties_t {
break;
case advertising_type_t::ADV_NONCONN_IND:
break;
case advertising_type_t::ADV_NONSCAN_IND:
connectable = true;
break;
}
}

Expand Down
2 changes: 1 addition & 1 deletion features/FEATURE_BLE/ble/pal/PalGap.h
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ struct Gap {
periodic_advertising_interval_t periodic_advertising_max,
bool advertise_power
) {
return impl()->set_periodic_advertising_parameters(
return impl()->set_periodic_advertising_parameters_(
advertising_handle,
periodic_advertising_min,
periodic_advertising_max,
Expand Down
Loading

0 comments on commit 1bf6b20

Please sign in to comment.