Skip to content

Commit

Permalink
wip: bls signature in rust
Browse files Browse the repository at this point in the history
  • Loading branch information
neithanmo committed Mar 13, 2024
1 parent 0e58ab6 commit 547b117
Show file tree
Hide file tree
Showing 9 changed files with 495 additions and 8 deletions.
9 changes: 8 additions & 1 deletion app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@
cmake-build-debug/
\.idea/workspace\.xml
\.idea/

src/ledger/bin/
src/ledger/debug/
src/ledger/obj/
obj/app\.elf
debug/app\.map
debug/app\.asm
bin/app\.hex
bin/app\.elf
glyphs/glyphs\.h
glyphs/glyphs\.c
obj/
Expand Down
19 changes: 12 additions & 7 deletions app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ APP_LOAD_PARAMS = --curve secp256k1 $(COMMON_LOAD_PARAMS) --path $(APPPATH)

APP_STACK_MIN_SIZE := 3000
include $(CURDIR)/../deps/ledger-zxlib/makefiles/Makefile.devices
RUST_TARGET := thumbv6m-none-eabi

$(info TARGET_NAME = [$(TARGET_NAME)])
$(info ICONNAME = [$(ICONNAME)])
Expand All @@ -70,19 +71,19 @@ include $(CURDIR)/../deps/ledger-zxlib/makefiles/Makefile.platform
CFLAGS += -Wvla -Wno-implicit-fallthrough
CFLAGS += -I$(MY_DIR)/../deps/tinycbor/src
APP_SOURCE_PATH += $(MY_DIR)/../deps/tinycbor-ledger
LDFLAGS += -z muldefs
LDLIBS += -Lrust/target/$(RUST_TARGET)/release -lrslib
APP_SOURCE_PATH += $(MY_DIR)/rust/include

APP_CUSTOM_LINK_DEPENDENCIES = rust

.PHONY: rust
rust:
@echo "No rust code"
# cd rust && CARGO_HOME="$(CURDIR)/rust/.cargo" cargo build --target thumbv6m-none-eabi --release

# Before linking, we need to be sure rust lib is there
bin/app.elf: rust
cd rust && RUSTC_BOOTSTRAP=1 CARGO_HOME="$(CURDIR)/rust/.cargo" cargo build --target $(RUST_TARGET) --release

.PHONY: rust_clean
rust_clean:
@echo "No rust code"
# cd rust && CARGO_HOME="$(CURDIR)/rust/.cargo" cargo clean
cd rust && CARGO_HOME="$(CURDIR)/rust/.cargo" cargo clean

clean: rust_clean

Expand All @@ -101,3 +102,7 @@ listvariants:
.PHONY: version
version:
@echo "v$(APPVERSION)" > app.version

.PHONY: rust_tests
rust_tests:
cd rust && CARGO_HOME="$(CURDIR)/rust/.cargo" cargo test
13 changes: 13 additions & 0 deletions app/rust/.cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[build]

[target.'cfg(all(target_arch = "arm", target_os = "none"))']
rustflags = [
"--emit", "asm",
"-C", "relocation-model=ropi",
"-C", "link-arg=-nostartfiles",
"-C", "link-arg=-Tlink.ld",
"-C", "inline-threshold=0"
]
[unstable]
build-std=["core"]
build-std-features=["panic_immediate_abort"]
Loading

0 comments on commit 547b117

Please sign in to comment.