Skip to content

Commit 367dbdf

Browse files
authored
Merge pull request #6950 from ARMmbed/release-candidate
Release candidate for mbed-os-5.8.5
2 parents ae6c7c6 + a48d231 commit 367dbdf

File tree

229 files changed

+7092
-5938
lines changed

Some content is hidden

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

229 files changed

+7092
-5938
lines changed

.github/issue_template.md

Lines changed: 29 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,31 @@
1-
Note: This is just a template, so feel free to use/remove the unnecessary things
2-
31
### Description
4-
- Type: Bug | Enhancement | Question
5-
- Related issue: `#abc`
6-
- Priority: Blocker | Major | Minor
7-
8-
---------------------------------------------------------------
9-
## Bug
10-
11-
**Target**
12-
K64F|??
13-
14-
**Toolchain:**
15-
GCC_ARM|ARM|IAR
16-
17-
**Toolchain version:**
18-
19-
**mbed-cli version:**
20-
(`mbed --version`)
21-
22-
**mbed-os sha:**
23-
(`git log -n1 --oneline`)
24-
25-
**DAPLink version:**
26-
27-
**Expected behavior**
28-
29-
**Actual behavior**
30-
31-
**Steps to reproduce**
32-
33-
----------------------------------------------------------------
34-
## Enhancement
35-
36-
**Reason to enhance or problem with existing solution**
37-
38-
**Suggested enhancement**
39-
40-
**Pros**
41-
42-
**Cons**
43-
44-
-----------------------------------------------------------------
45-
46-
## Question
2+
<!--
3+
Required
4+
Add detailed description of what you are reporting.
5+
Good example: https://os.mbed.com/docs/latest/reference/workflow.html
6+
Things to consider sharing:
7+
- What target does this relate to?
8+
- What toolchain (name + version) are you using?
9+
- What tools (name + version - is it mbed-cli, online compiler or IDE) are you using?
10+
- What is the SHA of Mbed OS (git log -n1 --oneline)?
11+
- Steps to reproduce. (Did you publish code or a test case that exhibits the problem?)
12+
-->
13+
14+
15+
### Issue request type
16+
<!--
17+
Required
18+
Please add only one X to one of the following types. Do not fill multiple types. (Split the issue otherwise.)
19+
Please note this is not a GitHub task list; indenting the boxes or changing the format to add a '.' or '*' in front
20+
of them changes the meaning incorrectly. The only changes to make are to add a description under the
21+
description heading and to add an 'x' to the correct box.
22+
23+
[X] Question
24+
[ ] Enhancement
25+
[ ] Bug
26+
-->
27+
28+
[ ] Question
29+
[ ] Enhancement
30+
[ ] Bug
4731

48-
**How to?**

TESTS/mbed_drivers/flashiap/main.cpp

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "utest/utest.h"
2323
#include "unity/unity.h"
2424
#include "greentea-client/test_env.h"
25+
#include <algorithm>
2526

2627
#include "mbed.h"
2728

