Skip to content

Commit dd2d159

Browse files
authored
Merge pull request #8083 from ARMmbed/release-candidate
Release candidate for mbed-os-5.10.0-rc2
2 parents 3fb5781 + 4599726 commit dd2d159

File tree

77 files changed

+2364
-446
lines changed

Some content is hidden

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

77 files changed

+2364
-446
lines changed

TESTS/netsocket/README.md

Lines changed: 1666 additions & 0 deletions
Large diffs are not rendered by default.

TESTS/netsocket/eth_environment.png

139 KB
Loading

TESTS/netsocket/wifi_environment.png

126 KB
Loading

TEST_APPS/readme.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ You need Icetea and mbed-cli that supports Icetea, installed.
2121

2222
Depending on a device, there might be a default network interface type defined in the mbed-os/targets/targets.json, which is used to locate a test-config file by default.
2323
If there is not, or you want to use a different interface than the default, you need to provide a relevant test-config -file to the mbed test with --test-config option.
24-
The test-config file contains the necessary information for the test application, there are some test-config files located under mbed-os/tools/test-configs.
25-
Devices which have their network drivers residing inside mbed-os can use generic test-configs like HeapBlockDeviceAndEthernetInterface.json and HeapBlockDeviceAndWifiInterface.json. Otherwise you need to use a device specific test-config.
24+
The test-config file contains the necessary information for the test application, there are some test-config files located under mbed-os/tools/test_configs.
25+
Devices which have their network drivers residing inside mbed-os can use generic test_configs like HeapBlockDeviceAndEthernetInterface.json and HeapBlockDeviceAndWifiInterface.json. Otherwise you need to use a device specific test-config.
2626

2727
### Running the tests
2828

@@ -42,10 +42,10 @@ Some devices may offer multiple network interfaces to operate with. For example,
4242
The tests can be run for either one of those using already existing test-config -files.
4343

4444
To run the tests with Wi-Fi interface:
45-
`>mbed test -m UBLOX_EVK_ODIN_W2 -t <toolchain> --icetea --test-config tools/test-configs/HeapBlockDeviceAndWifiInterface.json`
45+
`>mbed test -m UBLOX_EVK_ODIN_W2 -t <toolchain> --icetea --test-config tools/test_configs/HeapBlockDeviceAndWifiInterface.json`
4646

4747
To run the tests with ethernet interface:
48-
`>mbed test -m UBLOX_EVK_ODIN_W2 -t <toolchain> --icetea --test-config tools/test-configs/HeapBlockDeviceAndEthernetInterface.json`
48+
`>mbed test -m UBLOX_EVK_ODIN_W2 -t <toolchain> --icetea --test-config tools/test_configs/HeapBlockDeviceAndEthernetInterface.json`
4949

5050
#### Providing Wi-Fi access point information
5151

UNITTESTS/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,17 @@ pip install "gcovr>=4.1"
6969

7070
> In case of running into problems see [troubleshooting](#troubleshooting) section.
7171
72-
`UNITTESTS/mbed_unittest.py` contains testing scripts for Mbed OS unit testing. Mbed CLI supports unit testing through `mbed unittest` command with the same arguments.
72+
`UNITTESTS/mbed_unittest.py` contains testing scripts for Mbed OS unit testing. Mbed CLI supports unit testing through `mbed test --unittests` command with the same arguments.
7373

7474
### Testing with Mbed CLI
7575

7676
```
77-
mbed unittest
77+
mbed test --unittests
7878
```
7979

8080
A subset of tests can be run by providing `-r` flag for the tool which runs tests matching a regular expression.
8181

82-
e.g. `mbed unittest --run -r features_netsocket`
82+
e.g. `mbed test --unittests --run -r features_netsocket`
8383

8484
### Build manually without Python tools
8585

@@ -144,7 +144,7 @@ Run ctest dashboard test and create test results:
144144

145145
Python tools use gcovr to build code coverage reports. Generate html report `UNITTESTS/build/coverage/index.html` with:
146146
```
147-
mbed unittest --coverage html
147+
mbed test --unittests --coverage html
148148
```
149149

150150
To get coverage for a single test suite, run gcovr separately for suite coverage data directory. See [gcovr documentation](https://gcovr.com/guide.html#filter-options) for more information.
@@ -211,10 +211,10 @@ A unit test definition file `unittest.cmake` requires variables to be set for a
211211
#### Creating unit tests files with Mbed CLI
212212

213213
```
214-
mbed unittest --new <FILEPATH>
214+
mbed test --unittests --new <FILEPATH>
215215
```
216216

217-
E.g. `mbed unittest --new rtos/Semaphore.cpp`
217+
E.g. `mbed test --unittests --new rtos/Semaphore.cpp`
218218

219219
The generator script only creates the files required for a unit test. It does not write unit tests automatically nor does it handle source dependencies.
220220

UNITTESTS/stubs/Mutex_stub.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ rtos::Mutex::~Mutex()
2727
return;
2828
}
2929

30-
osStatus rtos::Mutex::lock(unsigned int)
30+
osStatus rtos::Mutex::lock(void)
31+
{
32+
return osOK;
33+
}
34+
35+
osStatus rtos::Mutex::lock(uint32_t millisec)
3136
{
3237
return osOK;
3338
}

drivers/MbedCRC.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ MbedCRC<POLY_32BIT_ANSI, 32>::MbedCRC():
3434
mbed_crc_ctor();
3535
}
3636

