-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Revert "Update to new crates; simplify advanced options""
This reverts commit 574e57b.
- Loading branch information
Showing
12 changed files
with
89 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
// Necessary because of this issue: https://github.com/rust-lang/cargo/issues/9641 | ||
fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
embuild::build::CfgArgs::output_propagated("ESP_IDF")?; | ||
embuild::build::LinkArgs::output_propagated("ESP_IDF")?; | ||
Ok(()) | ||
{%- if hal %} | ||
fn main() { | ||
embuild::espidf::sysenv::output(); | ||
} | ||
{%- endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,23 @@ | ||
[template] | ||
cargo_generate_version = ">=0.10.0" | ||
cargo_generate_version = ">=0.17.4" | ||
|
||
[placeholders] | ||
toolchain = { type = "string", prompt = "Rust toolchain (beware: nightly works only for esp32c3!)", choices = ["esp", "nightly"], default = "esp" } | ||
std = { type = "bool", prompt = "STD support", default = true } | ||
[placeholders.advanced] | ||
type = "bool" | ||
prompt = "Configure advanced template options?" | ||
default = false | ||
|
||
[conditional.'advanced'.placeholders.toolchain] | ||
type = "string" | ||
prompt = "Rust toolchain (beware: nightly works only for riscv MCUs!)" | ||
choices = ["esp", "nightly"] | ||
default = "esp" | ||
|
||
[conditional.'advanced'.placeholders.hal] | ||
type = "bool" | ||
prompt = "Enable HAL support?" | ||
default = true | ||
|
||
[conditional.'advanced'.placeholders.std] | ||
type = "bool" | ||
prompt = "Enable STD support?" | ||
default = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// Necessary because of this issue: https://github.com/rust-lang/cargo/issues/9641 | ||
fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
embuild::build::CfgArgs::output_propagated("ESP_IDF")?; | ||
Ok(()) | ||
{%- if hal %} | ||
fn main() { | ||
embuild::espidf::sysenv::output(); | ||
} | ||
{%- endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[toolchain] | ||
{% if toolchain == "esp" %} | ||
channel = "esp" | ||
{% endif %} | ||
{% if toolchain == "nightly" %} | ||
{% if arch == "riscv" -%} | ||
channel = "nightly" | ||
{% endif %} | ||
components = ["rust-src"] | ||
{% else -%} | ||
channel = "esp" | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,20 @@ | ||
{% unless std -%} | ||
#![no_std] | ||
{% endunless -%} | ||
use esp_idf_sys as _; // If using the `libstart` feature of `esp-idf-sys`, always keep this module imported | ||
{%- if std and hal != "No" %} | ||
use log::*; | ||
{% endif %} | ||
|
||
#[no_mangle] | ||
extern "C" fn rust_main() -> i32 { | ||
// Temporary. Will disappear once ESP-IDF 4.4 is released, but for now it is necessary to call this function once, | ||
// or else some patches to the runtime implemented by esp-idf-sys might not link properly. | ||
esp_idf_sys::link_patches(); | ||
{%- if std and hal == "No" %} | ||
println!("Hello world from Rust!"); | ||
{%- elsif std and hal != "No" %} | ||
{%- if hal %} | ||
// It is necessary to call this function once. Otherwise some patches to the runtime | ||
// implemented by esp-idf-sys might not link properly. See https://github.com/esp-rs/esp-idf-template/issues/71 | ||
esp_idf_svc::sys::link_patches(); | ||
|
||
// Bind the log crate to the ESP Logging facilities | ||
esp_idf_svc::log::EspLogger::initialize_default(); | ||
|
||
info!("Hello world from Rust!"); | ||
log::info!("Hello, world!"); | ||
{%- elif std %} | ||
println!("Hello, world from Rust!"); | ||
{%- endif %} | ||
|
||
42 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters