#runner #cargo #projects #target #path #open-ocd

bin+lib embedded-runner

Cargo runner for embedded projects using OpenOCD

4 releases (2 breaking)

0.3.1 Jun 14, 2024
0.3.0 Jun 13, 2024
0.2.0 Jun 13, 2024
0.1.0 May 28, 2024

#318 in Embedded development

Download history 120/week @ 2024-05-25 15/week @ 2024-06-01 235/week @ 2024-06-08 76/week @ 2024-06-15

446 downloads per month

MIT license

285KB
1K SLoC

Contains (ELF exe/lib, 1MB) test_binaries/emb-runner-test

embedded-runner

Cargo runner for embedded projects using OpenOCD.

Usage

  1. Install the crate using cargo install embedded-runner.

  2. Set embedded-runner run as cargo runner at .cargo/config.toml

    [target(<your target configuration>)]
    runner = "embedded-runner run"
    
  3. Create a runner configuration

    By default, embedded-runner will look for a runner configuration at .embedded/runner.toml. A custom path may be set by the --runner-cfg argument before the run command.

    Be sure to enable the defmt feature for mantra-rust-macros to get the required coverage logs when using mantra.

    The configuration allows the following settings:

    # Optional: Load section in the gdb script.
    # 
    # The load section gets resolved using the Tera templating language.
    # Variables `binary_path`, `binary_filepath`, and `binary_filepath_noextension` are passed as context.
    #
    # e.g. "load {{ binary_filepath }}"
    load = "load"
    
    # Optional: Path to a custom OpenOCD configuration
    openocd-cfg = ".embedded/openocd.cfg"
    
    # Optional: Path to write OpenOCD logs to
    gdb-logfile = "<output directory>/gdb.log"
    
    # Optional: RTT port to use
    rtt-port = 19021
    
    # Optional: Define a command to run before the runner executes the binary.
    # A 'post-runner' may also be set that is run after executing the binary.
    #
    # On windows, `pre-runner-windows` is available that takes precedence over `pre-runner`.
    # Same with `post-runner-windows`.
    [pre-runner]
    
    # Name of the command
    name = "powershell"
    
    # Arguments passed to the command.
    # The binary path is automatically added as last argument 
    args = ["echo"]
    
  4. Add your OpenOCD configuration

    By default, embedded-runner will look for .embedded/openocd.cfg, but you may change this in the runner configuration.

  5. Create and run your defmt-test tests

    Consult the defmt-test documentation on how to create and manage tests using the defmt framework.

  6. Optional: Collect test results from multiple test runs

    Run embedded-runner collect <output filepath> to combine all test run results into one file. The content will be JSON adhering to the mantra CoverageSchema.

License

MIT Licensed

Dependencies

~16–27MB
~401K SLoC