Skip to content

Commit addec7b

Browse files
authored
Merge pull request #6461 from ARMmbed/release-candidate
Release candidate for mbed-os-5.8.1
2 parents ad284b2 + a48b62d commit addec7b

File tree

289 files changed

+22188
-19205
lines changed

Some content is hidden

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

289 files changed

+22188
-19205
lines changed

.github/pull_request_template.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,17 @@
1111

1212
<!--
1313
Required
14-
Please tick one of the following types
14+
Please tick only one of the following types. Do not tick more or change the layout.
15+
16+
[X] Fix
17+
[ ] Refactor
18+
[ ] New target
19+
[ ] Feature
20+
[ ] Breaking change
1521
-->
1622

17-
- [ ] Fix
18-
- [ ] Refactor
19-
- [ ] New target
20-
- [ ] Feature
21-
- [ ] Breaking change
23+
[ ] Fix
24+
[ ] Refactor
25+
[ ] New target
26+
[ ] Feature
27+
[ ] Breaking change

.travis.yml

Lines changed: 19 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ before_install:
3131
# Setup ppa to make sure arm-none-eabi-gcc is correct version
3232
- sudo add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
3333
# Loop until update succeeds (timeouts can occur)
34-
- while [ -n "$(sudo apt-get update 2>&1 |grep Failed)" ]; do :; done
34+
- travis_retry $(! sudo apt-get update 2>&1 |grep Failed)
3535

