O'Reilly logo

Embedded Systems Architecture by Daniele Lacamera

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

System calls

The latest evolution of the example operating system implemented in this chapter no longer allows our tasks to control system resources, such as input and output peripherals, and does not even allow the tasks to block voluntarily, as the sleep_ms function would not be allowed to set the pending flag to initiate a context switch.

The operating system exports an API that is accessible by the tasks through a system-call mechanism using the SVCall exception, handled by the isr_svc service routine, and triggered at any time from tasks through the instruction svc.

In this simple example, we use the svc 0 assembly instruction to switch to handler mode, by defining a shortcut macro, SVC():

#define SVC() asm volatile ("svc 0")

We wrap ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required