Initial commit
This commit is contained in:
commit
36c75fbc97
19
.cargo/config.toml
Normal file
19
.cargo/config.toml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
[build]
|
||||||
|
target = "riscv32imc-esp-espidf"
|
||||||
|
|
||||||
|
[target.'cfg(target_os = "espidf")']
|
||||||
|
linker = "ldproxy"
|
||||||
|
runner = "espflash flash --monitor"
|
||||||
|
rustflags = [ "--cfg", "espidf_time64"]
|
||||||
|
|
||||||
|
[unstable]
|
||||||
|
build-std = ["std", "panic_abort"]
|
||||||
|
|
||||||
|
[env]
|
||||||
|
MCU = "esp32c3"
|
||||||
|
ESP_IDF_VERSION = "v5.5.3"
|
||||||
|
ESP_IDF_TOOLS_INSTALL_DIR = "workspace"
|
||||||
|
|
||||||
|
# Uncomment this if you have moved the target dir by setting CARGO_TARGET_DIR or similar.
|
||||||
|
# Required for now due to embuild limitations.
|
||||||
|
#CARGO_WORKSPACE_DIR = { value = "", relative = true }
|
||||||
43
.github/workflows/rust_ci.yml
vendored
Normal file
43
.github/workflows/rust_ci.yml
vendored
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
name: Continuous Integration
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths-ignore:
|
||||||
|
- "**/README.md"
|
||||||
|
pull_request:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
rust-checks:
|
||||||
|
name: Rust Checks
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
action:
|
||||||
|
- command: build
|
||||||
|
args: --release
|
||||||
|
- command: fmt
|
||||||
|
args: --all -- --check --color always
|
||||||
|
- command: clippy
|
||||||
|
args: --all-targets --all-features --workspace -- -D warnings
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Rust
|
||||||
|
uses: dtolnay/rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: nightly
|
||||||
|
components: rust-src rustfmt clippy
|
||||||
|
- name: Enable caching
|
||||||
|
uses: Swatinem/rust-cache@v2
|
||||||
|
- name: Install ldproxy
|
||||||
|
run: cargo install ldproxy
|
||||||
|
- name: Run command
|
||||||
|
run: cargo ${{ matrix.action.command }} ${{ matrix.action.args }}
|
||||||
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/.vscode
|
||||||
|
/.embuild
|
||||||
|
/target
|
||||||
|
/Cargo.lock
|
||||||
31
Cargo.toml
Normal file
31
Cargo.toml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
[package]
|
||||||
|
name = "esp-propane"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["August <shibedrill1@gmail.com>"]
|
||||||
|
edition = "2021"
|
||||||
|
resolver = "2"
|
||||||
|
rust-version = "1.82"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "esp-propane"
|
||||||
|
harness = false # do not use the built-in cargo test harness -> resolve rust-analyzer errors
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
opt-level = "s"
|
||||||
|
|
||||||
|
[profile.dev]
|
||||||
|
debug = true # Symbols are nice, and they don't increase the size on Flash
|
||||||
|
opt-level = "z"
|
||||||
|
[patch.crates-io]
|
||||||
|
esp-idf-sys = { git = "https://github.com/esp-rs/esp-idf.git" }
|
||||||
|
esp-idf-hal = { git = "https://github.com/esp-rs/esp-idf.git" }
|
||||||
|
esp-idf-svc = { git = "https://github.com/esp-rs/esp-idf.git" }
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
log = "0.4"
|
||||||
|
esp-idf-svc = { version = "0.53", features = ["critical-section", "embassy-time-driver", "embassy-sync"] }
|
||||||
|
# Remove `generic-queue-8` if you plan to use `embassy-time` WITH `embassy-executor`
|
||||||
|
embassy-time = { version = "0.5", features = ["generic-queue-8"] }
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
embuild = "0.33.5"
|
||||||
66
flake.lock
Normal file
66
flake.lock
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"fenix": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"rust-analyzer-src": "rust-analyzer-src"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1795879074,
|
||||||
|
"narHash": "sha256-QAqbRlrmBFayVaAGr+vV/1iU5aVgot96FqTsX/7NdKw=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "fenix",
|
||||||
|
"rev": "609e13405ef28bce28bde1715bed15f6585e8ef5",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "fenix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1780145889,
|
||||||
|
"narHash": "sha256-md0zn0RnwNvPyASas1yG5YUuwQ4ALA6ucL50l0DvqCo=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "8c50a710ddca43d7a530fb805ad55bde8d0141c5",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "26.05",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"fenix": "fenix",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rust-analyzer-src": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1795770336,
|
||||||
|
"narHash": "sha256-Im4O82izrAEn69fGbBe3/6q/7bGCXstELUz4PDnzqFM=",
|
||||||
|
"owner": "rust-lang",
|
||||||
|
"repo": "rust-analyzer",
|
||||||
|
"rev": "efc6ca74690b36e0b13961537ce043db912363f9",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "rust-lang",
|
||||||
|
"ref": "nightly",
|
||||||
|
"repo": "rust-analyzer",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
41
flake.nix
Normal file
41
flake.nix
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/26.05";
|
||||||
|
fenix = {
|
||||||
|
url = "github:nix-community/fenix";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
{ nixpkgs, fenix, ... }:
|
||||||
|
let
|
||||||
|
#lib = pkgs.lib;
|
||||||
|
system = "x86_64-linux";
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
toolchain = fenix.packages.${system}.fromToolchainName {
|
||||||
|
name = "nightly-2026-10-18";
|
||||||
|
#sha256 = lib.fakeSha256;
|
||||||
|
sha256 = "/cMB/kOBm9HQsV7Kb5N3n1b/ygfsuoNIChEh/jiS3A8=";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
devShells.x86_64-linux.default = pkgs.mkShell {
|
||||||
|
packages = [
|
||||||
|
(toolchain.withComponents [
|
||||||
|
"cargo"
|
||||||
|
"clippy"
|
||||||
|
"rust-src"
|
||||||
|
"rustc"
|
||||||
|
"rustfmt"])
|
||||||
|
pkgs.cargo-generate
|
||||||
|
pkgs.espflash
|
||||||
|
pkgs.espup
|
||||||
|
pkgs.ldproxy
|
||||||
|
(pkgs.python3.withPackages (python-pkgs: with python-pkgs; [
|
||||||
|
pip
|
||||||
|
]))
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
3
rust-toolchain.toml
Normal file
3
rust-toolchain.toml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[toolchain]
|
||||||
|
channel = "nightly"
|
||||||
|
components = ["rust-src"]
|
||||||
12
sdkconfig.defaults
Normal file
12
sdkconfig.defaults
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Rust often needs a bit of an extra main task stack size compared to C (the default is 3K)
|
||||||
|
# You might have to increase this further if you allocate large stack variables in the main task
|
||||||
|
CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192
|
||||||
|
|
||||||
|
# Increase a bit these stack sizes as they are also a bit too small by default
|
||||||
|
CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=4096
|
||||||
|
CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=4096
|
||||||
|
|
||||||
|
# You might have to increase this further if you spawn your own Rust threads
|
||||||
|
# that allocate large stack variables; or better yet - use
|
||||||
|
# `std::thread::Builder::new().stack_size(XXX)` for spawning
|
||||||
|
CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=4096
|
||||||
10
src/main.rs
Normal file
10
src/main.rs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fn main() {
|
||||||
|
// 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();
|
||||||
|
|
||||||
|
log::info!("Hello, world!");
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user