3636
after_success:
3737
- bash -c "$STATUS" success "Local $NAME testing has passed"
@@ -115,6 +115,24 @@ matrix:
115115
- python tools/make.py -t GCC_ARM -m DISCO_F401VC --source=. --build=BUILD/DISCO_F401VC/GCC_ARM -j0
116116
# Run local equeue tests
117117
- make -C $EVENTS/equeue test
118+
# Run profiling tests
119+
- make -C $EVENTS/equeue prof | tee prof
120+
after_success:
121+
# update status if we succeeded, compare with master if possible
122+
- |
123+
CURR=$(grep -o '[0-9]\+ cycles' prof | awk '{sum += $1} END {print sum}')
124+
PREV=$(curl https://api.github.com/repos/$TRAVIS_REPO_SLUG/status/master \
125+
| jq -re "select(.sha != \"$TRAVIS_COMMIT\")
126+
| .statuses[] | select(.context == \"travis-ci/$NAME\").description
127+
| capture(\"runtime is (?<runtime>[0-9]+)\").runtime" \
128+
|| echo 0)
129+
130+
STATUSM="Passed, runtime is ${CURR} cycles"
131+
if [ "$PREV" -ne 0 ]
132+
then
133+
STATUSM="$STATUSM ($(python -c "print '%+d' % ($CURR-$PREV)") cycles)"
134+
fi
135+
- bash -c "$STATUS" success "$STATUSM"
118136

119137
- env:
120138
- NAME=littlefs
@@ -187,37 +205,3 @@ matrix:
187205
STATUSM="$STATUSM ($(python -c "print '%+.2f' % (100*($CURR-$PREV)/$PREV.0)")%)"
188206
fi
189207
- bash -c "$STATUS" success "$STATUSM"
190-
191-
- &mbed-2
192-
env: NAME=mbed2-NXP
193-
install:
194-
# Install dependencies
195-
- export GCC_DIR=$HOME/gcc-arm-none-eabi-6-2017-q2-update
196-
- export GCC_ARCHIVE=$HOME/gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2
197-
- export GCC_URL=https://developer.arm.com/-/media/Files/downloads/gnu-rm/6-2017q2/gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2?revision=2cc92fb5-3e0e-402d-9197-bdfc8224d8a5?product=GNU%20Arm%20Embedded%20Toolchain,64-bit,,Linux,6-2017-q2-update
198-
- if [ ! -e $GCC_DIR/bin/arm-none-eabi-gcc ]; then wget $GCC_URL -O $GCC_ARCHIVE; tar xfj $GCC_ARCHIVE -C $HOME; fi
199-
- export PATH=$PATH:$GCC_DIR/bin
200-
- pip install -r requirements.txt
201-
# Print versions we use
202-
- arm-none-eabi-gcc --version
203-
- python --version
204-
before_script:
205-
# Create BUILD directory for tests
206-
- mkdir BUILD
207-
script:
208-
# Run local mbed 2 testing
209-
- python -u tools/build_travis.py --vendor "${NAME#mbed2-}"
210-
- <<: *mbed-2
211-
env: NAME=mbed2-STM
212-
- <<: *mbed-2
213-
env: NAME=mbed2-NORDIC
214-
- <<: *mbed-2
215-
env: NAME=mbed2-SILICON_LABS
216-
- <<: *mbed-2
217-
env: NAME=mbed2-MAXIM
218-
- <<: *mbed-2
219-
env: NAME=mbed2-ATMEL
220-
- <<: *mbed-2
221-
env: NAME=mbed2-NUVOTON
222-
- <<: *mbed-2
223-
env: NAME=mbed2-RENESAS

TESTS/mbed_drivers/lp_timeout/main.cpp

Lines changed: 48 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -15,138 +15,79 @@
1515
*/
1616

1717
#if !DEVICE_LOWPOWERTIMER
18-
#error [NOT_SUPPORTED] Low power timer not supported for this target
18+
#error [NOT_SUPPORTED] Low power timer not supported for this target
1919
#endif
2020

21+
#include "mbed.h"
22+
#include "greentea-client/test_env.h"
2123
#include "utest/utest.h"
2224
#include "unity/unity.h"
23-
#include "greentea-client/test_env.h"
24-
25-
#include "mbed.h"
25+
#include "../timeout/timeout_tests.h"
2626

2727
using namespace utest::v1;
2828

29-
volatile static bool complete;
30-
static LowPowerTimeout lpt;
31-
32-
/* Timeouts are quite arbitrary due to large number of boards with varying level of accuracy */
33-
#define LONG_TIMEOUT (100000)
34-
#define SHORT_TIMEOUT (600)
35-
36-
void cb_done() {
37-
complete = true;
38-
}
39-
40-
#if DEVICE_SLEEP
41-
void lp_timeout_1s_deepsleep(void)
29+
utest::v1::status_t greentea_failure_handler(const Case * const source, const failure_t reason)
4230
{
43-
complete = false;
44-
LowPowerTimer timer;
45-
46-
/*
47-
* Since deepsleep() may shut down the UART peripheral, we wait for 10ms
48-
* to allow for hardware serial buffers to completely flush.
49-
50-
* This should be replaced with a better function that checks if the
51-
* hardware buffers are empty. However, such an API does not exist now,
52-
* so we'll use the wait_ms() function for now.
53-
*/
54-
wait_ms(10);
55-
56-
/*
57-
* We use here the low power timer instead of microsecond timer for start and
58-
* end because the microseconds timer might be disable during deepsleep.
59-
*/
60-
timer.start();
61-
lpt.attach(&cb_done, 1);
62-
/* Make sure deepsleep is allowed, to go to deepsleep */
63-
bool deep_sleep_allowed = sleep_manager_can_deep_sleep();
64-
TEST_ASSERT_TRUE_MESSAGE(deep_sleep_allowed, "Deep sleep should be allowed");
65-
sleep();
66-
while (!complete);
67-
68-
/* It takes longer to wake up from deep sleep */
69-
TEST_ASSERT_UINT32_WITHIN(LONG_TIMEOUT, 1000000, timer.read_us());
70-
TEST_ASSERT_TRUE(complete);
31+
greentea_case_failure_abort_handler(source, reason);
32+
return STATUS_CONTINUE;
7133
}
7234

73-
void lp_timeout_1s_sleep(void)
74-
{
75-
complete = false;
76-
Timer timer;
77-
timer.start();
78-
79-
sleep_manager_lock_deep_sleep();
80-
lpt.attach(&cb_done, 1);
81-
bool deep_sleep_allowed = sleep_manager_can_deep_sleep();
82-
TEST_ASSERT_FALSE_MESSAGE(deep_sleep_allowed, "Deep sleep should be disallowed");
83-
sleep();
84-
while (!complete);
85-
sleep_manager_unlock_deep_sleep();
86-
87-
TEST_ASSERT_UINT32_WITHIN(LONG_TIMEOUT, 1000000, timer.read_us());
88-
TEST_ASSERT_TRUE(complete);
89-
}
90-
#endif /* DEVICE_SLEEP */
35+
Case cases[] = {
36+
Case("Callback called once (attach)", test_single_call<AttachTester<LowPowerTimeout> >),
37+
Case("Callback called once (attach_us)", test_single_call<AttachUSTester<LowPowerTimeout> >),
9138

92-
void lp_timeout_us(uint32_t delay_us, uint32_t tolerance)
93-
{
94-
complete = false;
95-
Timer timer;
96-
timer.start();
39+
Case("Callback not called when cancelled (attach)", test_cancel<AttachTester<LowPowerTimeout> >),
40+
Case("Callback not called when cancelled (attach_us)", test_cancel<AttachUSTester<LowPowerTimeout> >),
9741

98-
lpt.attach_us(&cb_done, delay_us);
99-
while (!complete);
42+
Case("Callback override (attach)", test_override<AttachTester<LowPowerTimeout> >),
43+
Case("Callback override (attach_us)", test_override<AttachUSTester<LowPowerTimeout> >),
10044

101-
/* Using RTC which is less accurate */
102-
TEST_ASSERT_UINT32_WITHIN(tolerance, delay_us, timer.read_us());
103-
TEST_ASSERT_TRUE(complete);
104-
}
45+
Case("Multiple timeouts running in parallel (attach)", test_multiple<AttachTester<LowPowerTimeout> >),
46+
Case("Multiple timeouts running in parallel (attach_us)", test_multiple<AttachUSTester<LowPowerTimeout> >),
10547

106-
void lp_timeout_5s(void)
107-
{
108-
lp_timeout_us(5000000, LONG_TIMEOUT);
109-
}
48+
Case("Zero delay (attach)", test_no_wait<AttachTester<LowPowerTimeout> >),
49+
Case("Zero delay (attach_us)", test_no_wait<AttachUSTester<LowPowerTimeout> >),
11050

111-
void lp_timeout_1s(void)
112-
{
113-
lp_timeout_us(1000000, LONG_TIMEOUT);
114-
}
51+
Case("10 ms delay accuracy (attach)", test_delay_accuracy<AttachTester<LowPowerTimeout>, 10000, SHORT_DELTA_US>,
52+
greentea_failure_handler),
53+
Case("10 ms delay accuracy (attach_us)", test_delay_accuracy<AttachUSTester<LowPowerTimeout>, 10000, SHORT_DELTA_US>,
54+
greentea_failure_handler),
11555

116-
void lp_timeout_1ms(void)
117-
{
118-
lp_timeout_us(1000, SHORT_TIMEOUT);
119-
}
56+
Case("1 s delay accuracy (attach)", test_delay_accuracy<AttachTester<LowPowerTimeout>, 1000000, LONG_DELTA_US>,
57+
greentea_failure_handler),
58+
Case("1 s delay accuracy (attach_us)", test_delay_accuracy<AttachUSTester<LowPowerTimeout>, 1000000, LONG_DELTA_US>,
59+
greentea_failure_handler),
12060

121-
void lp_timeout_500us(void)
122-
{
123-
lp_timeout_us(500, SHORT_TIMEOUT);
124-
125-
}
61+
Case("5 s delay accuracy (attach)", test_delay_accuracy<AttachTester<LowPowerTimeout>, 5000000, LONG_DELTA_US>,
62+
greentea_failure_handler),
63+
Case("5 s delay accuracy (attach_us)", test_delay_accuracy<AttachUSTester<LowPowerTimeout>, 5000000, LONG_DELTA_US>,
64+
greentea_failure_handler),
12665

127-
utest::v1::status_t greentea_failure_handler(const Case *const source, const failure_t reason) {
128-
greentea_case_failure_abort_handler(source, reason);
129-
return STATUS_CONTINUE;
130-
}
131-
132-
Case cases[] = {
133-
Case("500us LowPowerTimeout", lp_timeout_500us, greentea_failure_handler),
134-
Case("1ms LowPowerTimeout", lp_timeout_1ms, greentea_failure_handler),
135-
Case("1sec LowPowerTimeout", lp_timeout_1s, greentea_failure_handler),
136-
Case("5sec LowPowerTimeout", lp_timeout_5s, greentea_failure_handler),
13766
#if DEVICE_SLEEP
138-
Case("1sec LowPowerTimeout from sleep", lp_timeout_1s_sleep, greentea_failure_handler),
139-
Case("1sec LowPowerTimeout from deepsleep", lp_timeout_1s_deepsleep, greentea_failure_handler),
140-
#endif /* DEVICE_SLEEP */
67+
Case("1 s delay during sleep (attach)", test_sleep<AttachTester<LowPowerTimeout>, 1000000, LONG_DELTA_US>,
68+
greentea_failure_handler),
69+
Case("1 s delay during sleep (attach_us)", test_sleep<AttachUSTester<LowPowerTimeout>, 1000000, LONG_DELTA_US>,
70+
greentea_failure_handler),
71+
72+
Case("1 s delay during deepsleep (attach)", test_deepsleep<AttachTester<LowPowerTimeout>, 1000000, LONG_DELTA_US>,
73+
greentea_failure_handler),
74+
Case("1 s delay during deepsleep (attach_us)", test_deepsleep<AttachUSTester<LowPowerTimeout>, 1000000, LONG_DELTA_US>,
75+
greentea_failure_handler),
76+
#endif
77+
78+
Case("Timing drift (attach)", test_drift<AttachTester<LowPowerTimeout> >),
79+
Case("Timing drift (attach_us)", test_drift<AttachUSTester<LowPowerTimeout> >),
14180
};
14281

143-
utest::v1::status_t greentea_test_setup(const size_t number_of_cases) {
144-
GREENTEA_SETUP(20, "default_auto");
82+
utest::v1::status_t greentea_test_setup(const size_t number_of_cases)
83+
{
84+
GREENTEA_SETUP(240, "timing_drift_auto");
14585
return greentea_test_setup_handler(number_of_cases);
14686
}
14787

14888
Specification specification(greentea_test_setup, cases, greentea_test_teardown_handler);
14989

150-
int main() {
90+
int main()
91+
{
15192
Harness::run(specification);
15293
}

0 commit comments

Comments
 (0)