[riot-notifications] [RIOT-OS/RIOT] Single tasking (#11226)

Marian Buschsieweke notifications at github.com
Thu Mar 21 11:35:39 CET 2019


### Contribution description
#### Summary
Moved multi-tasking support to module `core_multi_tasking` and enabled it by default. Added module `core_single_tasking` that adds enough mock APIs to allow get `examples/hello-world` compiled and running on ARM and AVR without multi-tasking support.

#### How to Use
Build with your application using
    
    DISABLE_MODULE="core_multi_tasking core_msg" make

(`core_msg` needs to be disabled as well, as it depends on multi-tasking support
and will pull `core_multi_tasking` back in if not disabled as well.)

#### Concept
The idea is that most code not requiring multi-tasking support can be compiled unmodified with multi-tasking disabled. This can only be achieved by providing all RIOT APIs that can be used more or less reasonable in a single-tasking environment. The implementation of these APIs range from total mock versions (e.g. `thread_yield()`) that simple don't do anything to specialized implementations (e.g. `mutex.h`), that exploit the fact that code can only run in two contexts: In the single thread or in ISR context.
    
#### Outlook
Currently mock APIs for internal stuff like `sched_context_switch_request` and `sched_task_exit()` and `sched_run()` are also provided, as the platform specific code relies on their existence. By making the platform depended code aware of single-tasking, a lot of code could be elided there as well. This would ultimately allow to drop the mock APIs from `sched.h` for the single-tasking flavour of RIOT.

#### Numbers
| Board           | `text` | `data` | `bss`  |
|:--------------- | ------:| ------:| ------:|
| `nucleo-f303re` | -812B  | -12B   | -2000B |
| `arduino-uno`   | -1664B | +168B  | -874B  |

(Negative numbers sizes means disabling multi tasking resulted in lower memory footprint, positive means memory footprint increased. I compilied with `BUILD_IN_DOCKER=1`.)

### Testing procedure
Everything but `examples/hello-world` should compile and run as nothing ever happened, as multi-tasking support is enabled by default. In `examples/hello-world` multi tasking support has been disabled, but it hopefully still compiles and runs as before

### Issues/PRs references
https://github.com/RIOT-OS/RIOT/issues/11199
You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/11226

-- Commit Summary --

  * core: Allow disabling multi-tasking
  * examples/hello-world: Disable multi-tasking

-- File Changes --

    M Makefile.dep (9)
    M Makefile.include (3)
    M core/Makefile (11)
    A core/Makefile.include (5)
    M core/include/debug.h (2)
    M core/include/mutex.h (48)
    M core/include/thread.h (392)
    A core/multi_tasking/Makefile (12)
    R core/multi_tasking/cond.c (0)
    R core/multi_tasking/include/cond.h (0)
    R core/multi_tasking/include/mbox.h (0)
    R core/multi_tasking/include/msg.h (0)
    A core/multi_tasking/include/mutex_backend.h (78)
    R core/multi_tasking/include/native_sched.h (0)
    R core/multi_tasking/include/rmutex.h (0)
    R core/multi_tasking/include/sched.h (0)
    A core/multi_tasking/include/thread_backend.h (410)
    R core/multi_tasking/include/thread_flags.h (0)
    R core/multi_tasking/kernel_init.c (0)
    R core/multi_tasking/mbox.c (0)
    R core/multi_tasking/msg.c (0)
    R core/multi_tasking/mutex.c (0)
    R core/multi_tasking/rmutex.c (0)
    R core/multi_tasking/sched.c (0)
    R core/multi_tasking/thread.c (0)
    R core/multi_tasking/thread_flags.c (0)
    A core/single_tasking/Makefile (2)
    A core/single_tasking/include/msg.h (36)
    A core/single_tasking/include/mutex_backend.h (68)
    A core/single_tasking/include/rmutex.h (92)
    A core/single_tasking/include/sched.h (120)
    A core/single_tasking/include/thread_backend.h (51)
    A core/single_tasking/kernel_init.c (38)
    A core/single_tasking/mutex.c (64)
    A core/single_tasking/sched.c (47)
    A core/single_tasking/thread.c (80)
    M examples/hello-world/Makefile (4)
    M makefiles/defaultmodules.inc.mk (2)
    M makefiles/pseudomodules.inc.mk (4)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/11226.patch
https://github.com/RIOT-OS/RIOT/pull/11226.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11226
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190321/71ab7604/attachment.html>


More information about the notifications mailing list