@@ -48,10 +49,10 @@ void flashiap_program_test()
4849
TEST_ASSERT_NOT_EQUAL(0, sector_size);
4950
TEST_ASSERT_NOT_EQUAL(0, page_size);
5051
TEST_ASSERT_TRUE(sector_size % page_size == 0);
51-
const uint8_t test_value = 0xCE;
52-
uint8_t *data = new uint8_t[page_size];
53-
for (uint32_t i = 0; i < page_size; i++) {
54-
data[i] = test_value;
52+
uint32_t prog_size = std::max(page_size, (uint32_t)8);
53+
uint8_t *data = new uint8_t[prog_size + 2];
54+
for (uint32_t i = 0; i < prog_size + 2; i++) {
55+
data[i] = i;
5556
}
5657

5758
// the one before the last sector in the system
@@ -61,19 +62,29 @@ void flashiap_program_test()
6162
TEST_ASSERT_EQUAL_INT32(0, ret);
6263

6364

64-
for (uint32_t i = 0; i < sector_size / page_size; i++) {
65-
uint32_t page_addr = address + i * page_size;
66-
ret = flash_device.program(data, page_addr, page_size);
65+
for (uint32_t i = 0; i < sector_size / prog_size; i++) {
66+
uint32_t prog_addr = address + i * prog_size;
67+
ret = flash_device.program(data, prog_addr, prog_size);
6768
TEST_ASSERT_EQUAL_INT32(0, ret);
6869
}
6970

70-
uint8_t *data_flashed = new uint8_t[page_size];
71-
for (uint32_t i = 0; i < sector_size / page_size; i++) {
72-
uint32_t page_addr = address + i * page_size;
73-
ret = flash_device.read(data_flashed, page_addr, page_size);
71+
uint8_t *data_flashed = new uint8_t[prog_size];
72+
for (uint32_t i = 0; i < sector_size / prog_size; i++) {
73+
uint32_t page_addr = address + i * prog_size;
74+
ret = flash_device.read(data_flashed, page_addr, prog_size);
7475
TEST_ASSERT_EQUAL_INT32(0, ret);
75-
TEST_ASSERT_EQUAL_UINT8_ARRAY(data, data_flashed, page_size);
76+
TEST_ASSERT_EQUAL_UINT8_ARRAY(data, data_flashed, prog_size);
7677
}
78+
79+
// check programming of unaligned buffer and size
80+
ret = flash_device.erase(address, sector_size);
81+
TEST_ASSERT_EQUAL_INT32(0, ret);
82+
ret = flash_device.program(data + 2, address, prog_size);
83+
TEST_ASSERT_EQUAL_INT32(0, ret);
84+
ret = flash_device.read(data_flashed, address, prog_size - 1);
85+
TEST_ASSERT_EQUAL_INT32(0, ret);
86+
TEST_ASSERT_EQUAL_UINT8_ARRAY(data + 2, data_flashed, prog_size - 1);
87+
7788
delete[] data;
7889
delete[] data_flashed;
7990

TESTS/mbed_drivers/rtc/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ void test_attach_RTC_stub_funtions()
144144
TEST_ASSERT_EQUAL(false, rtc_init_called);
145145

146146
/* Check if time has been successfully set and retrieved. */
147-
TEST_ASSERT_EQUAL(CUSTOM_TIME_1, seconds);
147+
TEST_ASSERT_UINT32_WITHIN(RTC_DELTA, CUSTOM_TIME_1, seconds);
148148
}
149149

150150
/* This test verifies if attach_rtc provides availability to
@@ -183,7 +183,7 @@ void test_attach_RTC_org_funtions()
183183
TEST_ASSERT_EQUAL(false, rtc_init_called);
184184

185185
/* Check if time has been successfully set and retrieved. */
186-
TEST_ASSERT_EQUAL(CUSTOM_TIME_1, seconds);
186+
TEST_ASSERT_UINT32_WITHIN(RTC_DELTA, CUSTOM_TIME_1, seconds);
187187
}
188188

189189
/* This test verifies if time() function returns
@@ -430,7 +430,7 @@ void test_functional_set()
430430
set_time(timeValue);
431431

432432
/* Get current time and verify that new value has been set. */
433-
TEST_ASSERT_EQUAL(timeValue, time(NULL));
433+
TEST_ASSERT_UINT32_WITHIN(1, timeValue, time(NULL));
434434
}
435435

436436
/* This test verifies if RTC counts seconds.

drivers/FlashIAP.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,18 @@ int FlashIAP::program(const void *buffer, uint32_t addr, uint32_t size)
107107
_mutex->lock();
108108
while (size) {
109109
uint32_t current_sector_size = flash_get_sector_size(&_flash, addr);
110+
bool unaligned_src = (((size_t) buf / sizeof(uint32_t) * sizeof(uint32_t)) != (size_t) buf);
110111
chunk = std::min(current_sector_size - (addr % current_sector_size), size);
111-
if (chunk < page_size) {
112+
// Need to use the internal page buffer in any of these two cases:
113+
// 1. Size is not page aligned
114+
// 2. Source buffer is not aligned to uint32_t. This is not supported by many targets (although
115+
// the pointer they accept is of uint8_t).
116+
if (unaligned_src || (chunk < page_size)) {
117+
chunk = std::min(chunk, page_size);
112118
memcpy(_page_buf, buf, chunk);
113-
memset(_page_buf + chunk, 0xFF, page_size - chunk);
119+
if (chunk < page_size) {
120+
memset(_page_buf + chunk, 0xFF, page_size - chunk);
121+
}
114122
prog_buf = _page_buf;
115123
prog_size = page_size;
116124
} else {

features/FEATURE_BLE/ble/generic/GenericSecurityManager.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,8 @@ class GenericSecurityManager : public SecurityManager,
354354
* @return true if cryptography functioned worked
355355
*/
356356
static bool crypto_toolbox_f4(
357-
const public_key_t &U,
358-
const public_key_t &V,
357+
const public_key_coord_t &U,
358+
const public_key_coord_t &V,
359359
const oob_lesc_value_t &X,
360360
oob_confirm_t &confirm
361361
);

