Skip to content

Commit 140b72d

Browse files
committed
Merge remote-tracking branch 'ARMmbed/master' into pr/psoc6-hal
2 parents d77fb26 + 279f4cd commit 140b72d

File tree

41 files changed

+11422
-4229
lines changed

Some content is hidden

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

41 files changed

+11422
-4229
lines changed

TESTS/mbed_drivers/ticker/main.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ void ticker_callback_1(void)
7171
void ticker_callback_2(void)
7272
{
7373
++callback_trigger_count;
74-
switch_led2_state();
74+
if (LED2 != NC) {
75+
switch_led2_state();
76+
}
7577
}
7678

7779

@@ -110,7 +112,9 @@ void test_case_1x_ticker()
110112
Ticker ticker;
111113

112114
led1 = 1;
113-
led2 = 1;
115+
if (LED2 != NC) {
116+
led2 = 1;
117+
}
114118
callback_trigger_count = 0;
115119

116120
greentea_send_kv("timing_drift_check_start", 0);
@@ -151,7 +155,9 @@ void test_case_2x_ticker()
151155
Ticker ticker1, ticker2;
152156

153157
led1 = 0;
154-
led2 = 1;
158+
if (LED2 != NC) {
159+
led2 = 1;
160+
}
155161
callback_trigger_count = 0;
156162

157163
ticker1.attach_us(ticker_callback_1, 2 * ONE_MILLI_SEC);

TESTS/mbed_hal_fpga_ci_test_shield/analogin/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#error [NOT_SUPPORTED] Analog in not supported for this target
2020
#elif !COMPONENT_FPGA_CI_TEST_SHIELD
2121
#error [NOT_SUPPORTED] FPGA CI Test Shield is needed to run this test
22+
#elif !defined(TARGET_FF_ARDUINO) && !defined(MBED_CONF_TARGET_DEFAULT_FORM_FACTOR)
23+
#error [NOT_SUPPORTED] Test not supported for this form factor
2224
#else
2325

2426
#include "utest/utest.h"

TESTS/mbed_hal_fpga_ci_test_shield/analogout/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#error [NOT_SUPPORTED] Analog out not supported for this target
2020
#elif !COMPONENT_FPGA_CI_TEST_SHIELD
2121
#error [NOT_SUPPORTED] FPGA CI Test Shield is needed to run this test
22+
#elif !defined(TARGET_FF_ARDUINO) && !defined(MBED_CONF_TARGET_DEFAULT_FORM_FACTOR)
23+
#error [NOT_SUPPORTED] Test not supported for this form factor
2224
#else
2325

2426
#include "utest/utest.h"

TESTS/mbed_hal_fpga_ci_test_shield/gpio/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
#if !COMPONENT_FPGA_CI_TEST_SHIELD
1919
#error [NOT_SUPPORTED] FPGA CI Test Shield is needed to run this test
20+
#elif !defined(TARGET_FF_ARDUINO) && !defined(MBED_CONF_TARGET_DEFAULT_FORM_FACTOR)
21+
#error [NOT_SUPPORTED] Test not supported for this form factor
2022
#else
2123

