Skip to content

Commit e642a7d

Browse files
authored
Merge pull request #12372 from ARMmbed/release-candidate
Release candidate for mbed-os-5.15.1
2 parents 64853b3 + 7b398c0 commit e642a7d

File tree

903 files changed

+509649
-14124
lines changed

Some content is hidden

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

903 files changed

+509649
-14124
lines changed

UNITTESTS/events/equeue/test_equeue.cpp

Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,64 @@ static void *multithread_thread(void *p)
139139
return 0;
140140
}
141141

142+
class ecount {
143+
mutable pthread_mutex_t mutex;
144+
pthread_cond_t cond;
145+
uint8_t count;
146+
public:
147+
ecount() : count(0)
148+
{
149+
int err = pthread_mutex_init(&mutex, NULL);
150+
EXPECT_EQ(0, err);
151+
err = pthread_cond_init(&cond, NULL);
152+
EXPECT_EQ(0, err);
153+
}
154+
155+
~ecount()
156+
{
157+
int err = pthread_mutex_destroy(&mutex);
158+
EXPECT_EQ(0, err);
159+
err = pthread_cond_destroy(&cond);
160+
EXPECT_EQ(0, err);
161+
}
162+
163+
void lock() const
164+
{
165+
int err = pthread_mutex_lock(&mutex);
166+
EXPECT_EQ(0, err);
167+
}
168+
169+
void unlock() const
170+
{
171+
int err = pthread_mutex_unlock(&mutex);
172+
EXPECT_EQ(0, err);
173+
}
174+
175+
void touch()
176+
{
177+
lock();
178+
if (count < 200) {
179+
count++;
180+
}
181+
unlock();
182+
int err = pthread_cond_broadcast(&cond);
183+
EXPECT_EQ(0, err);
184+
}
185+
186+
void wait_for_touches(uint8_t n)
187+
{
188+
lock();
189+
while (count < n) {
190+
int err = pthread_cond_wait(&cond, &mutex);
191+
EXPECT_EQ(0, err);
192+
}
193+
unlock();
194+
}
195+
};
196+
142197
static void multithread_func(void *p)
143198
{
144-
if ((*(reinterpret_cast<uint8_t *>(p))) < 200) {
145-
(*(reinterpret_cast<uint8_t *>(p)))++;
146-
}
199+
static_cast<ecount *>(p)->touch();
147200
}
148201

149202
static void background_func(void *p, int ms)
@@ -665,20 +718,18 @@ TEST_F(TestEqueue, test_equeue_multithread)
665718
int err = equeue_create(&q, TEST_EQUEUE_SIZE);
666719
ASSERT_EQ(0, err);
667720

668-
uint8_t touched = 0;
669-
equeue_call_every(&q, 1, multithread_func, &touched);
721+
ecount t;
722+
equeue_call_every(&q, 1, multithread_func, &t);
670723

671724
pthread_t thread;
672725
err = pthread_create(&thread, 0, multithread_thread, &q);
673726
ASSERT_EQ(0, err);
674727

675-
usleep(10000);
728+
t.wait_for_touches(1);
676729
equeue_break(&q);
677730
err = pthread_join(thread, 0);
678731
ASSERT_EQ(0, err);
679732

680-
EXPECT_TRUE(touched > 1);
681-
682733
equeue_destroy(&q);
683734
}
684735

components/storage/blockdevice/COMPONENT_FLASHIAP/mbed_lib.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
"FVP_MPS2": {
1919
"base-address": "0x00200000",
2020
"size": "0x200000"
21+
},
22+
"S5JS100": {
23+
"base-address": "0x40EF5000",
24+
"size": "0x80000"
2125
}
2226
}
2327
}

