Skip to content

Commit b4c7caa

Browse files
rajkan01iriark01
andauthored
Documentation update on tickless mode porting guide (#1337)
* Documentation update on tickless mode porting guide * First thing: fixing header levels * Apply suggestions from code review Co-authored-by: Irit Arkin <[email protected]> * Incorporated the review comments * Commit the suggestion Co-authored-by: Irit Arkin <[email protected]>
1 parent 001fab9 commit b4c7caa

File tree

5 files changed

+50
-20
lines changed

5 files changed

+50
-20
lines changed

docs/porting/target/tickless.md

Lines changed: 0 additions & 20 deletions
This file was deleted.
Loading
1.29 KB
Loading
Loading
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Tickless mode
2+
3+
Tickless mode is an optimization mechanism available in RTOS for suspending the SysTick. You can use it in situations when RTOS is idle for multiple ticks, so you can save power by entering uninterrupted sleep.
4+
5+
## Scheduling and sleep modes in Mbed OS
6+
7+
Mbed OS uses the SysTick timer in periods of 1ms to process threads' scheduling.
8+
9+
For instance, a system running two threads would see this timing:
10+
11+
![](resources/Normal_Tick.png)
12+
13+
Note that the device never enters deep sleep and wastes cycles in SysTick while all threads are asleep.
14+
15+
## Tickless mode
16+
17+
To support tickless mode in Mbed OS, your target needs to meet two requirements:
18+
19+
- Support for Sleep HAL API.
20+
- Support for either Low Power or Microsecond Ticker HAL API.
21+
22+
To enable tickless mode for your target, add the `MBED_TICKLESS` macro in `target.json` (in your target's section):
23+
24+
```json
25+
"macros_add": [
26+
"MBED_TICKLESS"
27+
]
28+
```
29+
30+
When tickless mode is enabled, Mbed OS's default [OsTimer](../mbed-os-api-doxy/structos__timer__def.html), based on the [low power ticker](../mbed-os-api-doxy/group__hal__lp__ticker.html), replaces SysTick. If a target's low power ticker has an excessively long wake-up time or other performance issues, make it use the [microsecond ticker](../mbed-os-api-doxy/group__hal__us__ticker.html) instead, by adding the `tickless-from-us-ticker` configuration in 'target.json' (in your target's section). This configuration is not required for a target that does not have low power ticker, because it will default to the microsecond ticker.
31+
32+
```json
33+
"overrides": {
34+
"tickless-from-us-ticker": true
35+
}
36+
```
37+
38+
If tickless mode uses the microsecond ticker, the device will enter sleep rather than deep sleep, but will still avoid unnecessary tick calls.
39+
40+
The expected scheduling for the previous use case should look like:
41+
42+
![](resources/Tickless.png)
43+
44+
## Testing
45+
46+
There are no dedicated tests validating tickless mode. Running all Mbed OS test suites, with particular focus on HAL sleep and HAL low power ticker tests, provides sufficient coverage.
47+
48+
## References
49+
50+
You can find more details on sleep modes in Mbed OS in the section [Mbed OS power management (sleep)](../apis/power-management-sleep.html)

0 commit comments

Comments
 (0)