cargo generate from https://github.com/lulf/embassy-template.git
This commit is contained in:
parent
4a7b8b5b45
commit
71eae62bda
7 changed files with 1547 additions and 0 deletions
8
southbridge/.cargo/config.toml
Normal file
8
southbridge/.cargo/config.toml
Normal file
|
@ -0,0 +1,8 @@
|
|||
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
|
||||
runner = "probe-rs run --chip RP2040"
|
||||
|
||||
[build]
|
||||
target = "thumbv6m-none-eabi"
|
||||
|
||||
[env]
|
||||
DEFMT_LOG = "info"
|
1446
southbridge/Cargo.lock
generated
Normal file
1446
southbridge/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
25
southbridge/Cargo.toml
Normal file
25
southbridge/Cargo.toml
Normal file
|
@ -0,0 +1,25 @@
|
|||
[package]
|
||||
edition = "2021"
|
||||
name = "southbridge"
|
||||
version = "0.1.0"
|
||||
authors = ["Andy Killorin <37423245+Speedy6451@users.noreply.github.com>"]
|
||||
resolver = "2"
|
||||
|
||||
[dependencies]
|
||||
defmt = "0.3"
|
||||
defmt-rtt = "0.4"
|
||||
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
||||
|
||||
embedded-hal = "1.0.0"
|
||||
embedded-hal-async = "1.0.0"
|
||||
embedded-io = "0.6.1"
|
||||
embedded-io-async = "0.6.1"
|
||||
embedded-storage = "0.3.1"
|
||||
|
||||
cortex-m-rt = "0.7.3"
|
||||
|
||||
embassy-executor = { version = "0.7", features = ["task-arena-size-1024", "arch-cortex-m", "executor-thread", "defmt", "executor-interrupt"] }
|
||||
embassy-sync = { version = "0.6" }
|
||||
embassy-time = { version = "0.4", features = ["defmt", "defmt-timestamp-uptime"] }
|
||||
cortex-m = { version = "0.7.6" }
|
||||
embassy-rp = { version = "0.3", features = ["defmt", "unstable-pac", "time-driver", "critical-section-impl", "rp2040"] }
|
36
southbridge/build.rs
Normal file
36
southbridge/build.rs
Normal file
|
@ -0,0 +1,36 @@
|
|||
//! This build script copies the `memory.x` file from the crate root into
|
||||
//! a directory where the linker can always find it at build time.
|
||||
//! For many projects this is optional, as the linker always searches the
|
||||
//! project root directory -- wherever `Cargo.toml` is. However, if you
|
||||
//! are using a workspace or have a more complicated build setup, this
|
||||
//! build script becomes required. Additionally, by requesting that
|
||||
//! Cargo re-run the build script whenever `memory.x` is changed,
|
||||
//! updating `memory.x` ensures a rebuild of the application with the
|
||||
//! new memory settings.
|
||||
|
||||
use std::env;
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() {
|
||||
// Put `memory.x` in our output directory and ensure it's
|
||||
// on the linker search path.
|
||||
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
|
||||
File::create(out.join("memory.x"))
|
||||
.unwrap()
|
||||
.write_all(include_bytes!("memory.x"))
|
||||
.unwrap();
|
||||
println!("cargo:rustc-link-search={}", out.display());
|
||||
|
||||
// By default, Cargo will re-run a build script whenever
|
||||
// any file in the project changes. By specifying `memory.x`
|
||||
// here, we ensure the build script is only re-run when
|
||||
// `memory.x` is changed.
|
||||
println!("cargo:rerun-if-changed=memory.x");
|
||||
|
||||
println!("cargo:rustc-link-arg-bins=--nmagic");
|
||||
println!("cargo:rustc-link-arg-bins=-Tlink.x");
|
||||
println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
|
||||
println!("cargo:rustc-link-arg-bins=-Tlink-rp.x");
|
||||
}
|
7
southbridge/memory.x
Normal file
7
southbridge/memory.x
Normal file
|
@ -0,0 +1,7 @@
|
|||
MEMORY
|
||||
{
|
||||
BOOT2 : ORIGIN = 0x10000000, LENGTH = 0x100
|
||||
FLASH : ORIGIN = 0x10000100, LENGTH = 2048K - 0x100
|
||||
RAM : ORIGIN = 0x20000000, LENGTH = 264K
|
||||
}
|
||||
|
10
southbridge/rust-toolchain.toml
Normal file
10
southbridge/rust-toolchain.toml
Normal file
|
@ -0,0 +1,10 @@
|
|||
# Before upgrading check that everything is available on all tier1 targets here:
|
||||
# https://rust-lang.github.io/rustup-components-history
|
||||
[toolchain]
|
||||
channel = "stable"
|
||||
components = [ "rustfmt" ]
|
||||
targets = [
|
||||
"thumbv6m-none-eabi",
|
||||
"thumbv7em-none-eabihf",
|
||||
"riscv32imac-unknown-none-elf",
|
||||
]
|
15
southbridge/src/main.rs
Normal file
15
southbridge/src/main.rs
Normal file
|
@ -0,0 +1,15 @@
|
|||
#![no_std]
|
||||
#![no_main]
|
||||
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::main]
|
||||
async fn main(_spawner: Spawner) {
|
||||
let _p = embassy_rp::init(Default::default());
|
||||
loop {
|
||||
defmt::info!("Blink");
|
||||
Timer::after(Duration::from_millis(100)).await;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue