@@ -28,17 +28,16 @@ Applications in Tock are the user-level code meant to accomplish some type of
28
28
task for the end user. Applications are distinguished from kernel code which
29
29
handles device drivers, chip-specific details, and general operating system
30
30
tasks. Unlike many existing embedded operating systems, in Tock applications
31
- are not built as one with the kernel. Instead they are entirely separate code
31
+ are not compiled with the kernel. Instead they are entirely separate code
32
32
that interact with the kernel and each other through [ system
33
33
calls] ( https://en.wikipedia.org/wiki/System_call ) .
34
34
35
35
Since applications are not a part of the kernel, they may be written in any
36
- language that can be compiled into code capable of running on ARM Cortex-M
37
- processors. While the Tock kernel is written in Rust, applications are commonly
38
- written in C. Additionally, Tock supports running multiple applications
39
- concurrently. Co-operatively multiprogramming is the default, but applications
40
- may also be time sliced. Applications may talk to each other via Inter-Process
41
- Communication (IPC) through system calls.
36
+ language that can be compiled into code capable of running on a microcontroller.
37
+ Tock supports running multiple applications concurrently. Co-operatively
38
+ multiprogramming is the default, but applications may also be time sliced.
39
+ Applications may talk to each other via Inter-Process Communication (IPC)
40
+ through system calls.
42
41
43
42
Applications do not have compile-time knowledge of the address at which they
44
43
will be installed and loaded. In the current design of Tock, applications must
@@ -49,9 +48,9 @@ of PIC for Tock apps is not a fundamental choice, future versions of the system
49
48
may support run-time relocatable code.
50
49
51
50
Applications are unprivileged code. They may not access all portions of memory
52
- and may, in fact, fault if they attempt to access memory outside of their
53
- boundaries (similarly to segmentation faults in Linux code). In order to
54
- interact with hardware, applications must make calls to the kernel.
51
+ and will fault if they attempt to access memory outside of their boundaries
52
+ (similarly to segmentation faults in Linux code). To interact with hardware,
53
+ applications must make calls to the kernel.
55
54
56
55
57
56
## System Calls
@@ -96,30 +95,30 @@ timer fires. Specific state that you want the callback to act upon can be
96
95
passed as the pointer ` userdata ` . After the application has started the timer,
97
96
calls ` yield ` , and the timer fires, the callback function will be called.
98
97
99
- It is important to note that ` yield ` must be called in order for events to be
100
- serviced in the current implementation of Tock. Callbacks to the application
101
- will be queued when they occur but the application will not receive them until
102
- it yields. This is not fundamental to Tock, and future version may service
103
- callbacks on any system call or when performing application time slicing. After
104
- receiving and running the callback, application code will continue after the
105
- ` yield ` . Tock automatically calls ` yield ` continuously for applications that
106
- return from execution (for example, an application that returns from ` main ` ) .
98
+ It is important to note that ` yield ` must be called for events to be serviced in
99
+ the current implementation of Tock. Callbacks to the application will be queued
100
+ when they occur but the application will not receive them until it yields. This
101
+ is not fundamental to Tock, and future version may service callbacks on any
102
+ system call or when performing application time slicing. After receiving and
103
+ running the callback, application code will continue after the ` yield ` .
104
+ Applications which are "finished" (i.e. have returned from ` main() ` ) should call
105
+ ` yield ` in a loop to avoid being scheduled by the kernel .
107
106
108
107
109
108
## Inter-Process Communication
110
109
111
110
IPC allows for multiple applications to communicate directly through shared
112
111
buffers. IPC in Tock is implemented with a service-client model. Each app can
113
- support one service and the service is identified by the ` PACKAGE_NAME ` variable
114
- set in its Makefile. An app can communicate with multiple services and will get
115
- a unique handle for each discovered service. Clients and services communicate
116
- through shared buffers. Each client can share some of its own application memory
117
- with the service and then notify the service to instruct it to parse the shared
118
- buffer.
112
+ support one service and the service is identified by its package name which is
113
+ included in the Tock Binary Format Header for the app. An app can communicate
114
+ with multiple services and will get a unique handle for each discovered service.
115
+ Clients and services communicate through shared buffers. Each client can share
116
+ some of its own application memory with the service and then notify the service
117
+ to instruct it to parse the shared buffer.
119
118
120
119
### Services
121
120
122
- Services are named by the ` PACKAGE_NAME ` variable in the application Makefile .
121
+ Services are named by the package name included in the app's TBF header .
123
122
To register a service, an app can call ` ipc_register_svc() ` to setup a callback.
124
123
This callback will be called whenever a client calls notify on that service.
125
124
0 commit comments