components/storage/blockdevice/COMPONENT_SPIF/mbed_lib.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
}
1414
},
1515
"target_overrides": {
16+
"HANI_IOT": {
17+
"SPI_MOSI": "P0_26",
18+
"SPI_MISO": "P1_3",
19+
"SPI_CLK": "P1_2",
20+
"SPI_CS": "P0_20"
21+
},
1622
"LPC54114": {
1723
"SPI_MOSI": "P0_20",
1824
"SPI_MISO": "P0_18",

components/wifi/esp8266-driver/ESP8266/ESP8266.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
#if DEVICE_SERIAL && DEVICE_INTERRUPTIN && defined(MBED_CONF_EVENTS_PRESENT) && defined(MBED_CONF_NSAPI_PRESENT) && defined(MBED_CONF_RTOS_PRESENT)
17+
#if DEVICE_SERIAL && DEVICE_INTERRUPTIN && defined(MBED_CONF_EVENTS_PRESENT) && defined(MBED_CONF_NSAPI_PRESENT) && defined(MBED_CONF_RTOS_API_PRESENT)
1818
#ifndef __STDC_FORMAT_MACROS
1919
#define __STDC_FORMAT_MACROS
2020
#endif
@@ -57,7 +57,6 @@ ESP8266::ESP8266(PinName tx, PinName rx, bool debug, PinName rts, PinName cts)
5757
_closed(false),
5858
_error(false),
5959
_busy(false),
60-
_reset_check(_rmutex),
6160
_reset_done(false),
6261
_conn_status(NSAPI_STATUS_DISCONNECTED)
6362
{
@@ -272,14 +271,15 @@ bool ESP8266::reset(void)
272271
continue;
273272
}
274273

275-
_rmutex.lock();
276-
while ((rtos::Kernel::get_ms_count() - start_time < ESP8266_BOOTTIME) && !_reset_done) {
274+
while (!_reset_done) {
277275
_process_oob(ESP8266_RECV_TIMEOUT, true); // UART mutex claimed -> need to check for OOBs ourselves
278-
_reset_check.wait_for(100); // Arbitrary relatively short delay
276+
if (_reset_done || (rtos::Kernel::get_ms_count() - start_time >= ESP8266_BOOTTIME)) {
277+
break;
278+
}
279+
rtos::ThisThread::sleep_for(100);
279280
}
280281

281282
done = _reset_done;
282-
_rmutex.unlock();
283283
if (done) {
284284
break;
285285
}
@@ -1040,11 +1040,7 @@ void ESP8266::_oob_watchdog_reset()
10401040

10411041
void ESP8266::_oob_ready()
10421042
{
1043-
1044-
_rmutex.lock();
10451043
_reset_done = true;
1046-
_reset_check.notify_all();
1047-
_rmutex.unlock();
10481044

10491045
for (int i = 0; i < SOCKET_COUNT; i++) {
10501046
_sock_i[i].open = false;

components/wifi/esp8266-driver/ESP8266/ESP8266.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#ifndef ESP8266_H
1818
#define ESP8266_H
1919

20-
#if DEVICE_SERIAL && DEVICE_INTERRUPTIN && defined(MBED_CONF_EVENTS_PRESENT) && defined(MBED_CONF_NSAPI_PRESENT) && defined(MBED_CONF_RTOS_PRESENT)
20+
#if DEVICE_SERIAL && DEVICE_INTERRUPTIN && defined(MBED_CONF_EVENTS_PRESENT) && defined(MBED_CONF_NSAPI_PRESENT) && defined(MBED_CONF_RTOS_API_PRESENT)
2121
#include <stdint.h>
2222

2323
#include "drivers/UARTSerial.h"
@@ -27,8 +27,8 @@
2727
#include "platform/ATCmdParser.h"
2828
#include "platform/Callback.h"
2929
#include "platform/mbed_error.h"
30-
#include "rtos/ConditionVariable.h"
3130
#include "rtos/Mutex.h"
31+
#include "rtos/ThisThread.h"
3232

3333
// Various timeouts for different ESP8266 operations
3434
#ifndef ESP8266_CONNECT_TIMEOUT
@@ -428,7 +428,6 @@ class ESP8266 {
428428
PinName _serial_rts;
429429
PinName _serial_cts;
430430
rtos::Mutex _smutex; // Protect serial port access
431-
rtos::Mutex _rmutex; // Reset protection
432431

433432
// AT Command Parser
434433
mbed::ATCmdParser _parser;
@@ -479,7 +478,6 @@ class ESP8266 {
479478
bool _closed;
480479
bool _error;
481480
bool _busy;
482-
rtos::ConditionVariable _reset_check;
483481
bool _reset_done;
484482

485483
// Modem's address info

components/wifi/esp8266-driver/ESP8266Interface.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
#if DEVICE_SERIAL && DEVICE_INTERRUPTIN && defined(MBED_CONF_EVENTS_PRESENT) && defined(MBED_CONF_NSAPI_PRESENT) && defined(MBED_CONF_RTOS_PRESENT)
17+
#if DEVICE_SERIAL && DEVICE_INTERRUPTIN && defined(MBED_CONF_EVENTS_PRESENT) && defined(MBED_CONF_NSAPI_PRESENT) && defined(MBED_CONF_RTOS_API_PRESENT)
1818

1919
#include <string.h>
2020
#include <stdint.h>
@@ -64,7 +64,9 @@ ESP8266Interface::ESP8266Interface()
6464
_pwr_pin(MBED_CONF_ESP8266_PWR),
6565
_ap_sec(NSAPI_SECURITY_UNKNOWN),
6666
_if_blocking(true),
67+
#if MBED_CONF_RTOS_PRESENT
6768
_if_connected(_cmutex),
69+
#endif
6870
_initialized(false),
6971
_connect_retval(NSAPI_ERROR_OK),
7072
_disconnect_retval(NSAPI_ERROR_OK),
@@ -104,7 +106,9 @@ ESP8266Interface::ESP8266Interface(PinName tx, PinName rx, bool debug, PinName r
104106
_pwr_pin(pwr),
105107
_ap_sec(NSAPI_SECURITY_UNKNOWN),
106108
_if_blocking(true),
109+
#if MBED_CONF_RTOS_PRESENT
107110
_if_connected(_cmutex),
111+
#endif
108112
_initialized(false),
109113
_connect_retval(NSAPI_ERROR_OK),
110114
_disconnect_retval(NSAPI_ERROR_OK),
@@ -267,7 +271,9 @@ void ESP8266Interface::_connect_async()
267271
_esp.uart_enable_input(false);
268272
_software_conn_stat = IFACE_STATUS_DISCONNECTED;
269273
}
274+
#if MBED_CONF_RTOS_PRESENT
270275
_if_connected.notify_all();
276+
#endif
271277
} else {
272278
// Postpone to give other stuff time to run
273279
_connect_event_id = _global_event_queue->call_in(ESP8266_INTERFACE_CONNECT_INTERVAL_MS,
@@ -329,10 +335,12 @@ int ESP8266Interface::connect()
329335
"connect(): unable to add event to queue. Increase \"events.shared-eventsize\"\n");
330336
}
331337

338+
#if MBED_CONF_RTOS_PRESENT
332339
while (_if_blocking && (_conn_status_to_error() != NSAPI_ERROR_IS_CONNECTED)
333340
&& (_connect_retval == NSAPI_ERROR_NO_CONNECTION)) {
334341
_if_connected.wait();
335342
}
343+
#endif
336344

337345
_cmutex.unlock();
338346

@@ -418,7 +426,9 @@ void ESP8266Interface::_disconnect_async()
418426

419427
_power_off();
420428
_software_conn_stat = IFACE_STATUS_DISCONNECTED;
429+
#if MBED_CONF_RTOS_PRESENT
421430
_if_connected.notify_all();
431+
#endif
422432

423433
} else {
424434
// Postpone to give other stuff time to run
@@ -479,11 +489,13 @@ int ESP8266Interface::disconnect()
479489
"disconnect(): unable to add event to queue. Increase \"events.shared-eventsize\"\n");
480490
}
481491

492+
#if MBED_CONF_RTOS_PRESENT
482493
while (_if_blocking
483494
&& (_conn_status_to_error() != NSAPI_ERROR_NO_CONNECTION)
484495
&& (_disconnect_retval != NSAPI_ERROR_OK)) {
485496
_if_connected.wait();
486497
}
498+
#endif
487499

488500
_cmutex.unlock();
489501
if (!_if_blocking) {

components/wifi/esp8266-driver/ESP8266Interface.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#ifndef ESP8266_INTERFACE_H
1818
#define ESP8266_INTERFACE_H
1919

20-
#if DEVICE_SERIAL && DEVICE_INTERRUPTIN && defined(MBED_CONF_EVENTS_PRESENT) && defined(MBED_CONF_NSAPI_PRESENT) && defined(MBED_CONF_RTOS_PRESENT)
20+
#if DEVICE_SERIAL && DEVICE_INTERRUPTIN && defined(MBED_CONF_EVENTS_PRESENT) && defined(MBED_CONF_NSAPI_PRESENT) && defined(MBED_CONF_RTOS_API_PRESENT)
2121
#include "drivers/DigitalOut.h"
2222
#include "drivers/Timer.h"
2323
#include "ESP8266/ESP8266.h"
@@ -30,7 +30,9 @@
3030
#include "features/netsocket/WiFiAccessPoint.h"
3131
#include "features/netsocket/WiFiInterface.h"
3232
#include "platform/Callback.h"
33+
#if MBED_CONF_RTOS_PRESENT
3334
#include "rtos/ConditionVariable.h"
35+
#endif
3436
#include "rtos/Mutex.h"
3537

3638
#define ESP8266_SOCKET_COUNT 5
@@ -452,7 +454,9 @@ class ESP8266Interface : public NetworkStack, public WiFiInterface {
452454
struct _channel_info _ch_info;
453455

454456
bool _if_blocking; // NetworkInterface, blocking or not
457+
#if MBED_CONF_RTOS_PRESENT
455458
rtos::ConditionVariable _if_connected;
459+
#endif
456460

457461
// connect status reporting
458462
nsapi_error_t _conn_status_to_error();

0 commit comments

Comments
 (0)