This is an automated email from the ASF dual-hosted git repository. yuanz pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/incubator-teaclave-trustzone-sdk.git
commit 979810c728769eddc1693f46423f1e7494238014 Author: Yuan Zhuang <[email protected]> AuthorDate: Fri Aug 22 11:55:44 2025 +0000 lint: Add clippy enforcement to TA Makefiles - Add clippy target with -D warnings to all TA Makefiles - Update rust-toolchain to support enhanced clippy features --- examples/acipher-rs/ta/Makefile | 14 +++++++++++--- examples/aes-rs/ta/Makefile | 14 +++++++++++--- examples/authentication-rs/ta/Makefile | 14 +++++++++++--- examples/big_int-rs/ta/Makefile | 14 +++++++++++--- examples/build_with_optee_utee_sys-rs/ta/Makefile | 12 +++++++++--- examples/client_pool-rs/ta/Makefile | 14 +++++++++++--- examples/diffie_hellman-rs/ta/Makefile | 14 +++++++++++--- examples/digest-rs/ta/Makefile | 14 +++++++++++--- examples/error_handling-rs/ta/Makefile | 14 +++++++++++--- examples/hello_world-rs/ta/Makefile | 14 +++++++++++--- examples/hotp-rs/ta/Makefile | 14 +++++++++++--- examples/inter_ta-rs/ta/Makefile | 14 +++++++++++--- examples/message_passing_interface-rs/ta/Makefile | 10 +++++++--- examples/mnist-rs/rust-toolchain.toml | 2 +- examples/property-rs/ta/Makefile | 14 +++++++++++--- examples/random-rs/ta/Makefile | 14 +++++++++++--- examples/secure_db_abstraction-rs/ta/Makefile | 10 +++++++--- examples/secure_storage-rs/ta/Makefile | 14 +++++++++++--- examples/serde-rs/ta/Makefile | 10 +++++++--- examples/signature_verification-rs/ta/Makefile | 14 +++++++++++--- examples/supp_plugin-rs/ta/Makefile | 14 +++++++++++--- examples/tcp_client-rs/ta/Makefile | 17 ++++++++++++++--- examples/time-rs/ta/Makefile | 14 +++++++++++--- examples/tls_client-rs/ta/Makefile | 10 +++++++--- examples/tls_server-rs/ta/Makefile | 10 +++++++--- examples/udp_socket-rs/ta/Makefile | 17 ++++++++++++++--- rust-toolchain.toml | 2 +- 27 files changed, 261 insertions(+), 77 deletions(-) diff --git a/examples/acipher-rs/ta/Makefile b/examples/acipher-rs/ta/Makefile index bd3c016..fecb826 100644 --- a/examples/acipher-rs/ta/Makefile +++ b/examples/acipher-rs/ta/Makefile @@ -23,16 +23,24 @@ OBJCOPY := $(CROSS_COMPILE)objcopy # Configure the linker to use GCC, which works on both cross-compilation and ARM machines LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" +# fix for the error: "unwinding panics are not supported without std" reported by clippy +# Only set panic=abort when STD is not enabled (no-std mode) +RUSTFLAGS := $(if $(STD),,-C panic=abort) + TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER ?= $(if $(STD),xargo,cargo) -all: ta strip sign +all: clippy ta strip sign + +clippy: + @cargo fmt + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) clippy --target $(TARGET) -- -D warnings -ta: - @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) +ta: clippy + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/aes-rs/ta/Makefile b/examples/aes-rs/ta/Makefile index bd3c016..fecb826 100644 --- a/examples/aes-rs/ta/Makefile +++ b/examples/aes-rs/ta/Makefile @@ -23,16 +23,24 @@ OBJCOPY := $(CROSS_COMPILE)objcopy # Configure the linker to use GCC, which works on both cross-compilation and ARM machines LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" +# fix for the error: "unwinding panics are not supported without std" reported by clippy +# Only set panic=abort when STD is not enabled (no-std mode) +RUSTFLAGS := $(if $(STD),,-C panic=abort) + TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER ?= $(if $(STD),xargo,cargo) -all: ta strip sign +all: clippy ta strip sign + +clippy: + @cargo fmt + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) clippy --target $(TARGET) -- -D warnings -ta: - @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) +ta: clippy + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/authentication-rs/ta/Makefile b/examples/authentication-rs/ta/Makefile index bd3c016..fecb826 100644 --- a/examples/authentication-rs/ta/Makefile +++ b/examples/authentication-rs/ta/Makefile @@ -23,16 +23,24 @@ OBJCOPY := $(CROSS_COMPILE)objcopy # Configure the linker to use GCC, which works on both cross-compilation and ARM machines LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" +# fix for the error: "unwinding panics are not supported without std" reported by clippy +# Only set panic=abort when STD is not enabled (no-std mode) +RUSTFLAGS := $(if $(STD),,-C panic=abort) + TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER ?= $(if $(STD),xargo,cargo) -all: ta strip sign +all: clippy ta strip sign + +clippy: + @cargo fmt + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) clippy --target $(TARGET) -- -D warnings -ta: - @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) +ta: clippy + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/big_int-rs/ta/Makefile b/examples/big_int-rs/ta/Makefile index bd3c016..fecb826 100644 --- a/examples/big_int-rs/ta/Makefile +++ b/examples/big_int-rs/ta/Makefile @@ -23,16 +23,24 @@ OBJCOPY := $(CROSS_COMPILE)objcopy # Configure the linker to use GCC, which works on both cross-compilation and ARM machines LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" +# fix for the error: "unwinding panics are not supported without std" reported by clippy +# Only set panic=abort when STD is not enabled (no-std mode) +RUSTFLAGS := $(if $(STD),,-C panic=abort) + TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER ?= $(if $(STD),xargo,cargo) -all: ta strip sign +all: clippy ta strip sign + +clippy: + @cargo fmt + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) clippy --target $(TARGET) -- -D warnings -ta: - @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) +ta: clippy + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/build_with_optee_utee_sys-rs/ta/Makefile b/examples/build_with_optee_utee_sys-rs/ta/Makefile index 7df5dd0..8015f45 100644 --- a/examples/build_with_optee_utee_sys-rs/ta/Makefile +++ b/examples/build_with_optee_utee_sys-rs/ta/Makefile @@ -22,15 +22,21 @@ CROSS_COMPILE ?= aarch64-linux-gnu- OBJCOPY := $(CROSS_COMPILE)objcopy # Configure the linker to use GCC, which works on both cross-compilation and ARM machines LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" +# fix for the error: "unwinding panics are not supported without std" reported by clippy +RUSTFLAGS := -C panic=abort TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py OUT_DIR := $(CURDIR)/target/$(TARGET)/release -all: ta strip sign +all: clippy ta strip sign -ta: - @cargo build --target $(TARGET) --release --config $(LINKER_CFG) $(EXTRA_FLAGS) +clippy: + @cargo fmt + @RUSTFLAGS="$(RUSTFLAGS)" cargo clippy --target $(TARGET) -- -D warnings + +ta: clippy + @RUSTFLAGS="$(RUSTFLAGS)" cargo build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/client_pool-rs/ta/Makefile b/examples/client_pool-rs/ta/Makefile index bd3c016..fecb826 100644 --- a/examples/client_pool-rs/ta/Makefile +++ b/examples/client_pool-rs/ta/Makefile @@ -23,16 +23,24 @@ OBJCOPY := $(CROSS_COMPILE)objcopy # Configure the linker to use GCC, which works on both cross-compilation and ARM machines LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" +# fix for the error: "unwinding panics are not supported without std" reported by clippy +# Only set panic=abort when STD is not enabled (no-std mode) +RUSTFLAGS := $(if $(STD),,-C panic=abort) + TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER ?= $(if $(STD),xargo,cargo) -all: ta strip sign +all: clippy ta strip sign + +clippy: + @cargo fmt + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) clippy --target $(TARGET) -- -D warnings -ta: - @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) +ta: clippy + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/diffie_hellman-rs/ta/Makefile b/examples/diffie_hellman-rs/ta/Makefile index bd3c016..fecb826 100644 --- a/examples/diffie_hellman-rs/ta/Makefile +++ b/examples/diffie_hellman-rs/ta/Makefile @@ -23,16 +23,24 @@ OBJCOPY := $(CROSS_COMPILE)objcopy # Configure the linker to use GCC, which works on both cross-compilation and ARM machines LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" +# fix for the error: "unwinding panics are not supported without std" reported by clippy +# Only set panic=abort when STD is not enabled (no-std mode) +RUSTFLAGS := $(if $(STD),,-C panic=abort) + TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER ?= $(if $(STD),xargo,cargo) -all: ta strip sign +all: clippy ta strip sign + +clippy: + @cargo fmt + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) clippy --target $(TARGET) -- -D warnings -ta: - @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) +ta: clippy + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/digest-rs/ta/Makefile b/examples/digest-rs/ta/Makefile index bd3c016..fecb826 100644 --- a/examples/digest-rs/ta/Makefile +++ b/examples/digest-rs/ta/Makefile @@ -23,16 +23,24 @@ OBJCOPY := $(CROSS_COMPILE)objcopy # Configure the linker to use GCC, which works on both cross-compilation and ARM machines LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" +# fix for the error: "unwinding panics are not supported without std" reported by clippy +# Only set panic=abort when STD is not enabled (no-std mode) +RUSTFLAGS := $(if $(STD),,-C panic=abort) + TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER ?= $(if $(STD),xargo,cargo) -all: ta strip sign +all: clippy ta strip sign + +clippy: + @cargo fmt + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) clippy --target $(TARGET) -- -D warnings -ta: - @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) +ta: clippy + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/error_handling-rs/ta/Makefile b/examples/error_handling-rs/ta/Makefile index bd3c016..fecb826 100644 --- a/examples/error_handling-rs/ta/Makefile +++ b/examples/error_handling-rs/ta/Makefile @@ -23,16 +23,24 @@ OBJCOPY := $(CROSS_COMPILE)objcopy # Configure the linker to use GCC, which works on both cross-compilation and ARM machines LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" +# fix for the error: "unwinding panics are not supported without std" reported by clippy +# Only set panic=abort when STD is not enabled (no-std mode) +RUSTFLAGS := $(if $(STD),,-C panic=abort) + TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER ?= $(if $(STD),xargo,cargo) -all: ta strip sign +all: clippy ta strip sign + +clippy: + @cargo fmt + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) clippy --target $(TARGET) -- -D warnings -ta: - @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) +ta: clippy + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/hello_world-rs/ta/Makefile b/examples/hello_world-rs/ta/Makefile index 4a00808..ef12db2 100644 --- a/examples/hello_world-rs/ta/Makefile +++ b/examples/hello_world-rs/ta/Makefile @@ -23,16 +23,24 @@ OBJCOPY := $(CROSS_COMPILE)objcopy # Configure the linker to use GCC, which works on both cross-compilation and ARM machines LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" +# fix for the error: "unwinding panics are not supported without std" reported by clippy +# Only set panic=abort when STD is not enabled (no-std mode) +RUSTFLAGS := $(if $(STD),,-C panic=abort) + TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER ?= $(if $(STD),xargo,cargo) -all: ta strip sign +all: clippy ta strip sign + +clippy: + @cargo fmt + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) clippy --target $(TARGET) -- -D warnings -ta: - @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) +ta: clippy + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/hotp-rs/ta/Makefile b/examples/hotp-rs/ta/Makefile index bd3c016..fecb826 100644 --- a/examples/hotp-rs/ta/Makefile +++ b/examples/hotp-rs/ta/Makefile @@ -23,16 +23,24 @@ OBJCOPY := $(CROSS_COMPILE)objcopy # Configure the linker to use GCC, which works on both cross-compilation and ARM machines LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" +# fix for the error: "unwinding panics are not supported without std" reported by clippy +# Only set panic=abort when STD is not enabled (no-std mode) +RUSTFLAGS := $(if $(STD),,-C panic=abort) + TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER ?= $(if $(STD),xargo,cargo) -all: ta strip sign +all: clippy ta strip sign + +clippy: + @cargo fmt + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) clippy --target $(TARGET) -- -D warnings -ta: - @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) +ta: clippy + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/inter_ta-rs/ta/Makefile b/examples/inter_ta-rs/ta/Makefile index bd3c016..fecb826 100644 --- a/examples/inter_ta-rs/ta/Makefile +++ b/examples/inter_ta-rs/ta/Makefile @@ -23,16 +23,24 @@ OBJCOPY := $(CROSS_COMPILE)objcopy # Configure the linker to use GCC, which works on both cross-compilation and ARM machines LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" +# fix for the error: "unwinding panics are not supported without std" reported by clippy +# Only set panic=abort when STD is not enabled (no-std mode) +RUSTFLAGS := $(if $(STD),,-C panic=abort) + TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER ?= $(if $(STD),xargo,cargo) -all: ta strip sign +all: clippy ta strip sign + +clippy: + @cargo fmt + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) clippy --target $(TARGET) -- -D warnings -ta: - @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) +ta: clippy + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/message_passing_interface-rs/ta/Makefile b/examples/message_passing_interface-rs/ta/Makefile index 1050c1f..8e20344 100644 --- a/examples/message_passing_interface-rs/ta/Makefile +++ b/examples/message_passing_interface-rs/ta/Makefile @@ -19,7 +19,7 @@ UUID ?= $(shell cat "../uuid.txt") -TARGET ?= aarch64-unknown-linux-gnu +TARGET ?= aarch64-unknown-optee CROSS_COMPILE ?= aarch64-linux-gnu- OBJCOPY := $(CROSS_COMPILE)objcopy # Configure the linker to use GCC, which works on both cross-compilation and ARM machines @@ -29,9 +29,13 @@ TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py OUT_DIR := $(CURDIR)/target/$(TARGET)/release -all: ta strip sign +all: clippy ta strip sign -ta: +clippy: + @cargo fmt + @xargo clippy --target $(TARGET) -- -D warnings + +ta: clippy @xargo build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta diff --git a/examples/mnist-rs/rust-toolchain.toml b/examples/mnist-rs/rust-toolchain.toml index 54b64b4..77b51bc 100644 --- a/examples/mnist-rs/rust-toolchain.toml +++ b/examples/mnist-rs/rust-toolchain.toml @@ -19,7 +19,7 @@ [toolchain] channel = "nightly-2025-05-16" -components = [ "rust-src" ] +components = [ "rust-src", "rustfmt", "clippy" ] targets = ["aarch64-unknown-linux-gnu", "arm-unknown-linux-gnueabihf"] # minimal profile: install rustc, cargo, and rust-std profile = "minimal" diff --git a/examples/property-rs/ta/Makefile b/examples/property-rs/ta/Makefile index bd3c016..fecb826 100644 --- a/examples/property-rs/ta/Makefile +++ b/examples/property-rs/ta/Makefile @@ -23,16 +23,24 @@ OBJCOPY := $(CROSS_COMPILE)objcopy # Configure the linker to use GCC, which works on both cross-compilation and ARM machines LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" +# fix for the error: "unwinding panics are not supported without std" reported by clippy +# Only set panic=abort when STD is not enabled (no-std mode) +RUSTFLAGS := $(if $(STD),,-C panic=abort) + TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER ?= $(if $(STD),xargo,cargo) -all: ta strip sign +all: clippy ta strip sign + +clippy: + @cargo fmt + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) clippy --target $(TARGET) -- -D warnings -ta: - @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) +ta: clippy + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/random-rs/ta/Makefile b/examples/random-rs/ta/Makefile index bd3c016..fecb826 100644 --- a/examples/random-rs/ta/Makefile +++ b/examples/random-rs/ta/Makefile @@ -23,16 +23,24 @@ OBJCOPY := $(CROSS_COMPILE)objcopy # Configure the linker to use GCC, which works on both cross-compilation and ARM machines LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" +# fix for the error: "unwinding panics are not supported without std" reported by clippy +# Only set panic=abort when STD is not enabled (no-std mode) +RUSTFLAGS := $(if $(STD),,-C panic=abort) + TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER ?= $(if $(STD),xargo,cargo) -all: ta strip sign +all: clippy ta strip sign + +clippy: + @cargo fmt + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) clippy --target $(TARGET) -- -D warnings -ta: - @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) +ta: clippy + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/secure_db_abstraction-rs/ta/Makefile b/examples/secure_db_abstraction-rs/ta/Makefile index 1050c1f..8e20344 100644 --- a/examples/secure_db_abstraction-rs/ta/Makefile +++ b/examples/secure_db_abstraction-rs/ta/Makefile @@ -19,7 +19,7 @@ UUID ?= $(shell cat "../uuid.txt") -TARGET ?= aarch64-unknown-linux-gnu +TARGET ?= aarch64-unknown-optee CROSS_COMPILE ?= aarch64-linux-gnu- OBJCOPY := $(CROSS_COMPILE)objcopy # Configure the linker to use GCC, which works on both cross-compilation and ARM machines @@ -29,9 +29,13 @@ TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py OUT_DIR := $(CURDIR)/target/$(TARGET)/release -all: ta strip sign +all: clippy ta strip sign -ta: +clippy: + @cargo fmt + @xargo clippy --target $(TARGET) -- -D warnings + +ta: clippy @xargo build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta diff --git a/examples/secure_storage-rs/ta/Makefile b/examples/secure_storage-rs/ta/Makefile index bd3c016..fecb826 100644 --- a/examples/secure_storage-rs/ta/Makefile +++ b/examples/secure_storage-rs/ta/Makefile @@ -23,16 +23,24 @@ OBJCOPY := $(CROSS_COMPILE)objcopy # Configure the linker to use GCC, which works on both cross-compilation and ARM machines LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" +# fix for the error: "unwinding panics are not supported without std" reported by clippy +# Only set panic=abort when STD is not enabled (no-std mode) +RUSTFLAGS := $(if $(STD),,-C panic=abort) + TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER ?= $(if $(STD),xargo,cargo) -all: ta strip sign +all: clippy ta strip sign + +clippy: + @cargo fmt + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) clippy --target $(TARGET) -- -D warnings -ta: - @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) +ta: clippy + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/serde-rs/ta/Makefile b/examples/serde-rs/ta/Makefile index 1050c1f..8e20344 100644 --- a/examples/serde-rs/ta/Makefile +++ b/examples/serde-rs/ta/Makefile @@ -19,7 +19,7 @@ UUID ?= $(shell cat "../uuid.txt") -TARGET ?= aarch64-unknown-linux-gnu +TARGET ?= aarch64-unknown-optee CROSS_COMPILE ?= aarch64-linux-gnu- OBJCOPY := $(CROSS_COMPILE)objcopy # Configure the linker to use GCC, which works on both cross-compilation and ARM machines @@ -29,9 +29,13 @@ TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py OUT_DIR := $(CURDIR)/target/$(TARGET)/release -all: ta strip sign +all: clippy ta strip sign -ta: +clippy: + @cargo fmt + @xargo clippy --target $(TARGET) -- -D warnings + +ta: clippy @xargo build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta diff --git a/examples/signature_verification-rs/ta/Makefile b/examples/signature_verification-rs/ta/Makefile index bd3c016..fecb826 100644 --- a/examples/signature_verification-rs/ta/Makefile +++ b/examples/signature_verification-rs/ta/Makefile @@ -23,16 +23,24 @@ OBJCOPY := $(CROSS_COMPILE)objcopy # Configure the linker to use GCC, which works on both cross-compilation and ARM machines LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" +# fix for the error: "unwinding panics are not supported without std" reported by clippy +# Only set panic=abort when STD is not enabled (no-std mode) +RUSTFLAGS := $(if $(STD),,-C panic=abort) + TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER ?= $(if $(STD),xargo,cargo) -all: ta strip sign +all: clippy ta strip sign + +clippy: + @cargo fmt + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) clippy --target $(TARGET) -- -D warnings -ta: - @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) +ta: clippy + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/supp_plugin-rs/ta/Makefile b/examples/supp_plugin-rs/ta/Makefile index e0932ed..079024c 100644 --- a/examples/supp_plugin-rs/ta/Makefile +++ b/examples/supp_plugin-rs/ta/Makefile @@ -23,16 +23,24 @@ OBJCOPY := $(CROSS_COMPILE)objcopy # Configure the linker to use GCC, which works on both cross-compilation and ARM machines LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" +# fix for the error: "unwinding panics are not supported without std" reported by clippy +# Only set panic=abort when STD is not enabled (no-std mode) +RUSTFLAGS := $(if $(STD),,-C panic=abort) + TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER ?= $(if $(STD),xargo,cargo) -all: ta strip sign +all: clippy ta strip sign + +clippy: + @cargo fmt + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) clippy --target $(TARGET) -- -D warnings -ta: - @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) +ta: clippy + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/tcp_client-rs/ta/Makefile b/examples/tcp_client-rs/ta/Makefile index 44e8cdb..07002d6 100644 --- a/examples/tcp_client-rs/ta/Makefile +++ b/examples/tcp_client-rs/ta/Makefile @@ -25,16 +25,27 @@ OBJCOPY := $(CROSS_COMPILE)objcopy # Configure the linker to use GCC, which works on both cross-compilation and ARM machines LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" +# fix for the error: "unwinding panics are not supported without std" reported by clippy +# Only set panic=abort when STD is not enabled (no-std mode) +RUSTFLAGS := $(if $(STD),,-C panic=abort) + +# Enable std feature when STD=y +FEATURES := $(if $(STD),--features std,) + TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER ?= $(if $(STD),xargo,cargo) -all: ta strip sign +all: clippy ta strip sign + +clippy: + @cargo fmt + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) clippy --target $(TARGET) $(FEATURES) -- -D warnings -ta: - @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) +ta: clippy + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) build --target $(TARGET) --release $(FEATURES) --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/time-rs/ta/Makefile b/examples/time-rs/ta/Makefile index bd3c016..fecb826 100644 --- a/examples/time-rs/ta/Makefile +++ b/examples/time-rs/ta/Makefile @@ -23,16 +23,24 @@ OBJCOPY := $(CROSS_COMPILE)objcopy # Configure the linker to use GCC, which works on both cross-compilation and ARM machines LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" +# fix for the error: "unwinding panics are not supported without std" reported by clippy +# Only set panic=abort when STD is not enabled (no-std mode) +RUSTFLAGS := $(if $(STD),,-C panic=abort) + TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER ?= $(if $(STD),xargo,cargo) -all: ta strip sign +all: clippy ta strip sign + +clippy: + @cargo fmt + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) clippy --target $(TARGET) -- -D warnings -ta: - @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) +ta: clippy + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/tls_client-rs/ta/Makefile b/examples/tls_client-rs/ta/Makefile index 1050c1f..8e20344 100644 --- a/examples/tls_client-rs/ta/Makefile +++ b/examples/tls_client-rs/ta/Makefile @@ -19,7 +19,7 @@ UUID ?= $(shell cat "../uuid.txt") -TARGET ?= aarch64-unknown-linux-gnu +TARGET ?= aarch64-unknown-optee CROSS_COMPILE ?= aarch64-linux-gnu- OBJCOPY := $(CROSS_COMPILE)objcopy # Configure the linker to use GCC, which works on both cross-compilation and ARM machines @@ -29,9 +29,13 @@ TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py OUT_DIR := $(CURDIR)/target/$(TARGET)/release -all: ta strip sign +all: clippy ta strip sign -ta: +clippy: + @cargo fmt + @xargo clippy --target $(TARGET) -- -D warnings + +ta: clippy @xargo build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta diff --git a/examples/tls_server-rs/ta/Makefile b/examples/tls_server-rs/ta/Makefile index 1050c1f..8e20344 100644 --- a/examples/tls_server-rs/ta/Makefile +++ b/examples/tls_server-rs/ta/Makefile @@ -19,7 +19,7 @@ UUID ?= $(shell cat "../uuid.txt") -TARGET ?= aarch64-unknown-linux-gnu +TARGET ?= aarch64-unknown-optee CROSS_COMPILE ?= aarch64-linux-gnu- OBJCOPY := $(CROSS_COMPILE)objcopy # Configure the linker to use GCC, which works on both cross-compilation and ARM machines @@ -29,9 +29,13 @@ TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py OUT_DIR := $(CURDIR)/target/$(TARGET)/release -all: ta strip sign +all: clippy ta strip sign -ta: +clippy: + @cargo fmt + @xargo clippy --target $(TARGET) -- -D warnings + +ta: clippy @xargo build --target $(TARGET) --release --config $(LINKER_CFG) strip: ta diff --git a/examples/udp_socket-rs/ta/Makefile b/examples/udp_socket-rs/ta/Makefile index 44e8cdb..07002d6 100644 --- a/examples/udp_socket-rs/ta/Makefile +++ b/examples/udp_socket-rs/ta/Makefile @@ -25,16 +25,27 @@ OBJCOPY := $(CROSS_COMPILE)objcopy # Configure the linker to use GCC, which works on both cross-compilation and ARM machines LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" +# fix for the error: "unwinding panics are not supported without std" reported by clippy +# Only set panic=abort when STD is not enabled (no-std mode) +RUSTFLAGS := $(if $(STD),,-C panic=abort) + +# Enable std feature when STD=y +FEATURES := $(if $(STD),--features std,) + TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py OUT_DIR := $(CURDIR)/target/$(TARGET)/release BUILDER ?= $(if $(STD),xargo,cargo) -all: ta strip sign +all: clippy ta strip sign + +clippy: + @cargo fmt + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) clippy --target $(TARGET) $(FEATURES) -- -D warnings -ta: - @$(BUILDER) build --target $(TARGET) --release --config $(LINKER_CFG) +ta: clippy + @RUSTFLAGS="$(RUSTFLAGS)" $(BUILDER) build --target $(TARGET) --release $(FEATURES) --config $(LINKER_CFG) strip: ta @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/rust-toolchain.toml b/rust-toolchain.toml index f5affd4..a2b17a9 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -19,7 +19,7 @@ [toolchain] channel = "nightly-2024-05-15" -components = [ "rust-src" ] +components = [ "rust-src", "rustfmt", "clippy" ] targets = ["aarch64-unknown-linux-gnu", "arm-unknown-linux-gnueabihf"] # minimal profile: install rustc, cargo, and rust-std profile = "minimal" \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
