Crates.io | renode-run |
lib.rs | renode-run |
version | 0.2.0 |
source | src |
created_at | 2023-03-15 11:14:52.217795 |
updated_at | 2024-03-26 16:01:04.081555 |
description | Run embedded programs in the renode emulator |
homepage | |
repository | https://github.com/jonlamb-gh/renode-run |
max_upload_size | |
id | 810626 |
size | 67,878 |
A custom Cargo runner that runs Rust firmware in the renode emulator.
cargo run
.Cargo.toml
.To install renode-run
, use cargo install renode-run
.
NOTE Requires renode to be installed on the host system.
Set renode-run
as your Cargo runner (.cargo/config.toml
).
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
runner = "renode-run"
You can now run your firmware using cargo run
.
[package.metadata.renode]
optionsNOTE Many of these can be overridden by CLI options. Nearly every field supports environment variable substitution.
Fields pertaining the resc
script generation:
resc
script.
If not present, the name of the crate is used or a default name is provided.resc
script.
If not present, the description of the crate is used or a default description is provided.renode-run
will automatically insert $bin = @target/<profile>/<bin>
as provided by Cargo.repl
file (starts with @
)repl
file (doesn't start with @
)repl
file that is to be imported and generated into the output directory (starts with <
).
This is handy when you want to perform environment substitution on the contents of a repl
file.repl
file (starts with @
)repl
file (doesn't start with @
)repl
file that is to be imported and generated into the output directory (starts with <
).
This is handy when you want to perform environment substitution on the contents of a repl
file.sysbus LoadELF $bin
.start
.start
command.start
command.Fields pertaining the behavior of renode-run
:
renode-run
and renode
environment.renode
binary to use. Defaults to using the system's $PATH
.start
command. Defaults to false
.resc
script. Defaults to emulate.resc
.Fields pertaining the invocation of renode
itself:
--plain
to the list of arguments given to renode
.--port <port>
to the list of arguments given to renode
.--disable-xwt
to the list of arguments given to renode
.--hide-monitor
to the list of arguments given to renode
.--hide-log
to the list of arguments given to renode
.--hide-analyzers
to the list of arguments given to renode
.--console
to the list of arguments given to renode
.--keep-temporary-files
to the list of arguments given to renode
.[package.metadata.renode]
name = 'my-script'
description = 'my renode script - ${FOOKEY} works'
machine-name = 'my-machine'
using-sysbus = true
renode = '${HOME}/repos/forks/renode/renode'
environment-variables = [
['FOOKEY', 'FOOVAL'],
["MYENV", "MYVAL"],
]
init-commands = [
'logLevel -1 i2c2',
]
variables = [
'$tap?="renode-tap0"',
# Set random board UNIQUE ID
'''
python "import _random"
python "rand = _random.Random()"
$id1 = `python "print rand.getrandbits(32)"`
$id2 = `python "print rand.getrandbits(32)"`
$id3 = `python "print rand.getrandbits(32)"`
''',
]
platform-descriptions = [
'@platforms/boards/stm32f4_discovery-kit.repl',
'path/to/dev_board.repl',
'< ${SOMETHING}/other_dev_board.repl',
'''
phy3: Network.EthernetPhysicalLayer @ ethernet 3
Id1: 0x0000
Id2: 0x0000
''',
'''
wss: Python.PythonPeripheral @ sysbus 0x50070000
size: 0x10
initable: true
filename: "${ORIGIN}/sensor_models/wss.py"
''',
]
pre-start-commands = [
'''
emulation CreateSwitch "switch"
connector Connect sysbus.ethernet switch
emulation CreateTap $tap "tap"
connector Connect host.tap switch
''',
'''
logFile @/tmp/logfile.log true
logLevel 3 file
''',
'emulation LogEthernetTraffic',
'machine StartGdbServer 3333',
'''
sysbus.usart3 AddLineHook "PANIC" "Antmicro.Renode.Logging.Logger.Log(LogLevel.Error, line)"
sysbus.usart3 AddLineHook "test result: ok" "Antmicro.Renode.Emulator.Exit()"
''',
]
reset = '''
sysbus LoadELF $bin
sysbus WriteDoubleWord 0x1FFF7A10 $id1
sysbus WriteDoubleWord 0x1FFF7A14 $id2
sysbus WriteDoubleWord 0x1FFF7A18 $id3
'''
Licensed under either of
Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.