Initial commit

This commit is contained in:
Nicola Belluti 2023-07-09 20:46:33 +02:00
commit 6e6be3959d
7 changed files with 85 additions and 0 deletions

9
.cargo/config.toml Normal file
View File

@ -0,0 +1,9 @@
[build]
target = 'xtensa-esp32-none-elf'
rustflags = [
'-C', 'link-arg=-Tlinkall.x',
'-C', 'link-arg=-nostartfiles',
]
[unstable]
build-std = ['core']

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/target
firmware.bin

17
Cargo.toml Normal file
View File

@ -0,0 +1,17 @@
[package]
name = 'esp-rs'
version = '0.1.0'
edition = '2021'
# Optimize the binary
# See https://yew.rs/docs/advanced-topics/optimizations#cargotoml
[profile.release]
panic = 'abort'
codegen-units = 1
opt-level = 'z'
lto = true
strip = true
[dependencies]
esp32-hal = '0.13.0'
esp-println = { version = '0.5.0', features = ['esp32'] }

32
Makefile.toml Normal file
View File

@ -0,0 +1,32 @@
# For the "build" task
# See https://github.com/sagiegurari/cargo-make/issues/351
[config]
skip_core_tasks = true
[tasks.build]
script = '. ~/export-esp.sh && cargo build --release'
[tasks.flash]
command = 'espflash'
args = [
'flash',
'target/xtensa-esp32-none-elf/release/${CARGO_MAKE_PROJECT_NAME}',
'--monitor'
]
dependencies = ['build']
[tasks.image]
command = 'espflash'
args = [
'save-image',
'target/xtensa-esp32-none-elf/release/${CARGO_MAKE_PROJECT_NAME}',
'firmware.bin',
'--chip', 'esp32',
'--merge',
'--skip-padding'
]
dependencies = ['build']
[tasks.monitor]
command = 'espflash'
args = ['monitor']

7
README.md Normal file
View File

@ -0,0 +1,7 @@
# Rust on the ESP32
A minimal template repository for coding in Rust on the ESP32
## Usage
You first need to install the [`espup`](https://github.com/esp-rs/espup) and [`espflash`](https://github.com/esp-rs/espflash/tree/main/espflash) tools and run `espup install`

2
rust-toolchain.toml Normal file
View File

@ -0,0 +1,2 @@
[toolchain]
channel = 'esp'

16
src/main.rs Normal file
View File

@ -0,0 +1,16 @@
#![no_std]
#![no_main]
use esp32_hal::prelude::entry;
use esp_println::println;
#[panic_handler]
fn panic(_info: &core::panic::PanicInfo) -> ! {
loop {}
}
#[entry]
fn main() -> ! {
println!("Hello world!");
loop {}
}