To build for RevPi, you need to have the armv7-unknown-linux-gnueabihf
Rust target installed. Install it with:
rustup target add armv7-unknown-linux-gnueabihf
Then, to build the application run:
cargo build --release
You also need to have the arm-linux-gnueabihf-gcc
compiler installed and added to your $PATH
.
For Windows, you can download it from the ARM developer page
(the most recent version should be this one).
On Linux, it may be installable through your package manager (e.g. sudo apt install gcc-arm-linux-gnueabihf
under Debian). If not,
find the Linux version of the toolchain on the ARM developer page.
You can also run the code locally on your machine. To build for Windows run:
cargo build --target x86_64-pc-windows-msvc
To build for Linux run:
cargo build --target x86_64-unknown-linux-gnu
Alternatively, use cargo run
instead of cargo build
in order to
run the project directly.
When cross compiling from Ubuntu, there may be a glibc version mismatch with the Revolution Pi. To work around it, you can compile this project directly on the Revolution Pi.
For these systems, we provide a Docker Compose File that allows you to easily set up the bridges. Therefore, it is as easy as running docker-compose up -d
.
Here, we cannot provide working Docker images. Therefore, you have to manually compile the gRPC bridge (on the RevPi, we already built a binary for you). For this, follows these steps (on RevPi, skip the first two):
- run
git submodule update --init
to download the RaSTA sources andcd rasta-protocol
- build the gRPC bridge binary by running the commands that are given in the steps "Install CUnit", "Install gRPC", "Configure CMake without extensions" (without the
-DENABLE_RASTA_TLS=ON
) and "Build without extensions" of this CI config- Note: in this step, you might need to fix some small compiler errors, especially when using 32-bit OSes like Raspbian or when using
clang
compiler
- Note: in this step, you might need to fix some small compiler errors, especially when using 32-bit OSes like Raspbian or when using
- the binary now is in
rasta-protocol/build
,cd
into this directory - start the gRPC bridge (as a Rasta server / gRPC client) on the interlocking side with the command
./rasta_grpc_bridge_udp ../../config/rasta_interlocking.cfg 0.0.0.0:4242 127.0.0.1 9998 127.0.0.1 9999 97 96 127.0.0.1:50001
run in the build folder of the rasta-protocol project. First parameter is the Rasta config file, second will be ignored, 3-6 are the transport channels of the Rasta client, 7-8 are the Rasta IDs of server and client, 9 is the address of the gRPC server to connect to. - start the gRPC bridge (as a Rasta client / gRPC server) on the OC side with the command
./rasta_grpc_bridge_udp ../../config/rasta_oc.cfg 0.0.0.0:50002 127.0.0.1 8888 127.0.0.1 8889 96 97
run in the build folder of the rasta-protocol project. First parameter is the Rasta config file, second is the socket the gRPC server should listen on, 3-6 are the transport channels of the Rasta server, 7-8 are the Rasta IDs of client and server.
Run the following steps:
- start the interlocking software (
sender
) with the commandcargo run --bin sender 0.0.0.0 50001
(gRPC server will listen on port 50001) - refer to the respective subsection, depending on your processor architecture, to start the gRPC bridges for OC and interlocking.
- start the OC software (
main
) with the commandcargo run --bin receiver 127.0.0.1 50002 config/pin_config.toml
(gRPC client will connect to the server on port 50002)
- start the OC software (
old_main
) with the commandcargo run --bin old_receiver config/pin_config.toml
- start the interlocking software (
old_sender
) with the commandcargo run --bin old_sender
The sender can send the main aspect Ks1 or Ks2. Writing to the console and confirm with enter.