Skip to content

Bring in improved HAL APIs to master #7009

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 156 commits into from
May 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
156 commits
Select commit Hold shift + click to select a range
b768218
Sleep: add time requirements for sleep
0xc0170 Sep 8, 2017
be98bc0
Add Sleep test specification to sleep_api.h.
mprse Nov 16, 2017
b2d3338
Add test and test header to Sleep HAL API.
mprse Nov 16, 2017
3cd3def
Disable boards which does not fulfil new sleep standards.
mprse Dec 21, 2017
160c75d
tests-mbed_hal-sleep: add lp/us ticker overflow handling.
mprse Mar 27, 2018
20a9da5
tests-mbed_hal-sleep: use lp ticker data while testing deepsleep.
mprse Mar 27, 2018
7f56bb0
tests-mbed_hal-sleep: remove unused variable.
mprse Mar 28, 2018
996374e
tests-mbed_hal-sleep: fix formatting.
mprse Mar 28, 2018
f226ae2
tests-mbed_hal-sleep: decrease delay when testing if us ticker is dis…
mprse Mar 28, 2018
1df54ef
ARM_CM3DS_MPS2: add protection to lp_ticker.c.
mprse Mar 28, 2018
58afcc2
Disable SLEEP support for MAX32630FTHR and KW41Z platforms.
mprse Mar 29, 2018
2b7d7a8
tests-mbedmicro-rtos-mbed-systimer: execute sleep/deepsleep test case…
mprse Mar 29, 2018
48a769d
Disable `tests-mbed_drivers-timerevent` test if USTICKER support is d…
mprse Mar 29, 2018
785e5d3
Disable `tests-mbed_drivers-timeout` test if USTICKER support is disa…
mprse Apr 4, 2018
7a48ee8
Implementation of SLEEP feature for Renesas mbed boards
TomoYamanaka Mar 28, 2018
9f3f49a
Remove sleep from rf52 due to failig tests
bulislaw May 16, 2018
03d7141
Add documentation for the HAL Ticker API
c1728p9 Sep 19, 2017
c32ccf6
Add tests for ticker HAL API.
mprse Oct 2, 2017
0ae7b82
Add minor modifications of lp/us tickers tests desctiption in ticker …
mprse Oct 30, 2017
d429458
Disable boards which does not fulfil new ticker standards.
mprse Dec 19, 2017
ebeab7f
Add DEVICE_RTC symbol check in RTC source files for NCS36510 target.
mprse Jan 8, 2018
7227670
Skip higher level ticker tests for targets with stale ticker target s…
mprse Jan 9, 2018
a8eee0f
Modify requirement for the ticker_init function.
mprse Jan 19, 2018
1bd2e51
Modify ticker_init_test() to be consistent with the new requirement.
mprse Jan 19, 2018
9d84143
Provide fix to the implementation of ticker_overflow_test test case.
mprse Jan 19, 2018
2894152
Add free function to lp/us ticker HAL API
Jan 22, 2018
18943a9
Add lp/us ticker free() function implementation for NRF5
Jan 15, 2018
d96430e
Enable ticker support for K64F board.
mprse Feb 1, 2018
c4bd9d1
Adapt K64F us ticker driver to the new standards.
mprse Feb 1, 2018
39852f7
Adapt K64F lp ticker driver to the new standards.
mprse Feb 2, 2018
e0fcce5
lp_us_tickers test - provide counter overflow protection
mprse Feb 8, 2018
c4cf1f1
lp_us_tickers test - add tolerance to interrupt time.
mprse Feb 8, 2018
6d7aef6
lp_us_tickers test - fix count_ticks() function to give the same resu…
mprse Feb 13, 2018
b7fdf60
Skip higher level ticker tests for targets with stale ticker target s…
mprse Feb 22, 2018
f55f9d3
lp_ticker test - provide lp ticker glitch test case
mprse Feb 26, 2018
6e9f04b
Rename DEVICE_LOWPOWERTIMER to DEVICE_LPTICKER
bulislaw Mar 13, 2018
2d11b05
Disable Maxim boards as LP_TICKER is used in RTC and they don't respe…
bulislaw Mar 14, 2018
2d19ac1
Make sure LPTICKER symbols are not used for builds without it for Nordic
bulislaw Mar 20, 2018
9575dd2
Don't use tickless if LPTICKER is not present
bulislaw Mar 20, 2018
d2a5e30
Disable platfroms that fail without LPTICKER
bulislaw Mar 22, 2018
88ba942
Remove nrf51_dk from supported platform
bulislaw Mar 23, 2018
ba963b4
Rename lp_us tests to common and hf to microsecond
bulislaw Mar 23, 2018
a92ff94
Fix rebase error
bulislaw Mar 27, 2018
0ecf58f
lp_us_tickers test: fix `increment test` for slow boards
mprse Feb 27, 2018
8f52816
lp_us_tickers test: fix overflow protection
mprse Feb 27, 2018
f6163a3
lp_us_tickers test: call overflow_protect function in test functions …
mprse Mar 27, 2018
85ce887
lp_us_tickers test: provide minor fixes after review
mprse Mar 9, 2018
5590f2b
Re-implement RTC for Silicon Labs targets
stevew817 Mar 26, 2018
1448f81
Re-implement us_ticker and lp_ticker for Silicon Labs targets
stevew817 Mar 27, 2018
c3d5daf
Update STM32 16 bits us_tickers in line with new mbed HAL
LMESTM Mar 26, 2018
beda490
Make us_ticker common between 16 and 32 bits counters
LMESTM Mar 26, 2018
69b51df
tests-mbed_hal-lp_ticker : increase time before deep sleep
jeromecoutant Apr 9, 2018
9c2d758
Restore ticker state after each test
c1728p9 Apr 6, 2018
ea61f98
tests-mbed_hal-lp_ticker: Add overflow protection.
mprse Apr 10, 2018
b528fbd
Implementation of USTICKER feature for Renesas mbed boards
TomoYamanaka Mar 28, 2018
d2fff9c
tests-mbed_hal-common_tickers_freq : use unsigned long
jeromecoutant Apr 9, 2018
26313d8
tests-mbed_hal-common_tickers_freq : correct overflowCounter value
jeromecoutant Apr 9, 2018
1e13d87
Rename LOWPOWERTIMER to LPTICKER after merge
bulislaw Apr 19, 2018
5701fd5
STM32 LPTICKER update for targets supporting LPTIMER
jeromecoutant Mar 27, 2018
8179d96
LPTICKER targets json update for STM32 supporting LPTIMER
jeromecoutant Mar 27, 2018
2b8d6cb
STM32 LPTICKER : read counter
jeromecoutant Apr 17, 2018
12b3df7
#6536 rebase correction
jeromecoutant Apr 23, 2018
1c4174d
STM32 RTC Init minor update
jeromecoutant Apr 24, 2018
c31a7c2
STM32 LPTICKER : enable all STM32 targets supporting the feature
jeromecoutant Mar 28, 2018
39a9801
STM32 LPTICKER : clean include file
jeromecoutant Mar 28, 2018
e3deaec
STM32 LPTICKER update for targets supporting RTC
jeromecoutant Apr 24, 2018
533ad59
NRF5 - make us ticker to be driven by high speed 1MHz timer
mprse Nov 30, 2017
007a707
Enable us/lp ticker support for NRF51_DK board
mprse Jan 18, 2018
af2863a
Update lp ticker to be consistent with the new standards.
mprse Jan 19, 2018
2323486
tests-mbed_drivers-timerevent: perform test only if USTICKER support …
mprse Mar 6, 2018
8979212
tests-mbed_hal-lp_ticker: run sleep test only if SLEEP support is en…
mprse Mar 6, 2018
b524a7f
tests-mbed_drivers-lp_ticker: Adapt tolerance for new Ticker driver
mprse Mar 9, 2018
79f219b
tests-mbed_drivers-timer: Adapt tolerance for new Ticker driver
mprse Mar 9, 2018
bdfbad8
Rename DEVICE_LOWPOWERTIMER to DEVICE_LPTICKER.
mprse Mar 28, 2018
ff39a98
tests-mbed_hal-common_tickers: increase overflow protection limit
mprse Apr 23, 2018
1aaef7b
mbed_ticker_api remove specific case for 32768 in favor of all freque…
May 2, 2018
d35b298
Changed struct position to try to maintain binary compatibility
May 2, 2018
ce79492
Updated types according to header changes
May 2, 2018
e6bb770
Disable failig Nordic targets
bulislaw May 15, 2018
1e71515
Disable MAX targets failig to build
bulislaw May 16, 2018
77f738b
Move common_rtc.c and us_ticker.h files to the valid directory.
mprse May 17, 2018
ffd09f8
Enable support for NRF51 boards.
mprse May 17, 2018
4fe0688
tests-events-queue: modify tolerance to percentage form
mprse May 17, 2018
fac7d74
Disable us ticker in deep-sleep mode.
mprse May 17, 2018
a3d5921
tests-mbed_drivers-timerevent: Disable deep-sleep mode in TestTimerEv…
mprse May 17, 2018
75df9ec
tests-mbed_drivers-lp_ticker: increase tolerance for NRF51_DK
mprse May 17, 2018
7d96932
Enable support for NRF51 boards.
mprse May 18, 2018
c18763b
tests-mbed_hal-common_tickers: disable os tick while running test cases
mprse May 18, 2018
8706004
LPC1768: Enable usticker
mmahadevan108 May 17, 2018
132dc87
KL05, KL25, KL26, KL46: Enable usticker
mmahadevan108 May 17, 2018
0d0321a
MCUXpresso: Update Low Power Ticker
mmahadevan108 Mar 27, 2018
4eb8841
MCUXpresso: Update the usticker implementation
mmahadevan108 May 15, 2018
659be61
MCUXpresso: Enable usticker for LPC546XX and LPC54114
mmahadevan108 May 16, 2018
774de11
MCUXpresso: Enable usticker on MIMXRT1050_EVK
mmahadevan108 May 16, 2018
e514c2c
Fix us_ticker.c to support "USTICKER"
May 19, 2018
95559ad
Change LPTICKER spec to allow clock freq starting at 4kHz
bulislaw May 23, 2018
62254c2
KW41Z: Update usticker to use TPM instead of LPTMR for ticker
mmahadevan108 May 17, 2018
a21d21e
KL43Z: Update usticker to use TPM instead of LPTMR for ticker
mmahadevan108 May 18, 2018
d46af14
KL27Z: Update usticker to use TPM instead of LPTMR for ticker
mmahadevan108 May 18, 2018
3b7b0f1
KW41Z, KL43Z, KL27Z: Enable LPTICKER
mmahadevan108 May 18, 2018
fb622a2
MIMXRT1050_EVK: Update lpticker implementation
mmahadevan108 May 17, 2018
9ef0083
NRF52_DK: use new ticker driver designed for NRF51_DK
mprse May 21, 2018
b015357
NRF52_DK: Enable lp ticker and us ticker support
mprse May 21, 2018
50a5e2c
tests-mbed_hal-common_tickers: fix bug in ticker increment test case
mprse May 21, 2018
a0a07d9
tests-mbed_drivers-timerevent: increase tolerance for NRF52_DK
mprse May 21, 2018
06c6db5
tests-mbed_drivers-lp_timer: modify tolerance to percentage form
mprse May 21, 2018
be09839
tests-mbed_hal-flash: Remove 5% extra tolerance for NRF52_DK
mprse May 21, 2018
e7fa5fc
tests-mbed_hal-flash: optimieze time_cpu_cycles() function
mprse May 21, 2018
1d1b6cd
NRF52_DK: disable us ticker in deep-sleep mode
mprse May 21, 2018
11748bf
Enable us lp ticker support for entire MCU_NRF52832 family
mprse May 23, 2018
b88329a
mbed-os v5.9 USTICKER implementation
jessexm May 17, 2018
0ddec48
mbed-os v5.9 LPTICKER implementation
jessexm May 17, 2018
96ca7c2
Adding usticker to MTB_ODIN
May 23, 2018
f32f866
NRF52840_DK: Enable lp us ticker support
mprse May 24, 2018
3850c80
Make common_rtc.c compatible with SDK 14.2 and move it common dir
mprse May 23, 2018
efd307f
Rename new occurrences of LOWPOWERTIMER to LPTICKER
bulislaw May 24, 2018
7763768
Keep RTC API prototypes even when not enabled
c1728p9 Oct 24, 2017
a0a9626
Keep rtc code if low power timer is used
c1728p9 Oct 23, 2017
1f97f11
Add documentation and test the HAL RTC API
c1728p9 Aug 11, 2017
6d90c27
Turn off RTC until updated
c1728p9 Oct 12, 2017
5a79655
Modify rtc_api.h header file - update tests specification.
mprse Nov 2, 2017
a0f1627
Update of RTC HAL API tests.
mprse Nov 2, 2017
93a7db5
Add clarification to rtc_free doxygen
bulislaw Nov 23, 2017
c93ab16
Enable RTC support for FAMILY_STM32.
mprse Feb 21, 2018
105b0ab
HAL rtc test: check only if rtc_isenabled() returns 1 in case when in…
mprse Feb 21, 2018
a1d92e5
HAL rtc test: increase test timeout.
mprse Feb 21, 2018
c437e9d
tests-mbed_hal-rtc_reset: Add ack from the device after each command …
mprse Mar 7, 2018
7f451c6
Disable RTC support for UBLOX_EVK_ODIN_W2.
mprse Mar 7, 2018
4fc3d07
Enable RTC support for K64F board.
mprse Mar 1, 2018
377db73
K64F: adapt RTC drivers to the new standards (free function)
mprse Mar 1, 2018
1e46895
K64F: adapt RTC drivers to the new standards (is_enabled function)
mprse Mar 1, 2018
f55bece
Implement of RTC feature for Renesas mbed boards
TomoYamanaka Mar 28, 2018
4b3bde1
Re-implement RTC for Silicon Labs targets
stevew817 Mar 26, 2018
81e6c96
Code style fixes requested by @0xc0170
stevew817 Mar 27, 2018
2826e4e
Disable platforms not supporting new RTC
bulislaw Apr 19, 2018
a17cf07
MCUXpresso: Enable RTC support
mmahadevan108 Mar 26, 2018
f7c6e55
MCUXpresso: Enable RTC on LPC54114 and LPC546XX
mmahadevan108 Mar 26, 2018
dbebc71
ADI: Re-enable DEVICE_RTC for EV_COG_AD3029LZ and EV_COG_AD4050LZ
May 18, 2018
8d67000
Remove trailing spaces of adi_rtc.c
May 18, 2018
e2fe49d
Preserve RTC counter value while re-initialization
May 18, 2018
b9814fa
Fix missmatch between feature branches and new CMSIS
bulislaw May 24, 2018
9b53c1e
Fix target definition for Odin boards
bulislaw May 25, 2018
6781ee8
maxim: fix rtc if lp ticker not defined
0xc0170 May 25, 2018
73de4e6
efm32: remove unused undefined function from rtc
0xc0170 May 25, 2018
e1fc81d
max32600: fix lp ticker functions - do not inline
0xc0170 May 25, 2018
500be1f
Fix tolerance definition in ticker tests.
mprse May 25, 2018
a305d84
Rename LOWPOWERTIMER to LPTICKER
bulislaw May 25, 2018
7dbd025
NRF52 is not compatible with new RTC HAL spec
bulislaw May 25, 2018
7624a66
Sleep was not ported to MAX32630FTHR
bulislaw May 25, 2018
11d418b
mbed-os v5.9 RTC implementation
jessexm May 17, 2018
195ef38
Fix missmatch between targets.son
bulislaw May 25, 2018
1224b38
Disable RTC on MAX32630FTHR due to failing tests
bulislaw May 26, 2018
817bf0b
Disable intermittently failing sleep test
bulislaw May 26, 2018
dc6ad34
Disable FLASH for AD boards as they fail the tests intermittently
bulislaw May 26, 2018
a1ff22d
Disable FLASH algo for AD boards
bulislaw May 27, 2018
4ae6491
Disable sleep tests as they are unstable
bulislaw May 27, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion TESTS/events/queue/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,15 @@
#include "unity.h"
#include "utest.h"