2224
#include "utest/utest.h"
@@ -66,6 +68,9 @@ void gpio_inout_test()
6668
{
6769
for (int i = 0; i < form_factor->count; i++) {
6870
const PinName test_pin = form_factor->pins[i];
71+
if (test_pin == NC) {
72+
continue;
73+
}
6974
if (pinmap_list_has_pin(restricted, test_pin)) {
7075
printf("Skipping gpio pin %s (%i)\r\n", pinmap_ff_default_pin_to_string(test_pin), test_pin);
7176
continue;

TESTS/mbed_hal_fpga_ci_test_shield/gpio_irq/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#error [NOT_SUPPORTED] test not supported
2020
#elif !COMPONENT_FPGA_CI_TEST_SHIELD
2121
#error [NOT_SUPPORTED] FPGA CI Test Shield is needed to run this test
22+
#elif !defined(TARGET_FF_ARDUINO) && !defined(MBED_CONF_TARGET_DEFAULT_FORM_FACTOR)
23+
#error [NOT_SUPPORTED] Test not supported for this form factor
2224
#else
2325

2426
#include "utest/utest.h"
@@ -248,6 +250,9 @@ void gpio_irq_test()
248250
{
249251
for (uint32_t i = 0; i < form_factor->count; i++) {
250252
const PinName test_pin = form_factor->pins[i];
253+
if (test_pin == NC) {
254+
continue;
255+
}
251256
if (pinmap_list_has_pin(restricted, test_pin)) {
252257
printf("Skipping gpio pin %s (%i)\r\n", pinmap_ff_default_pin_to_string(test_pin), test_pin);
253258
continue;

TESTS/mbed_hal_fpga_ci_test_shield/i2c/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#error [NOT_SUPPORTED] I2C not supported for this target
2020
#elif !COMPONENT_FPGA_CI_TEST_SHIELD
2121
#error [NOT_SUPPORTED] FPGA CI Test Shield is needed to run this test
22+
#elif !defined(TARGET_FF_ARDUINO) && !defined(MBED_CONF_TARGET_DEFAULT_FORM_FACTOR)
23+
#error [NOT_SUPPORTED] Test not supported for this form factor
2224
#else
2325

2426
#include "utest/utest.h"

TESTS/mbed_hal_fpga_ci_test_shield/pwm/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#error [NOT_SUPPORTED] PWM not supported for this target
2020
#elif !COMPONENT_FPGA_CI_TEST_SHIELD
2121
#error [NOT_SUPPORTED] FPGA CI Test Shield is needed to run this test
22+
#elif !defined(TARGET_FF_ARDUINO) && !defined(MBED_CONF_TARGET_DEFAULT_FORM_FACTOR)
23+
#error [NOT_SUPPORTED] Test not supported for this form factor
2224
#else
2325

2426
#include "utest/utest.h"

TESTS/mbed_hal_fpga_ci_test_shield/spi/main.cpp

Lines changed: 99 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#error [NOT_SUPPORTED] SPI not supported for this target
2020
#elif !COMPONENT_FPGA_CI_TEST_SHIELD
2121
#error [NOT_SUPPORTED] FPGA CI Test Shield is needed to run this test
22+
#elif !defined(TARGET_FF_ARDUINO) && !defined(MBED_CONF_TARGET_DEFAULT_FORM_FACTOR)
23+
#error [NOT_SUPPORTED] Test not supported for this form factor
2224
#else
2325

2426
#include "utest/utest.h"
@@ -32,23 +34,45 @@ using namespace utest::v1;
3234
#include "pinmap.h"
3335
#include "test_utils.h"
3436

37+
typedef enum {
38+
TRANSFER_SPI_MASTER_WRITE_SYNC,
39+
TRANSFER_SPI_MASTER_BLOCK_WRITE_SYNC,
40+
TRANSFER_SPI_MASTER_TRANSFER_ASYNC
41+
} transfer_type_t;
42+
43+
#define FREQ_500_KHZ 500000
44+
#define FREQ_1_MHZ 1000000
45+
#define FREQ_2_MHZ 2000000
3546

3647
const int TRANSFER_COUNT = 300;
3748
SPIMasterTester tester(DefaultFormFactor::pins(), DefaultFormFactor::restricted_pins());
3849

50+
spi_t spi;
51+
static volatile bool async_trasfer_done;
52+
53+
#if DEVICE_SPI_ASYNCH
54+
void spi_async_handler()
55+
{
56+
int event = spi_irq_handler_asynch(&spi);
57+
58+
if (event == SPI_EVENT_COMPLETE) {
59+
async_trasfer_done = true;
60+
}
61+
}
62+
#endif
3963

4064
void spi_test_init_free(PinName mosi, PinName miso, PinName sclk, PinName ssel)
4165
{
42-
spi_t spi;
4366
spi_init(&spi, mosi, miso, sclk, ssel);
4467
spi_format(&spi, 8, SPITester::Mode0, 0);
4568
spi_frequency(&spi, 1000000);
4669
spi_free(&spi);
4770
}
4871

49-
void spi_test_common(PinName mosi, PinName miso, PinName sclk, PinName ssel, SPITester::SpiMode spi_mode, uint32_t sym_size)
72+
void spi_test_common(PinName mosi, PinName miso, PinName sclk, PinName ssel, SPITester::SpiMode spi_mode, uint32_t sym_size, transfer_type_t transfer_type, uint32_t frequency)
5073
{
5174
uint32_t sym_mask = ((1 << sym_size) - 1);
75+
5276
// Remap pins for test
5377
tester.reset();
5478
tester.pin_map_set(mosi, MbedTester::LogicalPinSPIMosi);
@@ -57,10 +81,10 @@ void spi_test_common(PinName mosi, PinName miso, PinName sclk, PinName ssel, SPI
5781
tester.pin_map_set(ssel, MbedTester::LogicalPinSPISsel);
5882

5983
// Initialize mbed SPI pins
60-
spi_t spi;
84+
6185
spi_init(&spi, mosi, miso, sclk, ssel);
6286
spi_format(&spi, sym_size, spi_mode, 0);
63-
spi_frequency(&spi, 1000000);
87+
spi_frequency(&spi, frequency);
6488

6589
// Configure spi_slave module
6690
tester.set_mode(spi_mode);
@@ -71,13 +95,61 @@ void spi_test_common(PinName mosi, PinName miso, PinName sclk, PinName ssel, SPI
7195
tester.peripherals_reset();
7296
tester.select_peripheral(SPITester::PeripheralSPI);
7397

74-
// Send and receive test data
7598
uint32_t checksum = 0;
76-
for (int i = 0; i < TRANSFER_COUNT; i++) {
77-
uint32_t data = spi_master_write(&spi, (0 - i) & sym_mask);
78-
TEST_ASSERT_EQUAL(i & sym_mask, data);
99+
int result = 0;
100+
uint8_t tx_buf[TRANSFER_COUNT] = {0};
101+
uint8_t rx_buf[TRANSFER_COUNT] = {0};
102+
103+
// Send and receive test data
104+
switch (transfer_type) {
105+
case TRANSFER_SPI_MASTER_WRITE_SYNC:
106+
for (int i = 0; i < TRANSFER_COUNT; i++) {
107+
uint32_t data = spi_master_write(&spi, (0 - i) & sym_mask);
108+
TEST_ASSERT_EQUAL(i & sym_mask, data);
109+
110+
checksum += (0 - i) & sym_mask;
111+
}
112+
break;
113+
114+
case TRANSFER_SPI_MASTER_BLOCK_WRITE_SYNC:
115+
for (int i = 0; i < TRANSFER_COUNT; i++) {
116+
tx_buf[i] = (0 - i) & sym_mask;
117+
checksum += (0 - i) & sym_mask;
118+
rx_buf[i] = 0xAA;
119+
}
120+
121+
result = spi_master_block_write(&spi, (const char *)tx_buf, TRANSFER_COUNT, (char *)rx_buf, TRANSFER_COUNT, 0xF5);
122+
123+
for (int i = 0; i < TRANSFER_COUNT; i++) {
124+
TEST_ASSERT_EQUAL(i & sym_mask, rx_buf[i]);
125+
}
126+
TEST_ASSERT_EQUAL(TRANSFER_COUNT, result);
127+
break;
128+
129+
#if DEVICE_SPI_ASYNCH
130+
case TRANSFER_SPI_MASTER_TRANSFER_ASYNC:
131+
for (int i = 0; i < TRANSFER_COUNT; i++) {
132+
tx_buf[i] = (0 - i) & sym_mask;
133+
checksum += (0 - i) & sym_mask;
134+
rx_buf[i] = 0xAA;
135+
}
136+
137+
async_trasfer_done = false;
138+
139+
spi_master_transfer(&spi, tx_buf, TRANSFER_COUNT, rx_buf, TRANSFER_COUNT, 8, (uint32_t)spi_async_handler, 0, DMA_USAGE_NEVER);
140+
while (!async_trasfer_done);
141+
142+
for (int i = 0; i < TRANSFER_COUNT; i++) {
143+
TEST_ASSERT_EQUAL(i & sym_mask, rx_buf[i]);
144+
}
145+
146+
break;
147+
#endif
148+
149+
default:
150+
TEST_ASSERT_MESSAGE(0, "Unsupported transfer type.");
151+
break;
79152

80-
checksum += (0 - i) & sym_mask;
81153
}
82154

83155
// Verify that the transfer was successful
@@ -88,27 +160,36 @@ void spi_test_common(PinName mosi, PinName miso, PinName sclk, PinName ssel, SPI
88160
tester.reset();
89161
}
90162

91-
template<SPITester::SpiMode spi_mode, uint32_t sym_size>
163+
template<SPITester::SpiMode spi_mode, uint32_t sym_size, transfer_type_t transfer_type, uint32_t frequency>
92164
void spi_test_common(PinName mosi, PinName miso, PinName sclk, PinName ssel)
93165
{
94-
spi_test_common(mosi, miso, sclk, ssel, spi_mode, sym_size);
166+
spi_test_common(mosi, miso, sclk, ssel, spi_mode, sym_size, transfer_type, frequency);
95167
}
96168

97169
Case cases[] = {
98170
// This will be run for all pins
99171
Case("SPI - init/free test all pins", all_ports<SPIPort, DefaultFormFactor, spi_test_init_free>),
100172

101173
// This will be run for all peripherals
102-
Case("SPI - basic test", all_peripherals<SPIPort, DefaultFormFactor, spi_test_common<SPITester::Mode0, 8> >),
174+
Case("SPI - basic test", all_peripherals<SPIPort, DefaultFormFactor, spi_test_common<SPITester::Mode0, 8, TRANSFER_SPI_MASTER_WRITE_SYNC, FREQ_1_MHZ> >),
103175

104176
// This will be run for single pin configuration
105-
Case("SPI - mode testing (MODE_1)", one_peripheral<SPIPort, DefaultFormFactor, spi_test_common<SPITester::Mode1, 8> >),
106-
Case("SPI - mode testing (MODE_2)", one_peripheral<SPIPort, DefaultFormFactor, spi_test_common<SPITester::Mode2, 8> >),
107-
Case("SPI - mode testing (MODE_3)", one_peripheral<SPIPort, DefaultFormFactor, spi_test_common<SPITester::Mode3, 8> >),
177+
Case("SPI - mode testing (MODE_1)", one_peripheral<SPIPort, DefaultFormFactor, spi_test_common<SPITester::Mode1, 8, TRANSFER_SPI_MASTER_WRITE_SYNC, FREQ_1_MHZ> >),
178+
Case("SPI - mode testing (MODE_2)", one_peripheral<SPIPort, DefaultFormFactor, spi_test_common<SPITester::Mode2, 8, TRANSFER_SPI_MASTER_WRITE_SYNC, FREQ_1_MHZ> >),
179+
Case("SPI - mode testing (MODE_3)", one_peripheral<SPIPort, DefaultFormFactor, spi_test_common<SPITester::Mode3, 8, TRANSFER_SPI_MASTER_WRITE_SYNC, FREQ_1_MHZ> >),
180+
181+
Case("SPI - symbol size testing (4)", one_peripheral<SPIPort, DefaultFormFactor, spi_test_common<SPITester::Mode0, 4, TRANSFER_SPI_MASTER_WRITE_SYNC, FREQ_1_MHZ> >),
182+
Case("SPI - symbol size testing (12)", one_peripheral<SPIPort, DefaultFormFactor, spi_test_common<SPITester::Mode0, 12, TRANSFER_SPI_MASTER_WRITE_SYNC, FREQ_1_MHZ> >),
183+
Case("SPI - symbol size testing (16)", one_peripheral<SPIPort, DefaultFormFactor, spi_test_common<SPITester::Mode0, 16, TRANSFER_SPI_MASTER_WRITE_SYNC, FREQ_1_MHZ> >),
184+
185+
Case("SPI - frequency testing (500 kHz)", one_peripheral<SPIPort, DefaultFormFactor, spi_test_common<SPITester::Mode0, 8, TRANSFER_SPI_MASTER_WRITE_SYNC, FREQ_500_KHZ> >),
186+
Case("SPI - frequency testing (2 MHz)", one_peripheral<SPIPort, DefaultFormFactor, spi_test_common<SPITester::Mode0, 8, TRANSFER_SPI_MASTER_WRITE_SYNC, FREQ_2_MHZ> >),
187+
188+
Case("SPI - block write", one_peripheral<SPIPort, DefaultFormFactor, spi_test_common<SPITester::Mode0, 8, TRANSFER_SPI_MASTER_BLOCK_WRITE_SYNC, FREQ_1_MHZ> >),
108189

109-
Case("SPI - symbol size testing (4)", one_peripheral<SPIPort, DefaultFormFactor, spi_test_common<SPITester::Mode0, 4> >),
110-
Case("SPI - symbol size testing (12)", one_peripheral<SPIPort, DefaultFormFactor, spi_test_common<SPITester::Mode0, 12> >),
111-
Case("SPI - symbol size testing (16)", one_peripheral<SPIPort, DefaultFormFactor, spi_test_common<SPITester::Mode0, 16> >)
190+
#if DEVICE_SPI_ASYNCH
191+
Case("SPI - async mode", one_peripheral<SPIPort, DefaultFormFactor, spi_test_common<SPITester::Mode0, 8, TRANSFER_SPI_MASTER_TRANSFER_ASYNC, FREQ_1_MHZ> >)
192+
#endif
112193
};
113194

114195
utest::v1::status_t greentea_test_setup(const size_t number_of_cases)

TESTS/mbed_hal_fpga_ci_test_shield/uart/main.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#error [NOT_SUPPORTED] SERIAL not supported for this target
2020
#elif !COMPONENT_FPGA_CI_TEST_SHIELD
2121
#error [NOT_SUPPORTED] FPGA CI Test Shield is needed to run this test
22+
#elif !defined(TARGET_FF_ARDUINO) && !defined(MBED_CONF_TARGET_DEFAULT_FORM_FACTOR)
23+
#error [NOT_SUPPORTED] Test not supported for this form factor
2224
#else
2325

2426
#include "utest/utest.h"
@@ -338,4 +340,4 @@ int main()
338340
Harness::run(specification);
339341
}
340342

341-
#endif /* !DEVICE_SERIAL */
343+
#endif /* !DEVICE_SERIAL */

TESTS/mbedmicro-rtos-mbed/malloc/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ void test_alloc_and_free(void)
122122
int size = SIZE_INCREMENTS;
123123
int loop = ALLOC_LOOP;
124124
while (loop) {
125-
data = malloc(size);
125+
data = count < ALLOC_ARRAY_SIZE ? malloc(size) : NULL;
126126
if (NULL != data) {
127127
array[count++] = data;
128128
memset((void *)data, 0xdeadbeef, size);

doxygen_options.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"SEARCH_INCLUDES": "YES",
77
"INCLUDE_PATH": "",
88
"INCLUDE_FILE_PATTERNS": "",
9-
"PREDEFINED": "DOXYGEN_ONLY DEVICE_ANALOGIN DEVICE_ANALOGOUT DEVICE_CAN DEVICE_CRC DEVICE_ETHERNET DEVICE_EMAC DEVICE_FLASH DEVICE_I2C DEVICE_I2CSLAVE DEVICE_I2C_ASYNCH DEVICE_INTERRUPTIN DEVICE_ITM DEVICE_LPTICKER DEVICE_MPU 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_QSPI DEVICE_STORAGE DEVICE_WATCHDOG COMPONENT_SPE COMPONENT_SPM_MAILBOX \"TFM_LVL=1\" \"MBED_DEPRECATED_SINCE(f, g)=\" \"MBED_ENABLE_IF_CALLBACK_COMPATIBLE(F, M)=\" \"MBED_DEPRECATED(s)=\" \"BLE_ROLE_OBSERVER=1\" \"BLE_ROLE_BROADCASTER=1\" \"BLE_ROLE_PERIPHERAL=1\" \"BLE_ROLE_CENTRAL=1\" \"BLE_FEATURE_GATT_CLIENT=1\" \"BLE_FEATURE_GATT_SERVER=1\" \"BLE_FEATURE_SECURITY=1\" \"BLE_FEATURE_SECURE_CONNECTIONS=1\" \"BLE_FEATURE_SIGNING=1\" \"BLE_FEATURE_PHY_MANAGEMENT=1\" \"BLE_FEATURE_WHITELIST=1\" \"BLE_FEATURE_PRIVACY=1\" \"BLE_FEATURE_PERIODIC_ADVERTISING=1\" \"BLE_FEATURE_EXTENDED_ADVERTISING=1\"",
9+
"PREDEFINED": "DOXYGEN_ONLY DEVICE_ANALOGIN DEVICE_ANALOGOUT DEVICE_CAN DEVICE_CRC DEVICE_ETHERNET DEVICE_EMAC DEVICE_FLASH DEVICE_I2C DEVICE_I2CSLAVE DEVICE_I2C_ASYNCH DEVICE_INTERRUPTIN DEVICE_ITM DEVICE_LPTICKER DEVICE_MPU 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_QSPI DEVICE_STORAGE DEVICE_WATCHDOG DEVICE_RESET_REASON COMPONENT_SPE COMPONENT_SPM_MAILBOX \"TFM_LVL=1\" \"MBED_DEPRECATED_SINCE(f, g)=\" \"MBED_ENABLE_IF_CALLBACK_COMPATIBLE(F, M)=\" \"MBED_DEPRECATED(s)=\" \"BLE_ROLE_OBSERVER=1\" \"BLE_ROLE_BROADCASTER=1\" \"BLE_ROLE_PERIPHERAL=1\" \"BLE_ROLE_CENTRAL=1\" \"BLE_FEATURE_GATT_CLIENT=1\" \"BLE_FEATURE_GATT_SERVER=1\" \"BLE_FEATURE_SECURITY=1\" \"BLE_FEATURE_SECURE_CONNECTIONS=1\" \"BLE_FEATURE_SIGNING=1\" \"BLE_FEATURE_PHY_MANAGEMENT=1\" \"BLE_FEATURE_WHITELIST=1\" \"BLE_FEATURE_PRIVACY=1\" \"BLE_FEATURE_PERIODIC_ADVERTISING=1\" \"BLE_FEATURE_EXTENDED_ADVERTISING=1\"",
1010
"EXPAND_AS_DEFINED": "",
1111
"SKIP_FUNCTION_MACROS": "NO",
1212
"STRIP_CODE_COMMENTS": "NO",

0 commit comments

Comments
 (0)