Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 25e3f1439f |
64 changed files with 1229 additions and 6398 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
/target
|
||||||
1157
Cargo.lock
generated
Normal file
1157
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
37
Cargo.toml
Normal file
37
Cargo.toml
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
[package]
|
||||||
|
name = "rustphone"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["tuxmain <tuxmain@zettascript.org>"]
|
||||||
|
repository = "https://git.txmn.tk/tuxmain/rustphone"
|
||||||
|
license = "AGPL-3.0-only"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
arrayvec = { version = "0.7.4", default_features = false }
|
||||||
|
atsamd-hal = { version = "0.15.1", default_features = false, features = ["samd21g", "samd21g-rt", "usb"] }
|
||||||
|
cfg-if = "1.0.0"
|
||||||
|
embedded-graphics = "0.7.1"
|
||||||
|
embedded-layout = "0.2.0"
|
||||||
|
embedded-text = "0.5.0"
|
||||||
|
embedded-sdmmc = { version = "0.3.0", default_features = false }
|
||||||
|
epd-waveshare = "0.5.0"
|
||||||
|
maduino_zero_4g = { git = "https://github.com/ZettaScript/atsamd", branch = "maduino-zero-4g", features = ["usb"] }
|
||||||
|
panic-halt = "0.2.0"
|
||||||
|
static_assertions = "1.1.0"
|
||||||
|
tz-rs = { version = "0.6.14", default_features = false, features = ["const"] }
|
||||||
|
tzdb = { version = "0.5.7", optional = true }
|
||||||
|
|
||||||
|
# simulator
|
||||||
|
embedded-graphics-simulator = { version = "0.4.1", optional = true }
|
||||||
|
|
||||||
|
[features]
|
||||||
|
#default = ["simulator"]
|
||||||
|
|
||||||
|
simulator = ["embedded-graphics-simulator", "tzdb"]
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
lto = "fat"
|
||||||
|
opt-level = 3
|
||||||
|
|
||||||
|
[patch."https://github.com/ZettaScript/atsamd"]
|
||||||
|
maduino_zero_4g = { path = "../atsamd/boards/maduino_zero_4g" }
|
||||||
28
README.md
28
README.md
|
|
@ -42,12 +42,6 @@ cargo run --features simulator
|
||||||
cargo build --release --target thumbv6m-none-eabi
|
cargo build --release --target thumbv6m-none-eabi
|
||||||
```
|
```
|
||||||
|
|
||||||
Read usb:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cat /dev/serial/by-id/usb-2222_3333-if00
|
|
||||||
```
|
|
||||||
|
|
||||||
## Pins
|
## Pins
|
||||||
|
|
||||||
* D2
|
* D2
|
||||||
|
|
@ -112,25 +106,3 @@ ncb1 upz2 tdk3
|
||||||
eow4 lqh5 age6
|
eow4 lqh5 age6
|
||||||
sfx7 rmj8 ivy9
|
sfx7 rmj8 ivy9
|
||||||
```
|
```
|
||||||
|
|
||||||
## OS
|
|
||||||
|
|
||||||
In case we switch to some more powerful MCU like ESP32.
|
|
||||||
|
|
||||||
Using an RTOS would be better than creating a monolithical horror. It would also make it easier to split the software into modular programs and store some programs in different memories (e.g. store kernel in internal flash and user programs in SPI flash).
|
|
||||||
|
|
||||||
Rusty embedded RTOS's:
|
|
||||||
|
|
||||||
* https://bern-rtos.org/
|
|
||||||
* does not support Xtensa
|
|
||||||
* supports Cortex-M
|
|
||||||
* does not seem to support dynamic programs
|
|
||||||
* https://www.drone-os.com/
|
|
||||||
* does not support Xtensa
|
|
||||||
* supports Cortex-M
|
|
||||||
* explicitly does not support dynamic programs
|
|
||||||
|
|
||||||
Needs:
|
|
||||||
* Kernel writes user programs to SPI flash (can it be done via chip programming or has it do be done by kernel? then USB, SD, debug probe, UART??)
|
|
||||||
* Handle hardware-specific work (provide high level interfaces for GPIO, SD, screen, modem, wifi, bluetooth...)
|
|
||||||
* Dynamic threads
|
|
||||||
|
|
|
||||||
1
common/.gitignore
vendored
1
common/.gitignore
vendored
|
|
@ -1 +0,0 @@
|
||||||
target
|
|
||||||
16
common/Cargo.lock
generated
16
common/Cargo.lock
generated
|
|
@ -1,16 +0,0 @@
|
||||||
# This file is automatically @generated by Cargo.
|
|
||||||
# It is not intended for manual editing.
|
|
||||||
version = 3
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "common"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"embedded-hal",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "embedded-hal"
|
|
||||||
version = "1.0.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89"
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "common"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2021"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
embedded-hal = "1.0.0"
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
hard_tabs = true
|
|
||||||
newline_style = "Unix"
|
|
||||||
imports_granularity = "Crate"
|
|
||||||
|
|
||||||
unstable_features = true
|
|
||||||
format_code_in_doc_comments = true
|
|
||||||
format_macro_bodies = true
|
|
||||||
format_macro_matchers = true
|
|
||||||
format_strings = true
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
/// CPU to Modem
|
|
||||||
pub enum CMMessage {
|
|
||||||
Ping(u32),
|
|
||||||
Pong(u32),
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
pub mod cm;
|
|
||||||
pub mod mc;
|
|
||||||
|
|
||||||
pub const VERSION: u32 = 1;
|
|
||||||
|
|
||||||
enum State {
|
|
||||||
/// Not ready, not even pinged
|
|
||||||
Idle,
|
|
||||||
/// Ping failed
|
|
||||||
Fail,
|
|
||||||
/// Waiting for pong
|
|
||||||
Pinging,
|
|
||||||
/// Ready to work
|
|
||||||
Ready,
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
use crate::{cm::CMMessage, State};
|
|
||||||
|
|
||||||
/// Modem to CPU
|
|
||||||
pub enum MCMessage {
|
|
||||||
Ping(u32),
|
|
||||||
Pong(u32),
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Modem-side connection driver
|
|
||||||
pub struct MCConnection<SPI> {
|
|
||||||
spi: SPI,
|
|
||||||
state: State,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<SPI> MCConnection<SPI> where SPI: embedded_hal::spi::SpiDevice {
|
|
||||||
pub fn new(spi: SPI) -> Self {
|
|
||||||
Self {
|
|
||||||
spi,
|
|
||||||
state: State::Idle,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn handle_message(message: CMMessage) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
[build]
|
|
||||||
target = "xtensa-esp32-none-elf"
|
|
||||||
|
|
||||||
[target.'cfg(target_arch = "xtensa")']
|
|
||||||
#runner = "espflash flash --monitor --flash-size 4mb --chip esp32 --partition-table partition.csv --flash-freq 40mhz --flash-mode qio"
|
|
||||||
runner = "espflash flash --monitor --flash-size 4mb --chip esp32"
|
|
||||||
rustflags = [
|
|
||||||
# Optimization
|
|
||||||
"-Z", "location-detail=none",
|
|
||||||
"-C", "link-args=-Wl,--sort-section=alignment",
|
|
||||||
"-C", "inline-threshold=7",
|
|
||||||
|
|
||||||
# GNU LD
|
|
||||||
"-C", "link-arg=-Wl,-Tlinkall.x",
|
|
||||||
"-C", "link-arg=-nostartfiles",
|
|
||||||
|
|
||||||
# LLD
|
|
||||||
# "-C", "link-arg=-Tlinkall.x",
|
|
||||||
# "-C", "linker=rust-lld",
|
|
||||||
]
|
|
||||||
|
|
||||||
[env]
|
|
||||||
ESP_LOGLEVEL = "info"
|
|
||||||
|
|
||||||
[unstable]
|
|
||||||
build-std = ["core", "panic_abort"]
|
|
||||||
#build-std = ["core"]
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
[target.xtensa-esp32-none-elf]
|
|
||||||
runner = "espflash flash --monitor"
|
|
||||||
|
|
||||||
[env]
|
|
||||||
ESP_LOG="info"
|
|
||||||
|
|
||||||
[build]
|
|
||||||
rustflags = [
|
|
||||||
"-C", "link-arg=-Wl,-Tlinkall.x",
|
|
||||||
"-C", "link-arg=-Trom_functions.x",
|
|
||||||
"-C", "link-arg=-nostartfiles",
|
|
||||||
]
|
|
||||||
|
|
||||||
target = "xtensa-esp32-none-elf"
|
|
||||||
|
|
||||||
[unstable]
|
|
||||||
build-std = ["alloc", "core"]
|
|
||||||
3
esp/.gitignore
vendored
3
esp/.gitignore
vendored
|
|
@ -1,3 +0,0 @@
|
||||||
wifi-ssid.txt
|
|
||||||
wifi-psw.txt
|
|
||||||
target
|
|
||||||
4
esp/.vscode/settings.json
vendored
4
esp/.vscode/settings.json
vendored
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"rust-analyzer.cargo.allTargets": false,
|
|
||||||
"rust-analyzer.cargo.target": "xtensa-esp32-none-elf",
|
|
||||||
}
|
|
||||||
1552
esp/Cargo.lock
generated
1552
esp/Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -1,53 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "rustphone"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2021"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
cfg-if = "1.0.0"
|
|
||||||
critical-section = "1.2.0"
|
|
||||||
embassy-embedded-hal = "0.2.0"
|
|
||||||
embassy-executor = { version = "0.6.3", features = ["task-arena-size-20480"] }
|
|
||||||
embassy-net = { version = "0.4.0", features = [ "tcp", "udp", "dhcpv4", "medium-ethernet"] }
|
|
||||||
embassy-sync = "0.6.1"
|
|
||||||
embassy-time = { version = "0.3.2", features = ["generic-queue-8"] }
|
|
||||||
embedded-graphics = "0.8.1"
|
|
||||||
embedded-hal = "1.0.0"
|
|
||||||
embedded-hal-02 = { version = "0.2.7", package = "embedded-hal", features = ["unproven"] }
|
|
||||||
embedded-io = "0.6.1"
|
|
||||||
embedded-io-async = "0.6.1"
|
|
||||||
embedded-layout = "0.4.1"
|
|
||||||
embedded-text = "0.7.2"
|
|
||||||
#embedded-tls = { version = "0.17.0", default-features = false }
|
|
||||||
epd-waveshare = { path = "../../epd-waveshare", optional = true }
|
|
||||||
esp-alloc = "0.5.0"
|
|
||||||
esp-backtrace = { version = "0.14.2", features = ["esp32", "exception-handler", "panic-handler", "println"] }
|
|
||||||
esp-hal = { version = "0.22.0", features = ["esp32"] }
|
|
||||||
esp-hal-embassy = { version = "0.5.0", features = ["esp32"] }
|
|
||||||
esp-println = { version = "0.12.0", features = ["esp32", "log"] }
|
|
||||||
esp-wifi = { version = "0.11.0", default-features = false, features = ["esp32", "utils", "wifi", "esp-alloc", "log"] }
|
|
||||||
log = "0.4.21"
|
|
||||||
#oled_async = { path = "../../oled_async", features = ["spi"] }
|
|
||||||
nb = "1.1.0"
|
|
||||||
#panic-halt = "0.2.0"
|
|
||||||
rand_core = "0.6.4"
|
|
||||||
#sh1106 = { version = "0.5.0", optional = true }
|
|
||||||
sh1106 = { git = "https://github.com/techmccat/sh1106", branch = "hal-1", optional = true }
|
|
||||||
static_cell = { version = "2.1.0", features = ["nightly"] }
|
|
||||||
|
|
||||||
[features]
|
|
||||||
default = ["display_sh1106"]
|
|
||||||
|
|
||||||
display_epd = ["dep:epd-waveshare"]
|
|
||||||
display_sh1106 = ["dep:sh1106"]
|
|
||||||
|
|
||||||
[profile.release]
|
|
||||||
codegen-units = 1
|
|
||||||
debug = 2
|
|
||||||
debug-assertions = false
|
|
||||||
incremental = false
|
|
||||||
opt-level = 's'
|
|
||||||
lto = 'fat'
|
|
||||||
overflow-checks = false
|
|
||||||
#panic = "abort"
|
|
||||||
strip = true
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
## Build
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cargo +esp run --release --target xtensa-esp32-none-elf
|
|
||||||
```
|
|
||||||
|
|
||||||
## Links
|
|
||||||
|
|
||||||
https://github.com/ivmarkov/rust-esp32-std-demo/blob/main/src/main.rs#L1505
|
|
||||||
|
|
||||||
OLED SPI/I2C V2 1.3in SH1106 5/3.3V
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
fn main() {
|
|
||||||
//println!("cargo:rustc-link-arg-bins=-Tlinkall.x");
|
|
||||||
//println!("cargo:rustc-link-arg-bins=-Tesp32_rom_functions.x");
|
|
||||||
//println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
|
|
||||||
}
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
# Name, Type, SubType, Offset, Size, Flags
|
|
||||||
nvs, data, nvs, 0x9000, 0x7000,
|
|
||||||
factory, app, factory, 0x10000, 2M,
|
|
||||||
spiffs, data, spiffs, , 2M,
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue