Skip to content

Commit 43508d8

Browse files
committed
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.
1 parent 07dcd7f commit 43508d8

1 file changed

Lines changed: 27 additions & 9 deletions

File tree

docs/tock_workshop/index.md

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@
22

33
## Prerequisites
44

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+
:::
12+
513
### Rust Toolchain
614

715
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.
816

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-
1517
To verify that the installation, open a terminal and run `rustup --version`. If everything went well, you should see an output similar to this:
1618

1719
```shell
@@ -32,7 +34,7 @@ The simplest installation method involves using the `cargo` packet manager, but
3234
sudo apt install -y pkg-config libudev-dev cmake git
3335
```
3436

35-
* On Mac OS and Windows, no additional setup is needed.
37+
* On Mac OS, no additional setup is needed.
3638

3739
After that, use `cargo` to install `probe-rs`:
3840

@@ -107,6 +109,11 @@ git clone https://github.com/OxidosAutomotive/tock.git --branch=psoc6-workshop
107109
cd tock
108110
```
109111

112+
:::note NixOS VM users
113+
You don't have to clone the Tock OS repository, it is already cloned in the home directory.
114+
You will have to run `nix-shell` once you enter the `tock` directory.
115+
:::
116+
110117
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.
111118

112119
```shell
@@ -118,6 +125,11 @@ Alternatively, you can use the `cargo flash` while inside the board's directory.
118125

119126
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`.
120127

128+
:::note NixOS VM users
129+
Currently, `tockloader` doesn't work on NixOS, but we have included the program `picocom`
130+
which you can use with the following command: `picocom -b 115200 /dev/ttyACM0`. (use `sudo` if it gives an error about permissions)
131+
:::
132+
121133
```shell
122134
tockloader listen
123135
[INFO ] No device name specified. Using default name "tock".
@@ -131,7 +143,7 @@ Which option? [0] 1
131143
[INFO ] Using "/dev/cu.usbmodem1103 - KitProg3 CMSIS-DAP".
132144
[INFO ] Listening for serial output
133145

134-
$tock
146+
tock$
135147
```
136148

137149
### Compiling an application
@@ -143,6 +155,12 @@ git clone https://github.com/ipworkshop/libtock-c.git --branch=remove-risc
143155
cd libtock-c
144156
```
145157

158+
:::note NixOS VM users
159+
You don't have to clone the libtock-c repository, it is already cloned in the home directory.
160+
You will have to run `nix-shell` once you enter the `libtock-c` directory.
161+
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).
162+
:::
163+
146164
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.
147165

148166
### Flashing the application
@@ -168,7 +186,7 @@ Which option? [0] 1
168186
[INFO ] Using "/dev/cu.usbmodem1103 - KitProg3 CMSIS-DAP".
169187
[INFO ] Listening for serial output
170188

171-
$tock list
189+
tock$ list
172190
PID ShortID Name Quanta Syscalls Restarts Grants State
173191
0 Unique blink 0 84 0 1/ 8 Yielded
174192
```

0 commit comments

Comments
 (0)