Skip to content

Commit

Permalink
Merge pull request #307 from Nitrokey/nk3-webcrypt-firmware
Browse files Browse the repository at this point in the history
Revert LTO change for all variants, except for the NRF52/test
  • Loading branch information
szszszsz authored Jul 6, 2023
2 parents 205adad + 085e9e9 commit 6d7f96e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
9 changes: 8 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,17 @@ trussed-usbip = { git = "https://github.com/Nitrokey/pc-usbip-runner", tag = "v0

[profile.release]
codegen-units = 1
lto = "thin"
lto = "fat"
opt-level = "z"
incremental = false
debug = true

[profile.release-thin-lto]
lto = "thin"
inherits = "release"

[profile.release.package.salty]
opt-level = 2

[profile.release-thin-lto.package.salty]
opt-level = 2
10 changes: 6 additions & 4 deletions runners/embedded/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ clean-all:
#### actual build, clean, reset, program targets
###############################################################################

CUSTOM_PROFILE=$(shell python3 -c "p = 'release-thin-lto' if '$(BOARD)' == 'nk3am' and 'test' in '$(COMMA_FEATURES)'.split(',') else 'release'; print(p); " )
build: build-banner $(SRCS) check-var-BOARD check-var-BUILD_PROFILE check-var-SOC

cargo --version
Expand All @@ -130,9 +131,10 @@ build: build-banner $(SRCS) check-var-BOARD check-var-BUILD_PROFILE check-var-SO
echo 'build_profile = "$(BUILD_PROFILE)"' >> cfg.toml
echo 'board = "$(BOARD)"' >> cfg.toml

cargo build --release --target $(TARGET) \
# NRF52/test -> "release-thin-lto", use "release" otherwise
cargo build --target $(TARGET) \
--features $(COMMA_FEATURES) \
--quiet
--quiet --profile $(CUSTOM_PROFILE)

cp $(RAW_OUT) ./$(OUT_ELF)

Expand All @@ -154,9 +156,9 @@ check: check-banner $(SRCS) check-var-BOARD check-var-BUILD_PROFILE check-var-SO
echo 'build_profile = "$(BUILD_PROFILE)"' >> cfg.toml
echo 'board = "$(BOARD)"' >> cfg.toml

cargo check --release --target $(TARGET) \
cargo check --target $(TARGET) \
--features $(COMMA_FEATURES) \
--quiet
--quiet --profile $(CUSTOM_PROFILE)

clean: clean-banner check-var-BOARD check-var-BUILD_PROFILE
rm -f ./$(OUT_BIN) ./$(OUT_ELF) ./$(OUT_IHEX) $(RAW_OUT) $(SYMBOLS) $(LOG)
Expand Down

0 comments on commit 6d7f96e

Please sign in to comment.