features/FEATURE_BLE/source/generic/GenericGattClient.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ struct GenericGattClient::DiscoveryControlBlock : public ProcedureControlBlock {
147147
const AttErrorResponse& error = static_cast<const AttErrorResponse&>(message);
148148
if (error.error_code != AttErrorResponse::ATTRIBUTE_NOT_FOUND) {
149149
terminate(client);
150+
return;
150151
}
151152

152153
switch (error.request_opcode) {

features/FEATURE_BLE/targets/TARGET_CORDIO/doc/PortingGuide.md

Lines changed: 4 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -37,37 +37,6 @@ property of the target.
3737
}
3838
```
3939

40-
### Include prebuilt libraries
41-
42-
Last, the target shall also include the cordio libraries into the build.
43-
44-
Four prebuilt libraries are provided:
45-
* `wscore`: which contains the base component used by the Cordio stack.
46-
* `wsstack`: The BLE stack itself, if contains the GAP and GATT layer as well as
47-
the Security manager implementation.
48-
* `wssec`: The low level implementation of the security layer.
49-
* `wshci`: The HCI layer.
50-
51-
The `wssec` and `wshci` libraries are delivered in feature folders. It allows
52-
vendors to override those library if necessary. This can be required if the port
53-
use specific crypto routine or require an highly modified HCI layer.
54-
55-
To include the default library in the target, the features have to be added in
56-
this list of the features of the target:
57-
* `WSSEC`: Include the default `wssec` library.
58-
* `WSHCI`: Include the default `wshci` library.
59-
60-
The target should also compile the sources of the BLE Cordio port. It is
61-
achieved by adding the string `CORDIO` in the list of the `extra_labels`
62-
property of the target.
63-
64-
```json
65-
"TARGET_NAME": {
66-
"extra_labels": ["target extra labels ...", "CORDIO"],
67-
"features": ["target features ...", "BLE", "WSHCI", "WSSEC"]
68-
}
69-
```
70-
7140
## CordioHCIDriver implementation:
7241

7342
A port shall include an HCI driver for the BLE module used by the target and
@@ -93,8 +62,10 @@ More information about the architecture can be found in the
9362

9463
#### HCITransport
9564

96-
> **Note:** If the Bluetooth controller uses an H4 communication interface, this
97-
step can be skipped.
65+
> **Note:** If the Bluetooth controller uses an H4 communication interface and
66+
the host exposes serial flow control in mbed then this step can be skipped and
67+
the class `ble::vendor::cordio::H4TransportDriver` can be used as the transport
68+
driver.
9869

9970
An empty transport driver can be coded as:
10071

@@ -518,22 +489,6 @@ ble::vendor::cordio::CordioHCIDriver& ble_cordio_get_hci_driver() {
518489
}
519490
```
520491

521-
## Examples
522-
523-
Implementation examples might be found for:
524-
* [ST BlueNRG module](../../TARGET_NUCLEO_F401RE/BlueNrgHCIDriver.cpp): It uses
525-
a custom transport driver and a vendor specific is sent right after the answer
526-
to the reset command to switch the controller to link layer mode only.
527-
* [EM9301 module](../../TARGET_Maxim/TARGET_MAX32620HSP/EM9301HCIDriver.cpp):
528-
it uses a custom transport driver and doesn't doesn't send the command *Set
529-
Event Mask Page 2* to the controller during the reset sequence because this
530-
command is not supported by the controller.
531-
* [PAN1326](../../TARGET_Maxim/TARGET_MAX32630FTHR/CC2564HCIDriver.cpp): It
532-
uses the H4 transport driver. The reset sequence start by sending a
533-
*service pack* then once the service pack has been transferred it continue
534-
with the regular reset sequence.
535-
536-
537492

538493

539494

features/FEATURE_BLE/targets/TARGET_CORDIO/driver/H4TransportDriver.cpp

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

17+
#if DEVICE_SERIAL && DEVICE_SERIAL_FC
18+
1719
#include "H4TransportDriver.h"
1820

1921
namespace ble {
@@ -68,3 +70,5 @@ void H4TransportDriver::on_controller_irq()
6870
} // namespace cordio
6971
} // namespace vendor
7072
} // namespace ble
73+
74+
#endif

features/FEATURE_BLE/targets/TARGET_CORDIO/driver/H4TransportDriver.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#ifndef CORDIO_H4_TRANSPORT_DRIVER_H_
1818
#define CORDIO_H4_TRANSPORT_DRIVER_H_
1919

20+
#if (DEVICE_SERIAL && DEVICE_SERIAL_FC) || defined(DOXYGEN_ONLY)
21+
2022
#include <stdint.h>
2123
#include "mbed.h"
2224
#include "CordioHCITransportDriver.h"
@@ -27,6 +29,9 @@ namespace cordio {
2729

2830
/**
2931
* Implementation of the H4 driver.
32+
*
33+
* @note This HCI transport implementation is not accessible to devices that do
34+
* not expose serial flow control.
3035
*/
3136
class H4TransportDriver : public CordioHCITransportDriver {
3237
public:
@@ -73,4 +78,6 @@ class H4TransportDriver : public CordioHCITransportDriver {
7378
} // namespace vendor
7479
} // namespace ble
7580

81+
#endif
82+
7683
#endif /* CORDIO_H4_TRANSPORT_DRIVER_H_ */

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/hal_patch/critical_section_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void hal_critical_section_exit(void)
7272

7373
// Restore the state as it was prior to entering the critical section.
7474
if (_use_softdevice_routine) {
75-
sd_nvic_critical_region_exit(_state._sd_state)
75+
sd_nvic_critical_region_exit(_state._sd_state);
7676
} else {
7777
__set_PRIMASK(_state._PRIMASK_state);
7878
}

0 commit comments

Comments
 (0)