37+
template<>
38+
MbedCRC<POLY_32BIT_REV_ANSI, 32>::MbedCRC():
39+
_initial_value(~(0x0)), _final_xor(~(0x0)), _reflect_data(false), _reflect_remainder(false),
40+
_crc_table((uint32_t *)Table_CRC_32bit_Rev_ANSI)
41+
{
42+
mbed_crc_ctor();
43+
}
44+
3745
template<>
3846
MbedCRC<POLY_16BIT_IBM, 16>::MbedCRC():
3947
_initial_value(0), _final_xor(0), _reflect_data(true), _reflect_remainder(true),

drivers/MbedCRC.h

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ class MbedCRC {
275275
p_crc = (uint32_t)(p_crc << (8 - width));
276276
}
277277
// Optimized algorithm for 32BitANSI does not need additional reflect_remainder
278-
if ((TABLE == _mode) && (POLY_32BIT_ANSI == polynomial)) {
278+
if ((TABLE == _mode) && (POLY_32BIT_REV_ANSI == polynomial)) {
279279
*crc = (p_crc ^ _final_xor) & get_crc_mask();
280280
} else {
281281
*crc = (reflect_remainder(p_crc) ^ _final_xor) & get_crc_mask();
@@ -415,7 +415,6 @@ class MbedCRC {
415415
int32_t bitwise_compute_partial(const void *buffer, crc_data_size_t size, uint32_t *crc) const
416416
{
417417
MBED_ASSERT(crc != NULL);
418-
MBED_ASSERT(buffer != NULL);
419418

420419
const uint8_t *data = static_cast<const uint8_t *>(buffer);
421420
uint32_t p_crc = *crc;
@@ -460,7 +459,6 @@ class MbedCRC {
460459
int32_t table_compute_partial(const void *buffer, crc_data_size_t size, uint32_t *crc) const
461460
{
462461
MBED_ASSERT(crc != NULL);
463-
MBED_ASSERT(buffer != NULL);
464462

465463
const uint8_t *data = static_cast<const uint8_t *>(buffer);
466464
uint32_t p_crc = *crc;
@@ -480,9 +478,17 @@ class MbedCRC {
480478
}
481479
} else {
482480
uint32_t *crc_table = (uint32_t *)_crc_table;
483-
for (crc_data_size_t i = 0; i < size; i++) {
484-
p_crc = (p_crc >> 4) ^ crc_table[(p_crc ^ (data[i] >> 0)) & 0xf];
485-
p_crc = (p_crc >> 4) ^ crc_table[(p_crc ^ (data[i] >> 4)) & 0xf];
481+
if (POLY_32BIT_REV_ANSI == polynomial) {
482+
for (crc_data_size_t i = 0; i < size; i++) {
483+
p_crc = (p_crc >> 4) ^ crc_table[(p_crc ^ (data[i] >> 0)) & 0xf];
484+
p_crc = (p_crc >> 4) ^ crc_table[(p_crc ^ (data[i] >> 4)) & 0xf];
485+
}
486+
}
487+
else {
488+
for (crc_data_size_t byte = 0; byte < size; byte++) {
489+
data_byte = reflect_bytes(data[byte]) ^ (p_crc >> (width - 8));
490+
p_crc = crc_table[data_byte] ^ (p_crc << 8);
491+
}
486492
}
487493
}
488494
*crc = p_crc & get_crc_mask();
@@ -497,6 +503,11 @@ class MbedCRC {
497503
MBED_STATIC_ASSERT(width <= 32, "Max 32-bit CRC supported");
498504

499505
#ifdef DEVICE_CRC
506+
if (POLY_32BIT_REV_ANSI == polynomial) {
507+
_crc_table = (uint32_t *)Table_CRC_32bit_Rev_ANSI;
508+
_mode = TABLE;
509+
return;
510+
}
500511
crc_mbed_config_t config;
501512
config.polynomial = polynomial;
502513
config.width = width;
@@ -510,10 +521,14 @@ class MbedCRC {
510521
return;
511522
}
512523
#endif
524+
513525
switch (polynomial) {
514526
case POLY_32BIT_ANSI:
515527
_crc_table = (uint32_t *)Table_CRC_32bit_ANSI;
516528
break;
529+
case POLY_32BIT_REV_ANSI:
530+
_crc_table = (uint32_t *)Table_CRC_32bit_Rev_ANSI;
531+
break;
517532
case POLY_8BIT_CCITT:
518533
_crc_table = (uint32_t *)Table_CRC_8bit_CCITT;
519534
break;

drivers/QSPI.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ qspi_status_t QSPI::set_frequency(int hz)
9191
return ret_status;
9292
}
9393

94-
qspi_status_t QSPI::read(unsigned int address, char *rx_buffer, size_t *rx_length)
94+
qspi_status_t QSPI::read(int address, char *rx_buffer, size_t *rx_length)
9595
{
9696
qspi_status_t ret_status = QSPI_STATUS_ERROR;
9797

@@ -115,7 +115,7 @@ qspi_status_t QSPI::read(unsigned int address, char *rx_buffer, size_t *rx_lengt
115115
return ret_status;
116116
}
117117

118-
qspi_status_t QSPI::write(unsigned int address, const char *tx_buffer, size_t *tx_length)
118+
qspi_status_t QSPI::write(int address, const char *tx_buffer, size_t *tx_length)
119119
{
120120
qspi_status_t ret_status = QSPI_STATUS_ERROR;
121121

@@ -139,7 +139,7 @@ qspi_status_t QSPI::write(unsigned int address, const char *tx_buffer, size_t *t
139139
return ret_status;
140140
}
141141

142-
qspi_status_t QSPI::read(unsigned int instruction, unsigned int alt, unsigned int address, char *rx_buffer, size_t *rx_length)
142+
qspi_status_t QSPI::read(int instruction, int alt, int address, char *rx_buffer, size_t *rx_length)
143143
{
144144
qspi_status_t ret_status = QSPI_STATUS_ERROR;
145145

@@ -163,7 +163,7 @@ qspi_status_t QSPI::read(unsigned int instruction, unsigned int alt, unsigned in
163163
return ret_status;
164164
}
165165

166-
qspi_status_t QSPI::write(unsigned int instruction, unsigned int alt, unsigned int address, const char *tx_buffer, size_t *tx_length)
166+
qspi_status_t QSPI::write(int instruction, int alt, int address, const char *tx_buffer, size_t *tx_length)
167167
{
168168
qspi_status_t ret_status = QSPI_STATUS_ERROR;
169169

@@ -187,7 +187,7 @@ qspi_status_t QSPI::write(unsigned int instruction, unsigned int alt, unsigned i
187187
return ret_status;
188188
}
189189

190-
qspi_status_t QSPI::command_transfer(unsigned int instruction, int address, const char *tx_buffer, size_t tx_length, const char *rx_buffer, size_t rx_length)
190+
qspi_status_t QSPI::command_transfer(int instruction, int address, const char *tx_buffer, size_t tx_length, const char *rx_buffer, size_t rx_length)
191191
{
192192
qspi_status_t ret_status = QSPI_STATUS_ERROR;
193193

drivers/QSPI.h

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,27 @@ namespace mbed {
4444
*
4545
* #include "mbed.h"
4646
*
47+
* #define CMD_WRITE 0x02
48+
* #define CMD_READ 0x03
49+
* #define ADDRESS 0x1000
50+
*
4751
* // hardware ssel (where applicable)
48-
* QSPI qspi_device(QSPI_PIN_IO0, QSPI_PIN_IO1, QSPI_PIN_IO2, QSPI_PIN_IO3, QSPI_PIN_SCK, QSPI_PIN_CSN); // io0, io1, io2, io3, sclk, ssel
52+
* QSPI qspi_device(QSPI_FLASH1_IO0, QSPI_FLASH1_IO1, QSPI_FLASH1_IO2, QSPI_FLASH1_IO3, QSPI_FLASH1_SCK, QSPI_FLASH1_CSN); // io0, io1, io2, io3, sclk, ssel
4953
*
5054
*
5155
* int main() {
5256
* char tx_buf[] = { 0x11, 0x22, 0x33, 0x44 };
5357
* char rx_buf[4];
5458
* int buf_len = sizeof(tx_buf);
5559
*
56-
* int result = qspi_device.write( 0x12 , 0x100000 , 0 , tx_buf, &buf_len );
57-
* if( !result ) printf("Write failed");
58-
* int result = qspi_device.read( 0x13 , 0x100000 , 0 , rx_buf, &buf_len );
59-
* if( !result ) printf("Read failed");
60+
* qspi_status_t result = qspi_device.write(CMD_WRITE, 0, ADDRESS, tx_buf, &buf_len);
61+
* if (result != QSPI_STATUS_OK) {
62+
* printf("Write failed");
63+
* }
64+
* result = qspi_device.read(CMD_READ, 0, ADDRESS, rx_buf, &buf_len);
65+
* if (result != QSPI_STATUS_OK) {
66+
* printf("Read failed");
67+
* }
6068
*
6169
* }
6270
* @endcode
@@ -118,7 +126,7 @@ class QSPI : private NonCopyable<QSPI> {
118126
* @returns
119127
* Returns QSPI_STATUS_SUCCESS on successful reads and QSPI_STATUS_ERROR on failed reads.
120128
*/
121-
qspi_status_t read(unsigned int address, char *rx_buffer, size_t *rx_length);
129+
qspi_status_t read(int address, char *rx_buffer, size_t *rx_length);
122130

123131
/** Write to QSPI peripheral using custom write instruction
124132
*
@@ -129,38 +137,38 @@ class QSPI : private NonCopyable<QSPI> {
129137
* @returns
130138
* Returns QSPI_STATUS_SUCCESS on successful reads and QSPI_STATUS_ERROR on failed reads.
131139
*/
132-
qspi_status_t write(unsigned int address, const char *tx_buffer, size_t *tx_length);
140+
qspi_status_t write(int address, const char *tx_buffer, size_t *tx_length);
133141

134142
/** Read from QSPI peripheral using custom read instruction, alt values
135143
*
136144
* @param instruction Instruction value to be used in instruction phase
137-
* @param alt Alt value to be used in instruction phase
145+
* @param alt Alt value to be used in Alternate-byte phase. Use -1 for ignoring Alternate-byte phase
138146
* @param address Address to be accessed in QSPI peripheral
139147
* @param rx_buffer Buffer for data to be read from the peripheral
140148
* @param rx_length Pointer to a variable containing the length of rx_buffer, and on return this variable will be updated with the actual number of bytes read
141149
*
142150
* @returns
143151
* Returns QSPI_STATUS_SUCCESS on successful reads and QSPI_STATUS_ERROR on failed reads.
144152
*/
145-
qspi_status_t read(unsigned int instruction, unsigned int alt, unsigned int address, char *rx_buffer, size_t *rx_length);
153+
qspi_status_t read(int instruction, int alt, int address, char *rx_buffer, size_t *rx_length);
146154

147155
/** Write to QSPI peripheral using custom write instruction, alt values
148156
*
149157
* @param instruction Instruction value to be used in instruction phase
150-
* @param alt Alt value to be used in instruction phase
158+
* @param alt Alt value to be used in Alternate-byte phase. Use -1 for ignoring Alternate-byte phase
151159
* @param address Address to be accessed in QSPI peripheral
152160
* @param tx_buffer Buffer containing data to be sent to peripheral
153161
* @param tx_length Pointer to a variable containing the length of data to be transmitted, and on return this variable will be updated with the actual number of bytes written
154162
*
155163
* @returns
156164
* Returns QSPI_STATUS_SUCCESS on successful reads and QSPI_STATUS_ERROR on failed reads.
157165
*/
158-
qspi_status_t write(unsigned int instruction, unsigned int alt, unsigned int address, const char *tx_buffer, size_t *tx_length);
166+
qspi_status_t write(int instruction, int alt, int address, const char *tx_buffer, size_t *tx_length);
159167

160168
/** Perform a transaction to write to an address(a control register) and get the status results
161169
*
162170
* @param instruction Instruction value to be used in instruction phase
163-
* @param address Some instruction might require address. Use -1 for ignoring the address value
171+
* @param address Some instruction might require address. Use -1 if no address
164172
* @param tx_buffer Buffer containing data to be sent to peripheral
165173
* @param tx_length Pointer to a variable containing the length of data to be transmitted, and on return this variable will be updated with the actual number of bytes written
166174
* @param rx_buffer Buffer for data to be read from the peripheral
@@ -169,7 +177,7 @@ class QSPI : private NonCopyable<QSPI> {
169177
* @returns
170178
* Returns QSPI_STATUS_SUCCESS on successful reads and QSPI_STATUS_ERROR on failed reads.
171179
*/
172-
qspi_status_t command_transfer(unsigned int instruction, int address, const char *tx_buffer, size_t tx_length, const char *rx_buffer, size_t rx_length);
180+
qspi_status_t command_transfer(int instruction, int address, const char *tx_buffer, size_t tx_length, const char *rx_buffer, size_t rx_length);
173181

174182
protected:
175183
/** Acquire exclusive access to this SPI bus

0 commit comments

Comments
 (0)