Skip to content

Commit 342e565

Browse files
authored
Merge pull request #3290 from ARMmbed/release-candidate
Release candidate for mbed-os-5.2.3
2 parents a1c0840 + d81681e commit 342e565

File tree

283 files changed

+39454
-23099
lines changed

Some content is hidden

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

283 files changed

+39454
-23099
lines changed

TESTS/mbed_functional/callback/main.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,11 @@ template <typename T>
233233
T const_volatile_void_func5(const volatile void *t, T a0, T a1, T a2, T a3, T a4)
234234
{ return static_cast<const volatile Thing<T>*>(t)->t | a0 | a1 | a2 | a3 | a4; }
235235

236+
// Inheriting class
237+
template <typename T>
238+
class Thing2 : public Thing<T> {
239+
};
240+
236241

237242
// function call and result verification
238243
template <typename T>
@@ -315,15 +320,18 @@ struct Verifier {
315320
template <typename T>
316321
void test_dispatch0() {
317322
Thing<T> thing;
323+
Thing2<T> thing2;
318324
Verifier<T>::verify0(static_func0<T>);
319325
Verifier<T>::verify0(&thing, &Thing<T>::member_func0);
320326
Verifier<T>::verify0((const Thing<T>*)&thing, &Thing<T>::const_member_func0);
321327
Verifier<T>::verify0((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func0);
322328
Verifier<T>::verify0((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func0);
329+
Verifier<T>::verify0(&thing2, &Thing2<T>::member_func0);
323330
Verifier<T>::verify0(&bound_func0<T>, &thing);
324331
Verifier<T>::verify0(&const_bound_func0<T>, (const Thing<T>*)&thing);
325332
Verifier<T>::verify0(&volatile_bound_func0<T>, (volatile Thing<T>*)&thing);
326333
Verifier<T>::verify0(&const_volatile_bound_func0<T>, (const volatile Thing<T>*)&thing);
334+
Verifier<T>::verify0(&bound_func0<T>, &thing2);
327335
Verifier<T>::verify0(&void_func0<T>, &thing);
328336
Verifier<T>::verify0(&const_void_func0<T>, (const Thing<T>*)&thing);
329337
Verifier<T>::verify0(&volatile_void_func0<T>, (volatile Thing<T>*)&thing);
@@ -342,15 +350,18 @@ void test_dispatch0() {
342350
template <typename T>
343351
void test_dispatch1() {
344352
Thing<T> thing;
353+
Thing2<T> thing2;
345354
Verifier<T>::verify1(static_func1<T>);
346355
Verifier<T>::verify1(&thing, &Thing<T>::member_func1);
347356
Verifier<T>::verify1((const Thing<T>*)&thing, &Thing<T>::const_member_func1);
348357
Verifier<T>::verify1((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func1);
349358
Verifier<T>::verify1((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func1);
359+
Verifier<T>::verify1(&thing2, &Thing2<T>::member_func1);
350360
Verifier<T>::verify1(&bound_func1<T>, &thing);
351361
Verifier<T>::verify1(&const_bound_func1<T>, (const Thing<T>*)&thing);
352362
Verifier<T>::verify1(&volatile_bound_func1<T>, (volatile Thing<T>*)&thing);
353363
Verifier<T>::verify1(&const_volatile_bound_func1<T>, (const volatile Thing<T>*)&thing);
364+
Verifier<T>::verify1(&bound_func1<T>, &thing2);
354365
Verifier<T>::verify1(&void_func1<T>, &thing);
355366
Verifier<T>::verify1(&const_void_func1<T>, (const Thing<T>*)&thing);
356367
Verifier<T>::verify1(&volatile_void_func1<T>, (volatile Thing<T>*)&thing);
@@ -369,15 +380,18 @@ void test_dispatch1() {
369380
template <typename T>
370381
void test_dispatch2() {
371382
Thing<T> thing;
383+
Thing2<T> thing2;
372384
Verifier<T>::verify2(static_func2<T>);
373385
Verifier<T>::verify2(&thing, &Thing<T>::member_func2);
374386
Verifier<T>::verify2((const Thing<T>*)&thing, &Thing<T>::const_member_func2);
375387
Verifier<T>::verify2((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func2);
376388
Verifier<T>::verify2((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func2);
389+
Verifier<T>::verify2(&thing2, &Thing2<T>::member_func2);
377390
Verifier<T>::verify2(&bound_func2<T>, &thing);
378391
Verifier<T>::verify2(&const_bound_func2<T>, (const Thing<T>*)&thing);
379392
Verifier<T>::verify2(&volatile_bound_func2<T>, (volatile Thing<T>*)&thing);
380393
Verifier<T>::verify2(&const_volatile_bound_func2<T>, (const volatile Thing<T>*)&thing);
394+
Verifier<T>::verify2(&bound_func2<T>, &thing2);
381395
Verifier<T>::verify2(&void_func2<T>, &thing);
382396
Verifier<T>::verify2(&const_void_func2<T>, (const Thing<T>*)&thing);
383397
Verifier<T>::verify2(&volatile_void_func2<T>, (volatile Thing<T>*)&thing);
@@ -396,15 +410,18 @@ void test_dispatch2() {
396410
template <typename T>
397411
void test_dispatch3() {
398412
Thing<T> thing;
413+
Thing2<T> thing2;
399414
Verifier<T>::verify3(static_func3<T>);
400415
Verifier<T>::verify3(&thing, &Thing<T>::member_func3);
401416
Verifier<T>::verify3((const Thing<T>*)&thing, &Thing<T>::const_member_func3);
402417
Verifier<T>::verify3((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func3);
403418
Verifier<T>::verify3((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func3);
419+
Verifier<T>::verify3(&thing2, &Thing2<T>::member_func3);
404420
Verifier<T>::verify3(&bound_func3<T>, &thing);
405421
Verifier<T>::verify3(&const_bound_func3<T>, (const Thing<T>*)&thing);
406422
Verifier<T>::verify3(&volatile_bound_func3<T>, (volatile Thing<T>*)&thing);
407423
Verifier<T>::verify3(&const_volatile_bound_func3<T>, (const volatile Thing<T>*)&thing);
424+
Verifier<T>::verify3(&bound_func3<T>, &thing2);
408425
Verifier<T>::verify3(&void_func3<T>, &thing);
409426
Verifier<T>::verify3(&const_void_func3<T>, (const Thing<T>*)&thing);
410427
Verifier<T>::verify3(&volatile_void_func3<T>, (volatile Thing<T>*)&thing);
@@ -423,15 +440,18 @@ void test_dispatch3() {
423440
template <typename T>
424441
void test_dispatch4() {
425442
Thing<T> thing;
443+
Thing2<T> thing2;
426444
Verifier<T>::verify4(static_func4<T>);
427445
Verifier<T>::verify4(&thing, &Thing<T>::member_func4);
428446
Verifier<T>::verify4((const Thing<T>*)&thing, &Thing<T>::const_member_func4);
429447
Verifier<T>::verify4((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func4);
430448
Verifier<T>::verify4((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func4);
449+
Verifier<T>::verify4(&thing2, &Thing2<T>::member_func4);
431450
Verifier<T>::verify4(&bound_func4<T>, &thing);
432451
Verifier<T>::verify4(&const_bound_func4<T>, (const Thing<T>*)&thing);
433452
Verifier<T>::verify4(&volatile_bound_func4<T>, (volatile Thing<T>*)&thing);
434453
Verifier<T>::verify4(&const_volatile_bound_func4<T>, (const volatile Thing<T>*)&thing);
454+
Verifier<T>::verify4(&bound_func4<T>, &thing2);
435455
Verifier<T>::verify4(&void_func4<T>, &thing);
436456
Verifier<T>::verify4(&const_void_func4<T>, (const Thing<T>*)&thing);
437457
Verifier<T>::verify4(&volatile_void_func4<T>, (volatile Thing<T>*)&thing);
@@ -450,15 +470,18 @@ void test_dispatch4() {
450470
template <typename T>
451471
void test_dispatch5() {
452472
Thing<T> thing;
473+
Thing2<T> thing2;
453474
Verifier<T>::verify5(static_func5<T>);
454475
Verifier<T>::verify5(&thing, &Thing<T>::member_func5);
455476
Verifier<T>::verify5((const Thing<T>*)&thing, &Thing<T>::const_member_func5);
456477
Verifier<T>::verify5((volatile Thing<T>*)&thing, &Thing<T>::volatile_member_func5);
457478
Verifier<T>::verify5((const volatile Thing<T>*)&thing, &Thing<T>::const_volatile_member_func5);
479+
Verifier<T>::verify5(&thing2, &Thing2<T>::member_func5);
458480
Verifier<T>::verify5(&bound_func5<T>, &thing);
459481
Verifier<T>::verify5(&const_bound_func5<T>, (const Thing<T>*)&thing);
460482
Verifier<T>::verify5(&volatile_bound_func5<T>, (volatile Thing<T>*)&thing);
461483
Verifier<T>::verify5(&const_volatile_bound_func5<T>, (const volatile Thing<T>*)&thing);
484+
Verifier<T>::verify5(&bound_func5<T>, &thing2);
462485
Verifier<T>::verify5(&void_func5<T>, &thing);
463486
Verifier<T>::verify5(&const_void_func5<T>, (const Thing<T>*)&thing);
464487
Verifier<T>::verify5(&volatile_void_func5<T>, (volatile Thing<T>*)&thing);
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include <stdio.h>
2+
#include <stdint.h>
3+
4+
#include "toolchain.h"
5+
#include "greentea-client/test_env.h"
6+
#include "unity.h"
7+
#include "utest.h"
8+
9+
using namespace utest::v1;
10+
11+
void no_test() {}
12+
13+
utest::v1::status_t test_setup(const size_t number_of_cases) {
14+
GREENTEA_SETUP(5, "default_auto");
15+
return verbose_test_setup_handler(number_of_cases);
16+
}
17+
18+
Case cases[] = {
19+
Case("Compilation test", no_test),
20+
};
21+
22+
Specification specification(test_setup, cases);
23+
24+
int main() {
25+
return !Harness::run(specification);
26+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#include "mbed_assert.h"
2+
#define THE_ANSWER 42
3+
4+
// Tests for static asserts in different contexts
5+
// multiple asserts are used to garuntee no conflicts occur in generated labels
6+
7+
// Test for static asserts in global context
8+
MBED_STATIC_ASSERT(sizeof(int) >= sizeof(char),
9+
"An int must be larger than char");
10+
MBED_STATIC_ASSERT(2 + 2 == 4,
11+
"Hopefully the universe is mathematically consistent");
12+
MBED_STATIC_ASSERT(THE_ANSWER == 42,
13+
"Said Deep Thought, with infinite majesty and calm");
14+
15+
struct test {
16+
int dummy;
17+
18+
// Test for static asserts in struct context
19+
MBED_STRUCT_STATIC_ASSERT(sizeof(int) >= sizeof(char),
20+
"An int must be larger than char");
21+
MBED_STRUCT_STATIC_ASSERT(2 + 2 == 4,
22+
"Hopefully the universe is mathematically consistent");
23+
MBED_STRUCT_STATIC_ASSERT(THE_ANSWER == 42,
24+
"Said Deep Thought, with infinite majesty and calm");
25+
};
26+
27+
MBED_STATIC_ASSERT(sizeof(struct test) == sizeof(int),
28+
"Static assertions should not change the size of a struct");
29+
30+
void doit_c(void) {
31+
// Test for static asserts in function context
32+
MBED_STATIC_ASSERT(sizeof(int) >= sizeof(char),
33+
"An int must be larger than char");
34+
MBED_STATIC_ASSERT(2 + 2 == 4,
35+
"Hopefully the universe is mathematically consistent");
36+
MBED_STATIC_ASSERT(THE_ANSWER == 42,
37+
"Said Deep Thought, with infinite majesty and calm");
38+
}
39+
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#include "mbed_assert.h"
2+
#define THE_ANSWER 42
3+
4+
// Tests for static asserts in different contexts
5+
// multiple asserts are used to garuntee no conflicts occur in generated labels
6+
7+
// Test for static asserts in global context
8+
MBED_STATIC_ASSERT(sizeof(int) >= sizeof(char),
9+
"An int must be larger than char");
10+
MBED_STATIC_ASSERT(2 + 2 == 4,
11+
"Hopefully the universe is mathematically consistent");
12+
MBED_STATIC_ASSERT(THE_ANSWER == 42,
13+
"Said Deep Thought, with infinite majesty and calm");
14+
15+
struct test {
16+
int dummy;
17+
18+
// Test for static asserts in struct context
19+
MBED_STRUCT_STATIC_ASSERT(sizeof(int) >= sizeof(char),
20+
"An int must be larger than char");
21+
MBED_STRUCT_STATIC_ASSERT(2 + 2 == 4,
22+
"Hopefully the universe is mathematically consistent");
23+
MBED_STRUCT_STATIC_ASSERT(THE_ANSWER == 42,
24+
"Said Deep Thought, with infinite majesty and calm");
25+
26+
MBED_STATIC_ASSERT(sizeof(int) >= sizeof(char),
27+
"An int must be larger than char");
28+
MBED_STATIC_ASSERT(2 + 2 == 4,
29+
"Hopefully the universe is mathematically consistent");
30+
MBED_STATIC_ASSERT(THE_ANSWER == 42,
31+
"Said Deep Thought, with infinite majesty and calm");
32+
};
33+
34+
MBED_STATIC_ASSERT(sizeof(struct test) == sizeof(int),
35+
"Static assertions should not change the size of a struct");
36+
37+
void doit_c(void) {
38+
// Test for static asserts in function context
39+
MBED_STATIC_ASSERT(sizeof(int) >= sizeof(char),
40+
"An int must be larger than char");
41+
MBED_STATIC_ASSERT(2 + 2 == 4,
42+
"Hopefully the universe is mathematically consistent");
43+
MBED_STATIC_ASSERT(THE_ANSWER == 42,
44+
"Said Deep Thought, with infinite majesty and calm");
45+
}
46+

cmsis/core_caFunc.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,23 @@ __asm(
811811
__STATIC_INLINE void __v7_inv_dcache_all(void) {
812812
__v7_all_cache(0);
813813
}
814+
/** \brief Clean the whole D$
815+
816+
DCCSW. Clean by Set/Way
817+
*/
818+
819+
__STATIC_INLINE void __v7_clean_dcache_all(void) {
820+
__v7_all_cache(1);
821+
}
822+
823+
/** \brief Clean and invalidate the whole D$
824+
825+
DCCISW. Clean and Invalidate by Set/Way
826+
*/
827+
828+
__STATIC_INLINE void __v7_clean_inv_dcache_all(void) {
829+
__v7_all_cache(2);
830+
}
814831
/** \brief Clean and Invalidate D$ by MVA
815832
816833
DCCIMVAC. Data cache clean and invalidate by MVA to PoC

events/equeue/equeue_mbed.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ static void equeue_tick_update() {
3838
}
3939

4040
static void equeue_tick_init() {
41-
MBED_ASSERT(sizeof(equeue_timer) >= sizeof(Timer));
42-
MBED_ASSERT(sizeof(equeue_ticker) >= sizeof(Ticker));
41+
MBED_STATIC_ASSERT(sizeof(equeue_timer) >= sizeof(Timer),
42+
"The equeue_timer buffer must fit the class Timer");
43+
MBED_STATIC_ASSERT(sizeof(equeue_ticker) >= sizeof(Ticker),
44+
"The equeue_ticker buffer must fit the class Ticker");
4345
new (equeue_timer) Timer;
4446
new (equeue_ticker) Ticker;
4547

@@ -78,7 +80,8 @@ void equeue_mutex_unlock(equeue_mutex_t *m) {
7880
#ifdef MBED_CONF_RTOS_PRESENT
7981

8082
int equeue_sema_create(equeue_sema_t *s) {
81-
MBED_ASSERT(sizeof(equeue_sema_t) >= sizeof(Semaphore));
83+
MBED_STATIC_ASSERT(sizeof(equeue_sema_t) >= sizeof(Semaphore),
84+
"The equeue_sema_t must fit the class Semaphore");
8285
new (s) Semaphore(0);
8386
return 0;
8487
}
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
#include "mbed.h"
2+
#include "greentea-client/test_env.h"
3+
#include "unity.h"
4+
#include "utest.h"
5+
#include "EthernetInterface.h"
6+
7+
using namespace utest::v1;
8+
9+
10+
// Hostname for testing against
11+
// Must have A and AAAA records
12+
#ifndef MBED_DNS_TEST_HOST
13+
#define MBED_DNS_TEST_HOST "connector.mbed.com"
14+
#endif
15+
16+
// Address info from stack
17+
const char *ip_literal;
18+
nsapi_version_t ip_pref;
19+
const char *ip_pref_repr;
20+
21+
// Network setup
22+
EthernetInterface net;
23+
void net_bringup() {
24+
int err = net.connect();
25+
TEST_ASSERT_EQUAL(0, err);
26+
printf("MBED: Connected to network\n");
27+
printf("MBED: IP Address: %s\n", net.get_ip_address());
28+
29+
ip_literal = net.get_ip_address();
30+
ip_pref = SocketAddress(ip_literal).get_ip_version();
31+
ip_pref_repr = (ip_pref == NSAPI_IPv4) ? "ipv4" :
32+
(ip_pref == NSAPI_IPv6) ? "ipv6" : "unspec";
33+
}
34+
35+
36+
// DNS tests
37+
void test_dns_query() {
38+
SocketAddress addr;
39+
int err = net.gethostbyname(MBED_DNS_TEST_HOST, &addr);
40+
printf("DNS: query \"%s\" => \"%s\"\n",
41+
MBED_DNS_TEST_HOST, addr.get_ip_address());
42+
43+
TEST_ASSERT_EQUAL(0, err);
44+
TEST_ASSERT((bool)addr);
45+
TEST_ASSERT(strlen(addr.get_ip_address()) > 1);
46+
}
47+
48+
void test_dns_query_pref() {
49+
SocketAddress addr;
50+
int err = net.gethostbyname(MBED_DNS_TEST_HOST, &addr, ip_pref);
51+
printf("DNS: query %s \"%s\" => \"%s\"\n",
52+
ip_pref_repr, MBED_DNS_TEST_HOST, addr.get_ip_address());
53+
54+
TEST_ASSERT_EQUAL(0, err);
55+
TEST_ASSERT((bool)addr);
56+
TEST_ASSERT(strlen(addr.get_ip_address()) > 1);
57+
TEST_ASSERT_EQUAL(ip_pref, addr.get_ip_version());
58+
}
59+
60+
void test_dns_literal() {
61+
SocketAddress addr;
62+
int err = net.gethostbyname(ip_literal, &addr);
63+
printf("DNS: literal \"%s\" => \"%s\"\n",
64+
ip_literal, addr.get_ip_address());
65+
66+
TEST_ASSERT_EQUAL(0, err);
67+
TEST_ASSERT((bool)addr);
68+
TEST_ASSERT(strlen(addr.get_ip_address()) > 1);
69+
TEST_ASSERT(strcmp(ip_literal, addr.get_ip_address()) == 0);
70+
}
71+
72+
void test_dns_literal_pref() {
73+
SocketAddress addr;
74+
int err = net.gethostbyname(ip_literal, &addr, ip_pref);
75+
printf("DNS: literal %s \"%s\" => \"%s\"\n",
76+
ip_pref_repr, ip_literal, addr.get_ip_address());
77+
78+
TEST_ASSERT_EQUAL(0, err);
79+
TEST_ASSERT((bool)addr);
80+
TEST_ASSERT(strlen(addr.get_ip_address()) > 1);
81+
TEST_ASSERT_EQUAL(ip_pref, addr.get_ip_version());
82+
TEST_ASSERT(strcmp(ip_literal, addr.get_ip_address()) == 0);
83+
}
84+
85+
86+
// Test setup
87+
utest::v1::status_t test_setup(const size_t number_of_cases) {
88+
GREENTEA_SETUP(20, "default_auto");
89+
net_bringup();
90+
return verbose_test_setup_handler(number_of_cases);
91+
}
92+
93+
Case cases[] = {
94+
Case("Testing DNS query", test_dns_query),
95+
Case("Testing DNS preference query", test_dns_query_pref),
96+
Case("Testing DNS literal", test_dns_literal),
97+
Case("Testing DNS preference literal", test_dns_literal_pref),
98+
};
99+
100+
Specification specification(test_setup, cases);
101+
102+
int main() {
103+
return !Harness::run(specification);
104+
}

0 commit comments

Comments
 (0)