Throught this README, you should be able to flash the tock kernel on a board.
In order to be able to use tock and flash it on the board using Windows, you will need to import the following VM:
Virtual Machine for TockOS
If you are a Linux user, you also can use the VM, which is strongly recommended.
If you are a MacOS user, you need to follow the steps below.
In order to use tock, we need to install some tools:
-
First, make sure you updated the packages:
sudo apt update && sudo apt upgrade # For Linux brew update # For Mac
-
Clone the Tock
kernelrepository andlibtock-c:git clone https://github.com/Matrix22/tock.git git clone https://github.com/tock/libtock-c.git
-
Install
Rust:curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # And follow the installation process
-
Install
arm-none-eabi toolchain. This enables you to compile apps written in C for Cortex-M boards:# MacOS brew tap ARMmbed/homebrew-formulae && brew update && brew install arm-none-eabi-gcc # Linux sudo apt install gcc-arm-none-eabi
-
Install
openOCDin order to flash the board:# MacOS brew install open-ocd # Linux sudo apt install openocd
-
Install
tockloader. This is an all-in-one tool for programming boards and using Tock, and also for accessing the console:pip3 install -U --user tockloader # MacOS export PATH=$HOME/Library/Python/3.9/bin/:$PATH # Linux PATH=$HOME/.local/bin:$PATH
You will need to
exportthePATHevery time you close your terminal session.
Congratulations! You've installed the TockOS and it's dependencies, now let's test if it works.
Now that we are all set up, let's compile and upload the kernel binary to our board.
For this course, we will use a Microbit v2.
-
Navigate to the
tockrepository and change the branch tobetter-process-console:cd tock git checkout better-process-console # Check that you successfully changed the branch git branch -a # You should see same output: # * better-process-console # master # ...
-
Plug the
Microbit: v2into your computer and make sure that your system recognizes the board. -
Navigate to the
microbit_v2utilities in the repository:cd boards/microbit_v2 make flash -
Open another terminal and try to access the board's
console:tockloader listen # This should open you a prompt in tockOS tock$If you do not see the prompt, press the
RESETbutton on theMicrobit: v2board.
If you want to close the console session, pressCtrl + Cinterrupt signal.
This is your first interaction with the tockOS. Be proud of yourselves.
Make sure you have installed the libtock-c repository
-
Navigate to the blink application:
cd libtock-c/examples/blink # Compile the blink application make # Install the application tockloader install
If you are not able to install the blink app, you can install it via
app store:tockloader install blink
-
Now turn the microbit around and observe the magic ... isn't it beautiful?
-
You can install any of available apps from the
examplesfolder, you can even play music on it, or you can write your owndriversin order to do different things.
Play around a bit and get used to flashing the board. -
In order to delete an app or all apps you can run:
tockloader uninstall blink # For all apps tockloader erase-apps
For more details access the Tock Book.