#if !DEVICE_USTICKER
#error [NOT_SUPPORTED] test not supported
#endif

using namespace utest::v1;

// Assume that tolerance is 5% of measured time.
#define DELTA(ms) (ms / 20)

// TEST_EQUEUE_SIZE was reduced below 1024B to fit this test to devices with small RAM (RAM <= 16kB)
// additionally TEST_EQUEUE_SIZE was expressed in EVENTS_EVENT_SIZE to increase readability
// (for more details about EVENTS_EVENT_SIZE see EventQueue constructor)
Expand Down Expand Up @@ -89,7 +96,7 @@ SIMPLE_POSTS_TEST(0)


void time_func(Timer *t, int ms) {
TEST_ASSERT_INT_WITHIN(5, ms, t->read_ms());
TEST_ASSERT_INT_WITHIN(DELTA(ms), ms, t->read_ms());
t->reset();
}

Expand Down
3 changes: 3 additions & 0 deletions TESTS/events/timing/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@

using namespace utest::v1;

#if !DEVICE_USTICKER
#error [NOT_SUPPORTED] test not supported
#endif

// Test delay
#ifndef TEST_EVENTS_TIMING_TIME
Expand Down
144 changes: 144 additions & 0 deletions TESTS/host_tests/rtc_reset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
"""
mbed SDK
Copyright (c) 2017-2017 ARM Limited

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from __future__ import print_function

from mbed_host_tests import BaseHostTest
from time import sleep


class RtcResetTest(BaseHostTest):
"""This test checks that a device's RTC keeps count through a reset

