diff options
| author | Ian McIntyre <me@mciantyre.dev> | 2025-07-05 16:24:52 -0400 |
|---|---|---|
| committer | Ian McIntyre <me@mciantyre.dev> | 2025-07-05 16:24:52 -0400 |
| commit | 6f313f98fc8162c8dc7bac330fde927901cb9ba8 (patch) | |
| tree | b565427482d9fd16d0eae3791fb901882f9884da /Makefile | |
First commit
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1811907 --- /dev/null +++ b/Makefile @@ -0,0 +1,102 @@ +CODEGEN_TOOL_PROFILE := release +PAC_PROFILE := release +TIMINGS ?= --timings + +-include chiptool/target/$(CODEGEN_TOOL_PROFILE)/chiptool.d +-include svd2rust/target/$(CODEGEN_TOOL_PROFILE)/svd2rust.d +-include form/target/$(CODEGEN_TOOL_PROFILE)/form.d +-include svdtools/target/$(CODEGEN_TOOL_PROFILE)/svdtools.d + +CHIPTOOL = chiptool/target/$(CODEGEN_TOOL_PROFILE)/chiptool +SVD2RUST = svd2rust/target/$(CODEGEN_TOOL_PROFILE)/svd2rust +FORM = form/target/$(CODEGEN_TOOL_PROFILE)/form +SVDTOOLS = svdtools/target/$(CODEGEN_TOOL_PROFILE)/svdtools + +$(CHIPTOOL): + cargo build --manifest-path=chiptool/Cargo.toml --profile=$(CODEGEN_TOOL_PROFILE) + +$(SVD2RUST): + cargo build --manifest-path=svd2rust/Cargo.toml --profile=$(CODEGEN_TOOL_PROFILE) + +$(FORM): + cargo build --manifest-path=form/Cargo.toml --profile $(CODEGEN_TOOL_PROFILE) + +$(SVDTOOLS): + cargo build --manifest-path=svdtools/Cargo.toml --profile $(CODEGEN_TOOL_PROFILE) + +.PHONY: codegen_tools +codegen_tools: $(CHIPTOOL) $(RALTOOL) $(SVD2RUST) $(FORM) $(SVDTOOLS) + +.PHONY: test_codegen_tools +test_codegen_tools: codegen_tools + $(CHIPTOOL) --help + $(SVD2RUST) --help + $(FORM) --help + $(SVDTOOLS) --help + +.PHONY: imxrt-ral.shootout +imxrt-ral.shootout: + @cargo update --manifest-path=imxrt-ral/Cargo.toml + + @cargo clean --manifest-path=imxrt-ral/Cargo.toml --profile=$(PAC_PROFILE) + cargo build --manifest-path=imxrt-ral/Cargo.toml --profile=$(PAC_PROFILE) --target=thumbv7em-none-eabihf --package=imxrt-ral --features=imxrt1011,rt $(TIMINGS) + + @cargo clean --manifest-path=imxrt-ral/Cargo.toml --profile=$(PAC_PROFILE) + cargo build --manifest-path=imxrt-ral/Cargo.toml --profile=$(PAC_PROFILE) --target=thumbv7em-none-eabihf --package=imxrt-ral --features=imxrt1062,rt $(TIMINGS) + + @cargo clean --manifest-path=imxrt-ral/Cargo.toml --profile=$(PAC_PROFILE) + cargo build --manifest-path=imxrt-ral/Cargo.toml --profile=$(PAC_PROFILE) --target=thumbv7em-none-eabihf --package=imxrt-ral --features=imxrt1176_cm7,rt $(TIMINGS) + + @cargo clean --manifest-path=imxrt-ral/Cargo.toml --profile=$(PAC_PROFILE) + cargo build --manifest-path=imxrt-ral/Cargo.toml --profile=$(PAC_PROFILE) --target=thumbv8m.main-none-eabihf --package=imxrt-ral --features=imxrt1189_cm33,rt $(TIMINGS) + +imxrt-svd2rust: + @mkdir -p $@ + +imxrt-ral/svd/%.svd.patched: $(SVDTOOLS) + SVDTOOLS=../$(SVDTOOLS) $(MAKE) -C imxrt-ral svd/$*.svd.patched + +imxrt-svd2rust/%: imxrt-ral/svd/%.svd.patched imxrt-svd2rust $(SVD2RUST) $(FORM) + @mkdir -p $@ + @cp Cargo.toml.svd2rust $@/Cargo.toml + @$(SVD2RUST) -i $< --output-dir $@ + @$(FORM) --input $@/lib.rs --outdir $@/src/ + @rm -f @/lib.rs + @cargo fmt --manifest-path=$@/Cargo.toml + +.PHONY: imxrt-svd2rust.shootout +imxrt-svd2rust.shootout: imxrt-svd2rust/imxrt1011 imxrt-svd2rust/imxrt1062 + @cargo update --manifest-path=imxrt-svd2rust/imxrt1011/Cargo.toml + @cargo clean --manifest-path=imxrt-svd2rust/imxrt1011/Cargo.toml + cargo build --manifest-path=imxrt-svd2rust/imxrt1011/Cargo.toml --profile=$(PAC_PROFILE) --target=thumbv7em-none-eabihf --features=rt $(TIMINGS) + + @cargo update --manifest-path=imxrt-svd2rust/imxrt1062/Cargo.toml + @cargo clean --manifest-path=imxrt-svd2rust/imxrt1062/Cargo.toml + cargo build --manifest-path=imxrt-svd2rust/imxrt1062/Cargo.toml --profile=$(PAC_PROFILE) --target=thumbv7em-none-eabihf --features=rt $(TIMINGS) + +imxrt-chiptool: + @mkdir -p $@ + +imxrt-chiptool/%: imxrt-ral/svd/%.svd.patched imxrt-chiptool $(CHIPTOOL) $(FORM) + @mkdir -p $@ + @cp Cargo.toml.chiptool $@/Cargo.toml + @cd $@ && ../../$(CHIPTOOL) generate --svd ../../$< --transform ../../transform.yaml && ../../$(FORM) --input lib.rs --outdir src/ && rm lib.rs + @cargo fmt --manifest-path=$@/Cargo.toml + +.PHONY: imxrt-chiptool.shootout +imxrt-chiptool.shootout: imxrt-chiptool/imxrt1011 imxrt-chiptool/imxrt1062 imxrt-chiptool/imxrt1176_cm7 imxrt-chiptool/imxrt1189_cm33 + @cargo update --manifest-path=imxrt-chiptool/imxrt1011/Cargo.toml + @cargo clean --manifest-path=imxrt-chiptool/imxrt1011/Cargo.toml + cargo build --manifest-path=imxrt-chiptool/imxrt1011/Cargo.toml --profile=$(PAC_PROFILE) --target=thumbv7em-none-eabihf --features=rt $(TIMINGS) + + @cargo update --manifest-path=imxrt-chiptool/imxrt1062/Cargo.toml + @cargo clean --manifest-path=imxrt-chiptool/imxrt1062/Cargo.toml + cargo build --manifest-path=imxrt-chiptool/imxrt1062/Cargo.toml --profile=$(PAC_PROFILE) --target=thumbv7em-none-eabihf --features=rt $(TIMINGS) + + @cargo update --manifest-path=imxrt-chiptool/imxrt1176_cm7/Cargo.toml + @cargo clean --manifest-path=imxrt-chiptool/imxrt1176_cm7/Cargo.toml + cargo build --manifest-path=imxrt-chiptool/imxrt1176_cm7/Cargo.toml --profile=$(PAC_PROFILE) --target=thumbv7em-none-eabihf --features=rt $(TIMINGS) + + @cargo update --manifest-path=imxrt-chiptool/imxrt1189_cm33/Cargo.toml + @cargo clean --manifest-path=imxrt-chiptool/imxrt1189_cm33/Cargo.toml + cargo build --manifest-path=imxrt-chiptool/imxrt1189_cm33/Cargo.toml --profile=$(PAC_PROFILE) --target=thumbv8m.main-none-eabihf --features=rt $(TIMINGS) |
