Skip to content

Commit

Permalink
chore: support cargo-embed
Browse files Browse the repository at this point in the history
  • Loading branch information
chrysn committed Feb 27, 2025
1 parent 5d60080 commit 3de94c3
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
11 changes: 11 additions & 0 deletions laze-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ contexts:
-kernel
PROBE_RS_PROTOCOL: swd
CARGO_PRESHELL: []
# This reflects the config of rtt_init that is active in ariel_os_debug unless defmt is selected
#
# FIXME: Should those be standalone files, or rather profiels within the file?
EMBED_CONFIG: ${relroot}/scripts/cargo-embed/Embed-no-defmt.toml

var_options:
# this turns ${FEATURES} from a list to "--features=feature1,feature2"
Expand Down Expand Up @@ -111,6 +115,12 @@ contexts:
cmd:
- ${CARGO_PRESHELL} ${CARGO_ENV} ${CARGO} ${CARGO_TOOLCHAIN} ${CARGO_ARGS} run --${PROFILE} ${FEATURES}

embed:
build: false
workdir: ${appdir}
cmd:
- ${CARGO_PRESHELL} ${CARGO_ENV} ${CARGO} ${CARGO_TOOLCHAIN} ${CARGO_ARGS} embed --${PROFILE} ${FEATURES} --chip ${PROBE_RS_CHIP} --config-file ${EMBED_CONFIG}

clippy:
build: false
workdir: ${appdir}
Expand Down Expand Up @@ -527,6 +537,7 @@ modules:
# `DEFMT_LOG`. Painful as it is, hard-disable `sccache` here.
- RUSTC_WRAPPER=""
- DEFMT_LOG=info,${LOG}
EMBED_CONFIG: ${relroot}/scripts/cargo-embed/Embed-defmt.toml

- name: log
help: Use the `log` crate as the debug logging facade
Expand Down
15 changes: 15 additions & 0 deletions scripts/cargo-embed/Embed-defmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[default]
gdb.enabled = true

[default.rtt]
enabled = true

up_channels = [
{ channel = 0, format = "Defmt" },
{ channel = 1 },
]

tabs = [
{ up_channel = 0, name = "defmt including log" },
{ up_channel = 1, name = "Terminal" },
]
13 changes: 13 additions & 0 deletions scripts/cargo-embed/Embed-no-defmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[default]
gdb.enabled = true

[default.rtt]
enabled = true

up_channels = [
{ channel = 0},
]

tabs = [
{ up_channel = 0, name = "Terminal including log" },
]

0 comments on commit 3de94c3

Please sign in to comment.