mirror of
https://github.com/stakwork/sphinx-key.git
synced 2025-12-19 08:14:28 +01:00
try to build VLS on ESP, secp256k1-sys error on RISCV
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,3 +4,4 @@ target
|
|||||||
Cargo.lock
|
Cargo.lock
|
||||||
.DS_Store
|
.DS_Store
|
||||||
sphinx-key/Cargo.lock
|
sphinx-key/Cargo.lock
|
||||||
|
notes.md
|
||||||
12
README.md
12
README.md
@@ -46,3 +46,15 @@ espmonitor /dev/tty.usbserial-1420
|
|||||||
|
|
||||||
espflash target/riscv32imc-esp-espidf/debug/clear
|
espflash target/riscv32imc-esp-espidf/debug/clear
|
||||||
espmonitor /dev/tty.usbserial-1420
|
espmonitor /dev/tty.usbserial-1420
|
||||||
|
|
||||||
|
### cargo generate esp-rs
|
||||||
|
|
||||||
|
cargo generate --git https://github.com/esp-rs/esp-idf-template cargo
|
||||||
|
|
||||||
|
std support: true
|
||||||
|
|
||||||
|
v4.4
|
||||||
|
|
||||||
|
esp32c3
|
||||||
|
|
||||||
|
nightly
|
||||||
28
build.md
Normal file
28
build.md
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
|
||||||
|
install the gcc risv toolchain on macos:
|
||||||
|
|
||||||
|
https://github.com/riscv-collab/riscv-gnu-toolchain
|
||||||
|
|
||||||
|
```
|
||||||
|
git clone --recursive https://github.com/riscv/riscv-gnu-toolchain
|
||||||
|
|
||||||
|
cd riscv-gnu-toolchain
|
||||||
|
|
||||||
|
./configure --prefix=/opt/riscv
|
||||||
|
|
||||||
|
sudo make
|
||||||
|
|
||||||
|
export PATH=$PATH:/opt/riscv/bin
|
||||||
|
|
||||||
|
(add that line above to your ~/.bash_profile to make it stick)
|
||||||
|
```
|
||||||
|
|
||||||
|
OR maybe this is better?
|
||||||
|
|
||||||
|
https://github.com/riscv-software-src/homebrew-riscv
|
||||||
|
|
||||||
|
```
|
||||||
|
brew tap riscv-software-src/riscv
|
||||||
|
|
||||||
|
brew install riscv-tools
|
||||||
|
```
|
||||||
34
signer/.cargo/config.toml
Normal file
34
signer/.cargo/config.toml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[build]
|
||||||
|
# Uncomment the relevant target for your chip here (ESP32, ESP32-S2, ESP32-S3 or ESP32-C3)
|
||||||
|
#target = "xtensa-esp32-espidf"
|
||||||
|
#target = "xtensa-esp32s2-espidf"
|
||||||
|
#target = "xtensa-esp32s3-espidf"
|
||||||
|
target = "riscv32imc-esp-espidf"
|
||||||
|
|
||||||
|
[target.xtensa-esp32-espidf]
|
||||||
|
linker = "ldproxy"
|
||||||
|
|
||||||
|
[target.xtensa-esp32s2-espidf]
|
||||||
|
linker = "ldproxy"
|
||||||
|
|
||||||
|
[target.xtensa-esp32s3-espidf]
|
||||||
|
linker = "ldproxy"
|
||||||
|
|
||||||
|
[target.riscv32imc-esp-espidf]
|
||||||
|
linker = "ldproxy"
|
||||||
|
|
||||||
|
# Future - necessary for the experimental "native build" of esp-idf-sys with ESP32C3
|
||||||
|
# See also https://github.com/ivmarkov/embuild/issues/16
|
||||||
|
rustflags = ["-C", "default-linker-libraries"]
|
||||||
|
|
||||||
|
[unstable]
|
||||||
|
|
||||||
|
build-std = ["std", "panic_abort"]
|
||||||
|
#build-std-features = ["panic_immediate_abort"] # Required for older ESP-IDF versions without a realpath implementation
|
||||||
|
|
||||||
|
[env]
|
||||||
|
# Note: these variables are not used when using pio builder
|
||||||
|
# Enables the esp-idf-sys "native" build feature (`cargo build --features native`) to build against ESP-IDF stable (v4.4)
|
||||||
|
ESP_IDF_VERSION = { value = "branch:release/v4.4" }
|
||||||
|
# Enables the esp-idf-sys "native" build feature (`cargo build --features native`) to build against ESP-IDF master (mainline)
|
||||||
|
#ESP_IDF_VERSION = { value = "master" }
|
||||||
4
signer/.gitignore
vendored
Normal file
4
signer/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
/.vscode
|
||||||
|
/.embuild
|
||||||
|
/target
|
||||||
|
/Cargo.lock
|
||||||
@@ -4,3 +4,21 @@ version = "0.1.0"
|
|||||||
authors = ["Evan Feenstra <evanfeenstra@gmail.com>"]
|
authors = ["Evan Feenstra <evanfeenstra@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
opt-level = "s"
|
||||||
|
|
||||||
|
[profile.dev]
|
||||||
|
debug = true # Symbols are nice and they don't increase the size on Flash
|
||||||
|
opt-level = "z"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
pio = ["esp-idf-sys/pio"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
esp-idf-sys = { version = "0.31.5", features = ["binstart"] }
|
||||||
|
vls-protocol-signer = { path = "../../validating-lightning-signer/vls-protocol-signer", default-features = false, features = ["secp-lowmemory"] }
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
embuild = "0.29"
|
||||||
|
anyhow = "1"
|
||||||
|
|||||||
5
signer/build.rs
Normal file
5
signer/build.rs
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
// Necessary because of this issue: https://github.com/rust-lang/cargo/issues/9641
|
||||||
|
fn main() -> anyhow::Result<()> {
|
||||||
|
embuild::build::CfgArgs::output_propagated("ESP_IDF")?;
|
||||||
|
embuild::build::LinkArgs::output_propagated("ESP_IDF")
|
||||||
|
}
|
||||||
3
signer/rust-toolchain.toml
Normal file
3
signer/rust-toolchain.toml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[toolchain]
|
||||||
|
|
||||||
|
channel = "nightly"
|
||||||
10
signer/sdkconfig.defaults
Normal file
10
signer/sdkconfig.defaults
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Rust often needs a bit of an extra main task stack size compared to C (the default is 3K)
|
||||||
|
CONFIG_ESP_MAIN_TASK_STACK_SIZE=7000
|
||||||
|
|
||||||
|
# Use this to set FreeRTOS kernel tick frequency to 1000 Hz (100 Hz by default).
|
||||||
|
# This allows to use 1 ms granuality for thread sleeps (10 ms by default).
|
||||||
|
#CONFIG_FREERTOS_HZ=1000
|
||||||
|
|
||||||
|
# Workaround for https://github.com/espressif/esp-idf/issues/7631
|
||||||
|
CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=n
|
||||||
|
CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=n
|
||||||
9
signer/src/main.rs
Normal file
9
signer/src/main.rs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
use esp_idf_sys as _; // If using the `binstart` feature of `esp-idf-sys`, always keep this module imported
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
// 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();
|
||||||
|
|
||||||
|
println!("Hello, world!");
|
||||||
|
}
|
||||||
6
signer1/Cargo.toml
Normal file
6
signer1/Cargo.toml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[package]
|
||||||
|
name = "sphinx-key-signer"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Evan Feenstra <evanfeenstra@gmail.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
resolver = "2"
|
||||||
Reference in New Issue
Block a user