You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* add the Tock Workshop inital track
* added prerequisites
* fixed introduction typo
* architecture WIP
* added build capsule task
* Small fixes
This commit adds the prerequisites for `probe-rs` and adds some
clarifications regarding some of the necessary actions.
* fix: added list output
* added test application task
* nit: fixed format on list
* added periodic print task
* added thermistor task
* Add GitHub links for the repositories
* Small fixes
This commit adds small fixes based on the received feedback.
* Add NixOS alternative for TockWorld.
This commit adds a NixOS VM alternative for Windows users or
user that don't want to follow the prerequisites. The text of
the workshop has been modified to reflect this addition.
---------
Co-authored-by: George-Dănuț Aldea <[email protected]>
Co-authored-by: Darius-Andrei Jipa <[email protected]>
Co-authored-by: Darius-Andrei Jipa <[email protected]>
Co-authored-by: Darius-Andrei Jipa <[email protected]>
Copy file name to clipboardExpand all lines: docs/tock_workshop/index.md
+42-15Lines changed: 42 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,16 +2,17 @@
2
2
3
3
## Prerequisites
4
4
5
+
:::note Windows Users or participants that are willing to use a VM
6
+
This workshop will not work on Windows systems.
7
+
You can try following the guide using a Linux VM/WSL2,
8
+
or you can use the NixOS VM we provide [here](https://drive.google.com/file/d/1-jOsuWdSnOlmyupMWb3Vw4oG_t77BnwQ/view?usp=sharing) (only works on VirtualBox).
9
+
The username and password are both `ipwembedded`.
10
+
If you will be using the NixOS VM, you can skip the prerequisites.
11
+
:::
5
12
### Rust Toolchain
6
13
7
14
You will need to install the Rust toolchain. To do so, you can follow the instructions on the [Getting started](https://www.rust-lang.org/learn/get-started) page of the Rust Language website.
8
15
9
-
:::info Windows Install Tips
10
-
If you are using Windows, you may be prompted to install [Visual Studio C++ Build tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/). If so, follow the instructions from the previous link.
11
-
12
-
Even if Visual Studio is already on your machine, rustup will not verify if the required components are present. If you experience issues with the `rustup` installation on Windows, please follow [these instructions](https://rust-lang.github.io/rustup/installation/windows-msvc.html) to manually add the missing components.
13
-
:::
14
-
15
16
To verify that the installation, open a terminal and run `rustup --version`. If everything went well, you should see an output similar to this:
16
17
17
18
```shell
@@ -32,7 +33,7 @@ The simplest installation method involves using the `cargo` packet manager, but
You don't have to clone the Tock OS repository, it is already cloned in the home directory.
131
+
You will have to run `nix-shell` once you enter the `tock` directory.
132
+
:::
133
+
128
134
The configuration for the various boards supported can be found in the `boards` directory. To compile the kernel, you can use the `cargo flash` utility.
129
135
130
136
```shell
131
137
cd boards/cy8cproto_62_4343_w
138
+
make flash
139
+
```
140
+
141
+
Alternatively, you can use the `cargo flash` while inside the board's directory.
142
+
143
+
If you did everything correctly, you should be able to use the `tockloader listen` command to interact with the kernel. When prompted to select a serial port, pick the one that ends with `KitProg3 CMSIS-DAP`.
144
+
145
+
:::note NixOS VM users
146
+
Currently, `tockloader` doesn't work on NixOS, but we have included the program `picocom`
147
+
which you can use with the following command: `picocom -b 115200 /dev/ttyACM0`. (use `sudo` if it gives an error about permissions)
148
+
:::
149
+
132
150
cargo flash
133
151
```
134
152
@@ -149,7 +167,7 @@ Which option? [0] 1
149
167
[INFO ] Using "/dev/cu.usbmodem1103 - KitProg3 CMSIS-DAP".
You don't have to clone the libtock-c repository, it is already cloned in the home directory.
184
+
You will have to run `nix-shell` once you enter the `libtock-c` directory.
185
+
Make sure you don't run that command if you already ran `nix-shell` inside another directory (either run `exit` before, or use another shell).
186
+
:::
187
+
164
188
Navigate to the `examples/blink` folder and take a look at the C application structure found in `main.c`. To compile the application, simply run `make`. This command will built the example applications for all target architectures supported by the library. Apps are compiled into TBFs (Tock Binary Format), and can be found in the `build/<arch>` sub-directories. Tock also generates an archive of the same app, compiled for multiple architectures, for ease of use and portability, called a TAB(Tock Application Bundle) which can be loaded using the `tockloader` utility.
165
189
166
190
### Flashing the application
@@ -186,7 +210,7 @@ Which option? [0] 1
186
210
[INFO ] Using "/dev/cu.usbmodem1103 - KitProg3 CMSIS-DAP".
187
211
[INFO ] Listening for serial output
188
212
189
-
$tock list
213
+
tock$ list
190
214
PID ShortID Name Quanta Syscalls Restarts Grants State
Do not forget to add `pub mod mock;` in `boards/components/src/lib.rs`.
486
+
:::
487
+
460
488
The allocation of the memory segments is usually done through a marco. It is out of this workshop's scope to dive into writing macros, but the macro bellow takes a `type` that must implement the `hil::time::Alarm` trait and returns a tuple of static mutable references to `MaybeUninit` wrappers of the `VirtualMuxAlarm` nad the `MockCapsule`.
461
489
462
490
```rust title="boards/components/src/mock.rs"
@@ -744,8 +772,7 @@ impl<'a, A: adc::AdcChannel<'a>> adc::Client for Cy8cprotoThermistor<'a, A> {
744
772
745
773
#### Defining the component
746
774
747
-
As before, we need to ensure the capsule can be easily configured by implementing a new `Component`. You can name the module `cyc8cproto_thermistor.rs`.
748
-
775
+
As before, we need to ensure the capsule can be easily configured by implementing a new `Component`. You can name the module `cy8cproto_thermistor.rs`.
749
776
We should start from the bottom up, considering what should be needed to instantiate this capsule. These are the `AdcChannel`s and an `MuxAdc`, to be able to multiplex an ADC peripheral to sample multiple channels.
The `finalize` implementation of the `Component` trait will need to create the two virtual `AdcDevices` that multiplex the peripheral, and therefore, the static memory needed must accommodate the two devices, and the thermistor capsule.
0 commit comments