It does this by setting the RTC's time, triggering a reset,
delaying and then reading the RTC's time again to ensure
that the RTC is still counting.
"""

"""Start of the RTC"""
START_TIME = 50000
START_TIME_TOLERANCE = 10
"""Time to delay after sending reset"""
DELAY_TIME = 5.0
DELAY_TOLERANCE = 1.0
VALUE_PLACEHOLDER = "0"

def setup(self):
"""Register callbacks required for the test"""
self._error = False
generator = self.rtc_reset_test()
generator.next()

def run_gen(key, value, time):
"""Run the generator, and fail testing if the iterator stops"""
if self._error:
return
try:
generator.send((key, value, time))
except StopIteration:
self._error = True

for resp in ("start", "read", "ack"):
self.register_callback(resp, run_gen)

def teardown(self):
"""No work to do here"""
pass

def rtc_reset_test(self):
"""Generator for running the reset test

This function calls yield to wait for the next event from
the device. If the device gives the wrong response, then the
generator terminates by returing which raises a StopIteration
exception and fails the test.
"""

# Wait for start token
key, value, time = yield
if key != "start":
return

# Initialize, and set the time
self.send_kv("init", self.VALUE_PLACEHOLDER)

# Wait for ack from the device
key, value, time = yield
if key != "ack":
return

self.send_kv("write", str(self.START_TIME))

# Wait for ack from the device
key, value, time = yield
if key != "ack":
return

self.send_kv("read", self.VALUE_PLACEHOLDER)
key, value, time = yield
if key != "read":
return
dev_time_start = int(value)

# Unitialize, and reset
self.send_kv("free", self.VALUE_PLACEHOLDER)

# Wait for ack from the device
key, value, time = yield
if key != "ack":
return

self.send_kv("reset", self.VALUE_PLACEHOLDER)

# No ack after reset
sleep(self.DELAY_TIME)

# Restart the test, and send the sync token
self.send_kv("__sync", "00000000-0000-000000000-000000000000")
key, value, time = yield
if key != "start":
return

# Initialize, and read the time
self.send_kv("init", self.VALUE_PLACEHOLDER)

# Wait for ack from the device
key, value, time = yield
if key != "ack":
return

self.send_kv("read", self.VALUE_PLACEHOLDER)
key, value, time = yield
if key != "read":
return
dev_time_end = int(value)

# Check result
elapsed = dev_time_end - dev_time_start
start_time_valid = (self.START_TIME <= dev_time_start <
self.START_TIME + self.START_TIME_TOLERANCE)
elapsed_time_valid = elapsed >= self.DELAY_TIME - self.DELAY_TOLERANCE
passed = start_time_valid and elapsed_time_valid
if not start_time_valid:
self.log("FAIL: Expected start time of %i got %i" %
(self.START_TIME, dev_time_start))
elif not passed:
self.log("FAIL: Delayed for %fs but device "
"reported elapsed time of %fs" %
(self.DELAY_TIME, elapsed))
self.send_kv("exit", "pass" if passed else "fail")
yield # No more events expected

13 changes: 7 additions & 6 deletions TESTS/mbed_drivers/lp_ticker/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "unity/unity.h"


#if !DEVICE_LOWPOWERTIMER
#if !DEVICE_LPTICKER
#error [NOT_SUPPORTED] Low power ticker not supported for this target
#endif

Expand All @@ -33,8 +33,9 @@ static const int test_timeout = 10;
/* Due to poor accuracy of LowPowerTicker on many platforms
there is no sense to tune tolerance value as it was in Ticker tests.

Tolerance value is set to 2000us to cover this diversity */
#define TOLERANCE_US 2000
Tolerance value is set to 600us for measurement inaccuracy + 5% tolerance
for LowPowerTicker. */
#define TOLERANCE_US(DELAY) (600 + DELAY / 20)


volatile uint32_t ticker_callback_flag;
Expand Down Expand Up @@ -117,7 +118,7 @@ void test_multi_call_time(void)
while(!ticker_callback_flag);
time_diff = gtimer.read_us();

TEST_ASSERT_UINT32_WITHIN(TOLERANCE_US, MULTI_TICKER_TIME_MS * 1000, time_diff);
TEST_ASSERT_UINT32_WITHIN(TOLERANCE_US(MULTI_TICKER_TIME_MS * 1000), MULTI_TICKER_TIME_MS * 1000, time_diff);
}
}

Expand Down Expand Up @@ -167,7 +168,7 @@ void test_attach_time(void)
ticker.detach();
const int time_diff = gtimer.read_us();

TEST_ASSERT_UINT64_WITHIN(TOLERANCE_US, DELAY_US, time_diff);
TEST_ASSERT_UINT64_WITHIN(TOLERANCE_US(DELAY_US), DELAY_US, time_diff);
}

/** Test single callback time via attach_us
Expand All @@ -189,7 +190,7 @@ void test_attach_us_time(void)
ticker.detach();
const int time_diff = gtimer.read_us();

TEST_ASSERT_UINT64_WITHIN(TOLERANCE_US, DELAY_US, time_diff);
TEST_ASSERT_UINT64_WITHIN(TOLERANCE_US(DELAY_US), DELAY_US, time_diff);
}

// Test cases
Expand Down
4 changes: 2 additions & 2 deletions TESTS/mbed_drivers/lp_timeout/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#if !DEVICE_LOWPOWERTIMER
#error [NOT_SUPPORTED] Low power timer not supported for this target
#if !DEVICE_LPTICKER
#error [NOT_SUPPORTED] Low power timer not supported for this target
#endif

#include "mbed.h"
Expand Down
Loading