Skip to content

Commit ae6c7c6

Browse files
author
Cruz Monrreal
authored
Merge pull request #6818 from ARMmbed/release-candidate
Release candidate for mbed-os-5.8.4
2 parents c05d72c + 09132ce commit ae6c7c6

File tree

271 files changed

+21704
-15633
lines changed

Some content is hidden

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

271 files changed

+21704
-15633
lines changed

.github/pull_request_template.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,22 @@
33
<!--
44
Required
55
Add here detailed changes summary, testing results, dependencies
6-
Good example: https://os.mbed.com/docs/latest/reference/guidelines.html#workflow (Pull request template)
6+
Good example: https://os.mbed.com/docs/latest/reference/workflow.html (Pull request template)
77
-->
88

99

1010
### Pull request type
1111

1212
<!--
1313
Required
14-
Please add only one X to one of the following types. Do not fill multiple types (split the pull request otherwise) or
15-
change the layout.
16-
17-
[X] Fix
14+
Please add only one X to one of the following types. Do not fill multiple types (split the pull request otherwise).
15+
Please note this is not a GitHub task list, indenting the boxes or changing the format to add a '.' or '*' in front
16+
of them would change the meaning incorrectly. The only changes to be made are to add a description text under the
17+
description heading and to add a 'x' to the correct box.
18+
-->
19+
[ ] Fix
1820
[ ] Refactor
1921
[ ] New target
2022
[ ] Feature
2123
[ ] Breaking change
22-
-->
2324

24-
[ ] Fix
25-
[ ] Refactor
26-
[ ] New target
27-
[ ] Feature
28-
[ ] Breaking change

TESTS/host_tests/device_echo.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""
2+
mbed SDK
3+
Copyright (c) 2011-2016 ARM Limited
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may 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,
13+
WITHOUT 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+
19+
import uuid
20+
from mbed_host_tests import BaseHostTest
21+
22+
class Device_Echo(BaseHostTest):
23+
24+
def _callback_repeat(self, key, value, _):
25+
self.send_kv(key, value)
26+
27+
def setup(self):
28+
self.register_callback("echo", self._callback_repeat)
29+
self.register_callback("echo_count", self._callback_repeat)
30+
31+
def teardown(self):
32+
pass

TESTS/mbed_drivers/echo/main.cpp

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,28 +21,49 @@
2121
#include "unity/unity.h"
2222
#include "utest/utest.h"
2323

24+
#define PAYLOAD_LENGTH 36
25+
2426
using namespace utest::v1;
2527

28+
// Fill a buffer with a slice of the ASCII alphabet.
29+
void fill_buffer(char* buffer, unsigned int length, unsigned int index) {
30+
unsigned int start = length * index;
31+
for (int i = 0; i < length - 1; i++) {
32+
buffer[i] = 'a' + ((start + i) % 26);
33+
}
34+
buffer[length - 1] = '\0';
35+
}
36+
2637
// Echo server (echo payload to host)
2738
template<int N>
2839
void test_case_echo_server_x() {
2940
char _key[11] = {};
30-
char _value[128] = {};
41+
char _tx_value[PAYLOAD_LENGTH + 1] = {};
42+
char _rx_value[PAYLOAD_LENGTH + 1] = {};
3143
const int echo_count = N;
32-
const char _key_const[] = "echo_count";
44+
const char _echo_count_key_const[] = "echo_count";
45+
const char _echo_key_const[] = "echo";
3346
int expected_key = 1;
3447

35-
greentea_send_kv(_key_const, echo_count);
48+
// Send up the echo count
49+
greentea_send_kv(_echo_count_key_const, echo_count);
3650
// Handshake with host
3751
do {
38-
greentea_parse_kv(_key, _value, sizeof(_key), sizeof(_value));
39-
expected_key = strcmp(_key_const, _key);
52+
greentea_parse_kv(_key, _rx_value, sizeof(_key), sizeof(_rx_value));
53+
// Ensure the key received is "echo_count" and not some old data
54+
expected_key = strcmp(_echo_count_key_const, _key);
4055
} while (expected_key);
41-
TEST_ASSERT_EQUAL_INT(echo_count, atoi(_value));
56+
TEST_ASSERT_EQUAL_INT(echo_count, atoi(_rx_value));
4257

4358
for (int i=0; i < echo_count; ++i) {
44-
greentea_parse_kv(_key, _value, sizeof(_key), sizeof(_value));
45-
greentea_send_kv(_key, _value);
59+
fill_buffer(_tx_value, PAYLOAD_LENGTH, i);
60+
greentea_send_kv(_echo_key_const, _tx_value);
61+
do {
62+
greentea_parse_kv(_key, _rx_value, sizeof(_key), sizeof(_rx_value));
63+
// Ensure the key received is "echo" and not some old data
64+
expected_key = strcmp(_echo_key_const, _key);
65+
} while (expected_key);
66+
TEST_ASSERT(strncmp(_tx_value, _rx_value, PAYLOAD_LENGTH) == 0);
4667
}
4768
}
4869

