Skip to content
Commit 5230bb46 authored by David Brown's avatar David Brown Committed by David Brown
Browse files

rust: Basic `zephyr` crates



This is the initial Zephyr-specific crates that provide support for Rust
on Zephyr.  Currently, what they do is fairly minimal, but important.

`zephyr-build` is a build time crate (linked against the `zephyr`
crate's build.rs) that processes the current build's Kconfig settings,
and does three things with them:

  - Boolean Kconfig values given given to the Rust toolchain so that
    conditional compilation can be based off of them.
  - Numeric Kconfig settings end up as constants in `zephyr::kconfig`.
  - String valued Kconfig settings end up as constants in
    `zephyr::kconfig`.

None of these cause code or data to be generated or allocated (but note
that if there is a reference to a string, that string will be placed in
read-only memory).

The `zephyr` crate is built for the target, and intended to be
referenced by the application.  It provides minimal support needed for a
"bare" Rust build, notably a panic handler.  At this point, the panic
handler is not implemented as we need better support for calling into
Zephyr's C code, so it just stops in an infinite loop.

It also ensures that `CONFIG_RUST` is set as a sanity check, and
includes the generated kconfig.rs file with the kconfig definitions for
the current build.

Signed-off-by: default avatarDavid Brown <david.brown@linaro.org>
parent 148e1351
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment