Skip to content

Commit f8b140f

Browse files
author
Cruz Monrreal
authored
Merge pull request #7753 from ARMmbed/release-candidate
Release candidate for mbed-os-5.9.5
2 parents 485bdee + 5dd2904 commit f8b140f

File tree

390 files changed

+9432
-4855
lines changed

Some content is hidden

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

390 files changed

+9432
-4855
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
-->
1919
[ ] Fix
2020
[ ] Refactor
21-
[ ] New target
21+
[ ] Target update
2222
[ ] Feature
2323
[ ] Breaking change
2424

TESTS/mbed_drivers/flashiap/main.cpp

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#endif
2121

2222
#include "utest/utest.h"
23+
#include "utest/utest_serial.h"
2324
#include "unity/unity.h"
2425
#include "greentea-client/test_env.h"
2526
#include <algorithm>
@@ -178,15 +179,95 @@ void flashiap_program_error_test()
178179
TEST_ASSERT_EQUAL_INT32(0, ret);
179180
}
180181

182+
void flashiap_timing_test()
183+
{
184+
FlashIAP flash_device;
185+
uint32_t ret = flash_device.init();
186+
TEST_ASSERT_EQUAL_INT32(0, ret);
187+
mbed::Timer timer;
188+
int num_write_sizes;
189+
unsigned int curr_time, byte_usec_ratio;
190+
unsigned int avg_erase_time = 0;
191+
unsigned int max_erase_time = 0, min_erase_time = (unsigned int) -1;
192+
const unsigned int max_writes = 128;
193+
const unsigned int max_write_sizes = 6;
194+
const unsigned int max_byte_usec_ratio = 200;
195+
196+
uint32_t page_size = flash_device.get_page_size();
197+
uint32_t write_size = page_size;
198+
199+
uint32_t end_address = flash_device.get_flash_start() + flash_device.get_flash_size();
200+
201+
utest_printf("\nFlash timing:\n");
202+
uint32_t sector_size = flash_device.get_sector_size(end_address - 1UL);
203+
uint32_t base_address = end_address - sector_size;
204+
timer.start();
205+
for (num_write_sizes = 0; num_write_sizes < max_write_sizes; num_write_sizes++) {
206+
if (write_size > sector_size) {
207+
break;
208+
}
209+
uint8_t *buf = new (std::nothrow) uint8_t[write_size];
210+
if (!buf) {
211+
// Don't fail the test on lack of heap memory for the buffer
212+
break;
213+
}
214+
memset(buf, 0x5A, write_size);
215+
timer.reset();
216+
ret = flash_device.erase(base_address, sector_size);
217+
curr_time = timer.read_us();
218+
avg_erase_time += curr_time;
219+
TEST_ASSERT_EQUAL_INT32(0, ret);
220+
max_erase_time = std::max(max_erase_time, curr_time);
221+
min_erase_time = std::min(min_erase_time, curr_time);
222+
uint32_t address = base_address;
223+
unsigned int avg_write_time = 0;
224+
unsigned int max_write_time = 0, min_write_time = (unsigned int) -1;
225+
int num_writes;
226+
for (num_writes = 0; num_writes < max_writes; num_writes++) {
227+
if ((address + write_size) > end_address) {
228+
break;
229+
}
230+
timer.reset();
231+
ret = flash_device.program(buf, address, write_size);
232+
curr_time = timer.read_us();
233+
avg_write_time += curr_time;
234+
TEST_ASSERT_EQUAL_INT32(0, ret);
235+
max_write_time = std::max(max_write_time, curr_time);
236+
min_write_time = std::min(min_write_time, curr_time);
237+
address += write_size;
238+
}
239+
delete[] buf;
240+
avg_write_time /= num_writes;
241+
utest_printf("Write size %6u bytes: avg %10u, min %10u, max %10u (usec)\n",
242+
write_size, avg_write_time, min_write_time, max_write_time);
243+
byte_usec_ratio = write_size / avg_write_time;
244+
TEST_ASSERT(byte_usec_ratio < max_byte_usec_ratio);
245+
write_size *= 4;
246+
}
247+
248+
if (num_write_sizes) {
249+
avg_erase_time /= num_write_sizes;
250+
utest_printf("\nErase size %6u bytes: avg %10u, min %10u, max %10u (usec)\n\n",
251+
sector_size, avg_erase_time, min_erase_time, max_erase_time);
252+
byte_usec_ratio = sector_size / avg_erase_time;
253+
TEST_ASSERT(byte_usec_ratio < max_byte_usec_ratio);
254+
}
255+
256+
ret = flash_device.deinit();
257+
TEST_ASSERT_EQUAL_INT32(0, ret);
258+
}
259+
260+
181261
Case cases[] = {
182262
Case("FlashIAP - init", flashiap_init_test),
183263
Case("FlashIAP - program", flashiap_program_test),
184264
Case("FlashIAP - program across sectors", flashiap_cross_sector_program_test),
185265
Case("FlashIAP - program errors", flashiap_program_error_test),
266+
Case("FlashIAP - timing", flashiap_timing_test),
186267
};
187268

188269
utest::v1::status_t greentea_test_setup(const size_t number_of_cases) {
189-
GREENTEA_SETUP(20, "default_auto");
270+
GREENTEA_SETUP(120, "default_auto");
190271
return greentea_test_setup_handler(number_of_cases);
191272
}
192273

TESTS/mbed_platform/error_handling/main.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ void test_error_logging()
199199
}
200200

201201
#define NUM_TEST_THREADS 5
202+
#define THREAD_STACK_SIZE 512
202203

203204
//Error logger threads
204205
void err_thread_func(mbed_error_status_t *error_status)
@@ -211,16 +212,20 @@ void err_thread_func(mbed_error_status_t *error_status)
211212
*/
212213
void test_error_logging_multithread()
213214
{
215+
uint8_t *dummy = new (std::nothrow) uint8_t[NUM_TEST_THREADS * THREAD_STACK_SIZE];
216+
TEST_SKIP_UNLESS_MESSAGE(dummy, "Not enough memory for test");
217+
delete[] dummy;
218+
214219
mbed_error_ctx error_ctx = {0};
215-
int i=0;
220+
int i;
216221
Thread *errThread[NUM_TEST_THREADS];
217222
mbed_error_status_t error_status[NUM_TEST_THREADS] = {
218223
MBED_ERROR_INVALID_ARGUMENT, MBED_ERROR_INVALID_DATA_DETECTED, MBED_ERROR_INVALID_FORMAT, MBED_ERROR_INVALID_SIZE, MBED_ERROR_INVALID_OPERATION
219224
};
220225

221226

222-
for(; i<NUM_TEST_THREADS; i++) {
223-
errThread[i] = new Thread(osPriorityNormal1, 512, NULL, NULL);
227+
for(i=0; i<NUM_TEST_THREADS; i++) {
228+
errThread[i] = new Thread(osPriorityNormal1, THREAD_STACK_SIZE, NULL, NULL);
224229
errThread[i]->start(callback(err_thread_func, &error_status[i]));
225230
}
226231
wait(2.0);

TESTS/network/emac/main.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@
4343
#endif
4444
#endif
4545

46-
#ifndef DEVICE_EMAC
47-
#error [NOT_SUPPORTED] Device EMAC has to be enabled for the target
48-
#endif
49-
5046
#include "greentea-client/test_env.h"
5147
#include "unity.h"
5248
#include "utest.h"

0 commit comments

Comments
 (0)