Flashing

If RoboPLC Manager is installed, it is possible to flash the program remotely via either its web interface or using robo CLI program. Note that the program can be flashed only when the host is in CONFIG mode.

Note

RoboPLC Manager is not a mandatory component. The program can be uploaded/run using any custom method.

Installing RoboPLC CLI

The robo CLI tool is available in cargo package roboplc-cli:

cargo install roboplc-cli

The tool should be installed on the client machine, where the Rust project is being developed. It is also possible to include the tool into CI/CD pipelines.

Configuring

The program can be used with no configuration. In this case all options are provided either via system variables ROBOPLC_URL, ROBOPLC_KEY or via command-line arguments.

The priority is the following:

  • Command-line arguments (higher)

  • Environment variables

  • Configuration file (lower)

Configuration file

Note

When a new project is created with robo new command, it is possible to specify the remote url, key and timeout. If specified, the values are stored in the robo.toml file.

The file must be placed into the projects root directory and named robo.toml. The following options are available:

[remote]
url = "http://IP_OR_HOST:7700"
key = "roboplc"
#timeout = 60

[build]
#cargo = "cargo"
#target = "x86_64-unknown-linux-gnu"
#cargo-args = "--some-extra --cargo-arguments"
  • remote.url URL of the RoboPLC Manager (with no trailing slashes etc.)

  • remote.key host management key

  • remote.timeout max API timeout (keep it high enough for binary uploading)

  • build.cargo cargo executable. If not specified, cross is used if present in the PATH, otherwise the compilation falls back to the default cargo

  • build.target the remote target architecture. If not specified, the host architecture is tried to be detected automatically, using RoboPLC Manager API

Warning

As the file contains the remote key, make sure it has got proper permissions and do not publish it to public source repositories.

Cross-compilation

For cross compilation, it is recommended to install cross:

cargo install cross

Flashing

The program can be flashed using the following command:

robo flash

The program is automatically compiled for the remote target (release) and uploaded to the remote host.

  • use --run (short: -r) option to automatically start the program after flashing

  • use --force (short: -f) option to switch the remote into CONFIG mode before flashing.

Switching between remotes

The file robo.toml contains the primary remote where the program is flashed. Sometimes it is useful to switch between multiple remotes, e.g. to test the program on different devices.

RoboPLC CLI allows to create a list of the remotes in a file named .robo-global.toml. The file must be placed in the home directory of the user.

Example:

[remote.system1]
url = "http://192.168.20.200:7700"
key = "secret1"

[remote.other]
url = "http://192.168.20.201:7700"
key = "secret2"

When executing RoboPLC commands, specify the remote name instead of the URL, e.g.:

robo -U system1 stat
robo -U system1 flash

Warning

As the file contains remote keys, make sure it has got proper permissions.