@@ -56,7 +77,7 @@ Case cases[] = {
5677
};
5778

5879
utest::v1::status_t greentea_test_setup(const size_t number_of_cases) {
59-
GREENTEA_SETUP(30, "echo");
80+
GREENTEA_SETUP(30, "device_echo");
6081
return greentea_test_setup_handler(number_of_cases);
6182
}
6283

TESTS/mbed_hal/flash/functional_tests/main.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@
2828
using namespace utest::v1;
2929

3030
#define TEST_CYCLES 10000000
31+
32+
#ifdef TARGET_NRF52
33+
/* The increased tolerance is to account for the imprecise timers on the NRF52. */
34+
#define ALLOWED_DRIFT_PPM (1000000/50000) //5.0%
35+
#else
3136
#define ALLOWED_DRIFT_PPM (1000000/5000) //0.5%
37+
#endif
3238

3339
/*
3440
return values to be checked are documented at:
@@ -279,9 +285,7 @@ Case cases[] = {
279285
Case("Flash - erase sector", flash_erase_sector_test),
280286
Case("Flash - program page", flash_program_page_test),
281287
Case("Flash - buffer alignment test", flash_buffer_alignment_test),
282-
#ifndef MCU_NRF52
283288
Case("Flash - clock and cache test", flash_clock_and_cache_test),
284-
#endif
285289
};
286290

287291
utest::v1::status_t greentea_test_setup(const size_t number_of_cases) {

doxygen_options.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
"PREDEFINED": "DOXYGEN_ONLY DEVICE_ANALOGIN DEVICE_ANALOGOUT DEVICE_CAN DEVICE_ETHERNET DEVICE_EMAC DEVICE_FLASH DEVICE_I2C DEVICE_I2CSLAVE DEVICE_I2C_ASYNCH DEVICE_INTERRUPTIN DEVICE_ITM DEVICE_LOWPOWERTIMER DEVICE_PORTIN DEVICE_PORTINOUT DEVICE_PORTOUT DEVICE_PWMOUT DEVICE_RTC DEVICE_TRNG DEVICE_SERIAL DEVICE_SERIAL_ASYNCH DEVICE_SERIAL_FC DEVICE_SLEEP DEVICE_SPI DEVICE_SPI_ASYNCH DEVICE_SPISLAVE DEVICE_STORAGE \"MBED_DEPRECATED_SINCE(f, g)=\" \"MBED_ENABLE_IF_CALLBACK_COMPATIBLE(F, M)=\" \"MBED_DEPRECATED(s)=\"",
1010
"EXPAND_AS_DEFINED": "",
1111
"SKIP_FUNCTION_MACROS": "NO",
12+
"STRIP_CODE_COMMENTS": "NO",
1213
"EXCLUDE_PATTERNS": "*/tools/* */targets/* */features/mbedtls/* */features/storage/* */features/unsupported/* */BUILD/* */rtos/TARGET_CORTEX/rtx*/* */cmsis/* */features/FEATURE_COMMON_PAL/* */features/FEATURE_LWIP/* */features/FEATURE_UVISOR/* */features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/* */features/nanostack/FEATURE_NANOSTACK/coap-service/* */ble/generic/* */ble/pal/*"
1314
}

drivers/UARTSerial.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,12 +305,11 @@ void UARTSerial::rx_irq(void)
305305
void UARTSerial::tx_irq(void)
306306
{
307307
bool was_full = _txbuf.full();
308+
char data;
308309

309310
/* Write to the peripheral if there is something to write
310311
* and if the peripheral is available to write. */
311-
while (!_txbuf.empty() && SerialBase::writeable()) {
312-
char data;
313-
_txbuf.pop(data);
312+
while (SerialBase::writeable() && _txbuf.pop(data)) {
314313
SerialBase::_base_putc(data);
315314
}
316315

features/FEATURE_COMMON_PAL/nanostack-hal-mbed-cmsis-rtos/mbed_lib.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"value": false
77
},
88
"event_loop_thread_stack_size": {
9-
"help": "Define event-loop thread stack size.",
9+
"help": "Define event-loop thread stack size. [bytes]",
1010
"value": 6144
1111
},
1212
"critical-section-usable-from-interrupt": {

features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_NXP/TARGET_LPCTarget/lpc17_emac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ static err_t lpc_low_level_output(struct netif *netif, struct pbuf *p)
611611
/* Wait until enough descriptors are available for the transfer. */
612612
/* THIS WILL BLOCK UNTIL THERE ARE ENOUGH DESCRIPTORS AVAILABLE */
613613
#if NO_SYS == 0
614-
for (idx = 0; idx < dn; idx++) {
614+
for (s32_t count = 0; count < dn; count++) {
615615
osSemaphoreAcquire(lpc_enetif->xTXDCountSem.id, osWaitForever);
616616
}
617617
MBED_ASSERT(dn <= lpc_tx_ready(netif));

features/filesystem/littlefs/littlefs/lfs.c

Lines changed: 30 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -783,26 +783,19 @@ static int lfs_dir_find(lfs_t *lfs, lfs_dir_t *dir,
783783
lfs_entry_t *entry, const char **path) {
784784
const char *pathname = *path;
785785
size_t pathlen;
786+
entry->d.type = LFS_TYPE_DIR;
787+
entry->d.elen = sizeof(entry->d) - 4;
788+
entry->d.alen = 0;
789+
entry->d.nlen = 0;
790+
entry->d.u.dir[0] = lfs->root[0];
791+
entry->d.u.dir[1] = lfs->root[1];
786792

787793
while (true) {
788-
nextname:
794+
nextname:
789795
// skip slashes
790796
pathname += strspn(pathname, "/");
791797
pathlen = strcspn(pathname, "/");
792798

793-
// special case for root dir
794-
if (pathname[0] == '\0') {
795-
*entry = (lfs_entry_t){
796-
.d.type = LFS_TYPE_DIR,
797-
.d.elen = sizeof(entry->d) - 4,
798-
.d.alen = 0,
799-
.d.nlen = 0,
800-
.d.u.dir[0] = lfs->root[0],
801-
.d.u.dir[1] = lfs->root[1],
802-
};
803-
return 0;
804-
}
805-
806799
// skip '.' and root '..'
807800
if ((pathlen == 1 && memcmp(pathname, ".", 1) == 0) ||
808801
(pathlen == 2 && memcmp(pathname, "..", 2) == 0)) {
@@ -834,10 +827,25 @@ static int lfs_dir_find(lfs_t *lfs, lfs_dir_t *dir,
834827
suffix += sufflen;
835828
}
836829

830+
// found path
831+
if (pathname[0] == '\0') {
832+
return 0;
833+
}
834+
837835
// update what we've found
838836
*path = pathname;
839837

840-
// find path
838+
// continue on if we hit a directory
839+
if (entry->d.type != LFS_TYPE_DIR) {
840+
return LFS_ERR_NOTDIR;
841+
}
842+
843+
int err = lfs_dir_fetch(lfs, dir, entry->d.u.dir);
844+
if (err) {
845+
return err;
846+
}
847+
848+
// find entry matching name
841849
while (true) {
842850
int err = lfs_dir_next(lfs, dir, entry);
843851
if (err) {
@@ -873,21 +881,8 @@ static int lfs_dir_find(lfs_t *lfs, lfs_dir_t *dir,
873881
entry->d.type &= ~0x80;
874882
}
875883

884+
// to next name
876885
pathname += pathlen;
877-
pathname += strspn(pathname, "/");
878-
if (pathname[0] == '\0') {
879-
return 0;
880-
}
881-
882-
// continue on if we hit a directory
883-
if (entry->d.type != LFS_TYPE_DIR) {
884-
return LFS_ERR_NOTDIR;
885-
}
886-
887-
int err = lfs_dir_fetch(lfs, dir, entry->d.u.dir);
888-
if (err) {
889-
return err;
890-
}
891886
}
892887
}
893888

@@ -904,13 +899,8 @@ int lfs_mkdir(lfs_t *lfs, const char *path) {
904899

905900
// fetch parent directory
906901
lfs_dir_t cwd;
907-
int err = lfs_dir_fetch(lfs, &cwd, lfs->root);
908-
if (err) {
909-
return err;
910-
}
911-
912902
lfs_entry_t entry;
913-
err = lfs_dir_find(lfs, &cwd, &entry, &path);
903+
int err = lfs_dir_find(lfs, &cwd, &entry, &path);
914904
if (err != LFS_ERR_NOENT || strchr(path, '/') != NULL) {
915905
return err ? err : LFS_ERR_EXIST;
916906
}
@@ -954,13 +944,8 @@ int lfs_dir_open(lfs_t *lfs, lfs_dir_t *dir, const char *path) {
954944
dir->pair[0] = lfs->root[0];
955945
dir->pair[1] = lfs->root[1];
956946

957-
int err = lfs_dir_fetch(lfs, dir, dir->pair);
958-
if (err) {
959-
return err;
960-
}
961-
962947
lfs_entry_t entry;
963-
err = lfs_dir_find(lfs, dir, &entry, &path);
948+
int err = lfs_dir_find(lfs, dir, &entry, &path);
964949
if (err) {
965950
return err;
966951
} else if (entry.d.type != LFS_TYPE_DIR) {
@@ -1302,13 +1287,8 @@ int lfs_file_open(lfs_t *lfs, lfs_file_t *file,
13021287

13031288
// allocate entry for file if it doesn't exist
13041289
lfs_dir_t cwd;
1305-
int err = lfs_dir_fetch(lfs, &cwd, lfs->root);
1306-
if (err) {
1307-
return err;
1308-
}
1309-
13101290
lfs_entry_t entry;
1311-
err = lfs_dir_find(lfs, &cwd, &entry, &path);
1291+
int err = lfs_dir_find(lfs, &cwd, &entry, &path);
13121292
if (err && (err != LFS_ERR_NOENT || strchr(path, '/') != NULL)) {
13131293
return err;
13141294
}
@@ -1814,13 +1794,8 @@ lfs_soff_t lfs_file_size(lfs_t *lfs, lfs_file_t *file) {
18141794
/// General fs operations ///
18151795
int lfs_stat(lfs_t *lfs, const char *path, struct lfs_info *info) {
18161796
lfs_dir_t cwd;
1817-
int err = lfs_dir_fetch(lfs, &cwd, lfs->root);
1818-
if (err) {
1819-
return err;
1820-
}
1821-
18221797
lfs_entry_t entry;
1823-
err = lfs_dir_find(lfs, &cwd, &entry, &path);
1798+
int err = lfs_dir_find(lfs, &cwd, &entry, &path);
18241799
if (err) {
18251800
return err;
18261801
}
@@ -1855,13 +1830,8 @@ int lfs_remove(lfs_t *lfs, const char *path) {
18551830
}
18561831

18571832
lfs_dir_t cwd;
1858-
int err = lfs_dir_fetch(lfs, &cwd, lfs->root);
1859-
if (err) {
1860-
return err;
1861-
}
1862-
18631833
lfs_entry_t entry;
1864-
err = lfs_dir_find(lfs, &cwd, &entry, &path);
1834+
int err = lfs_dir_find(lfs, &cwd, &entry, &path);
18651835
if (err) {
18661836
return err;
18671837
}
@@ -1916,24 +1886,14 @@ int lfs_rename(lfs_t *lfs, const char *oldpath, const char *newpath) {
19161886

19171887
// find old entry
19181888
lfs_dir_t oldcwd;
1919-
int err = lfs_dir_fetch(lfs, &oldcwd, lfs->root);
1920-
if (err) {
1921-
return err;
1922-
}
1923-
19241889
lfs_entry_t oldentry;
1925-
err = lfs_dir_find(lfs, &oldcwd, &oldentry, &oldpath);
1890+
int err = lfs_dir_find(lfs, &oldcwd, &oldentry, &oldpath);
19261891
if (err) {
19271892
return err;
19281893
}
19291894

19301895
// allocate new entry
19311896
lfs_dir_t newcwd;
1932-
err = lfs_dir_fetch(lfs, &newcwd, lfs->root);
1933-
if (err) {
1934-
return err;
1935-
}
1936-
19371897
lfs_entry_t preventry;
19381898
err = lfs_dir_find(lfs, &newcwd, &preventry, &newpath);
19391899
if (err && (err != LFS_ERR_NOENT || strchr(newpath, '/') != NULL)) {

0 commit comments

Comments
 (0)