diff --git a/Cargo.toml b/Cargo.toml index 61f9919b..478f74bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -87,8 +87,6 @@ members = [ "apis/sensors/proximity", "apis/sensors/temperature", "apis/storage/key_value", - "demos/st7789", - "demos/st7789-slint", "libraries/embedded_graphics_libtock", "panic_handlers/debug_panic", "panic_handlers/small_panic", diff --git a/Makefile b/Makefile index 09924900..32c1f94a 100644 --- a/Makefile +++ b/Makefile @@ -115,9 +115,6 @@ examples: toolchain EXCLUDE_RUNTIME := --exclude libtock --exclude libtock_runtime \ --exclude libtock_debug_panic --exclude libtock_small_panic --exclude embedded_graphics_libtock -# Arguments to pass to cargo to exclude demo crates. -EXCLUDE_RUNTIME := $(EXCLUDE_RUNTIME) --exclude st7789 --exclude st7789-slint - # Arguments to pass to cargo to exclude crates that cannot be tested by Miri. In # addition to excluding libtock_runtime, Miri also cannot test proc macro crates # (and in fact will generate broken data that causes cargo test to fail). @@ -138,8 +135,6 @@ test: examples --target=thumbv7em-none-eabi --workspace LIBTOCK_PLATFORM=hifive1 cargo clippy $(EXCLUDE_STD) \ --target=riscv32imac-unknown-none-elf --workspace - $(MAKE) apollo3-st7789 - $(MAKE) apollo3-st7789-slint cd nightly && \ MIRIFLAGS="-Zmiri-strict-provenance -Zmiri-symbolic-alignment-check" \ cargo miri test $(EXCLUDE_MIRI) --manifest-path=../Cargo.toml \ @@ -174,22 +169,6 @@ $(1): toolchain mkdir -p target/tbf/$(1) cp target/$(1)/$(2)/release/examples/$(EXAMPLE).{tab,tbf} \ target/tbf/$(1) - -.PHONY: $(1)-st7789 -$(1)-st7789: toolchain - cd demos/st7789 && LIBTOCK_PLATFORM=$(1) cargo run $(features) \ - $(release) --target=$(2) --target-dir=target/$(1) - mkdir -p target/tbf/$(1) - cp demos/st7789/target/$(1)/$(2)/release/st7789.{tab,tbf} \ - target/tbf/$(1) - -.PHONY: $(1)-st7789-slint -$(1)-st7789-slint: toolchain - cd demos/st7789-slint && LIBTOCK_PLATFORM=$(1) cargo run $(features) \ - $(release) --target=$(2) --target-dir=target/$(1) - mkdir -p target/tbf/$(1) - cp demos/st7789-slint/target/$(1)/$(2)/release/st7789-slint.{tab,tbf} \ - target/tbf/$(1) endef # Creates the `make flash- EXAMPLE=` targets. Arguments: @@ -200,18 +179,6 @@ flash-$(1): toolchain LIBTOCK_PLATFORM=$(1) cargo run --example $(EXAMPLE) $(features) \ $(release) --target=$(2) --target-dir=target/flash-$(1) -- \ --deploy=tockloader - -.PHONY: flash-$(1)-st7789 -flash-$(1)-st7789: toolchain - cd demos/st7789 && LIBTOCK_PLATFORM=$(1) cargo run $(features) \ - $(release) --target=$(2) --target-dir=target/flash-$(1) -- \ - --deploy=tockloader - -.PHONY: flash-$(1)-st7789-slint -flash-$(1)-st7789-slint: toolchain - cd demos/st7789-slint && LIBTOCK_PLATFORM=$(1) cargo run $(features) \ - $(release) --target=$(2) --target-dir=target/flash-$(1) -- \ - --deploy=tockloader endef $(eval $(call platform_build,apollo3,thumbv7em-none-eabi)) @@ -246,6 +213,8 @@ $(eval $(call platform_flash,clue_nrf52840,thumbv7em-none-eabi)) demos: $(MAKE) -C demos/embedded_graphics/spin $(MAKE) -C demos/embedded_graphics/buttons + $(MAKE) -C demos/st7789 + $(MAKE) -C demos/st7789-slint # clean cannot safely be invoked concurrently with other actions, so we don't # need to depend on toolchain. We also manually remove the nightly toolchain's diff --git a/demos/st7789-slint/Cargo.toml b/demos/st7789-slint/Cargo.toml index 79be8592..17510ea2 100644 --- a/demos/st7789-slint/Cargo.toml +++ b/demos/st7789-slint/Cargo.toml @@ -2,7 +2,7 @@ name = "st7789-slint" version = "0.1.0" edition = "2021" -rust-version.workspace = true +rust-version = "1.87" authors = ["Alistair Francis "] description = """A demo to use the Slint GUI library with a ST7789 display via SPI using libtock-rs.""" license = "Apache-2.0 OR MIT" @@ -29,3 +29,5 @@ display-interface = "0.5" libtock_build_scripts = { path = "../../build_scripts" } slint-build = { git = "https://github.com/slint-ui/slint" } + +[workspace] diff --git a/demos/st7789-slint/Makefile b/demos/st7789-slint/Makefile new file mode 100644 index 00000000..5104c035 --- /dev/null +++ b/demos/st7789-slint/Makefile @@ -0,0 +1,20 @@ +# Makefile for the demo app. + +# Crate name of the demo app +DEMO := st7789-slint + +all: tab + +include ../../Targets.mk + +$(ELF_TARGETS): + LIBTOCK_LINKER_FLASH=$(F) LIBTOCK_LINKER_RAM=$(R) cargo build --target=$(T) --release + @mkdir -p target/$(A).$(F).$(R)/ + @cp target/$(T)/release/$(DEMO) target/$(A).$(F).$(R)/ + $(eval ELF_LIST += target/$(A).$(F).$(R)/$(DEMO),$(A).$(F).$(R)) + +# This target (`make tab`) is not parallel-safe +.PHONY: tab +tab: $(ELF_TARGETS) + @mkdir -p target/tab + elf2tab --kernel-major 2 --kernel-minor 1 -n $(DEMO) -o target/tab/$(DEMO).tab --stack 1024 --minimum-footer-size 256 $(ELF_LIST) diff --git a/demos/st7789/Cargo.toml b/demos/st7789/Cargo.toml index e75a5471..d1fac957 100644 --- a/demos/st7789/Cargo.toml +++ b/demos/st7789/Cargo.toml @@ -2,7 +2,7 @@ name = "st7789" version = "0.1.0" edition = "2021" -rust-version.workspace = true +rust-version = "1.87" authors = ["Alistair Francis "] description = """A demo to drive a ST7789 display via SPI using libtock-rs.""" license = "Apache-2.0 OR MIT" @@ -18,3 +18,5 @@ embedded-graphics = "0.8" [build-dependencies] libtock_build_scripts = { path = "../../build_scripts" } + +[workspace] diff --git a/demos/st7789/Makefile b/demos/st7789/Makefile new file mode 100644 index 00000000..c3a13cd8 --- /dev/null +++ b/demos/st7789/Makefile @@ -0,0 +1,20 @@ +# Makefile for the demo app. + +# Crate name of the demo app +DEMO := st7789 + +all: tab + +include ../../Targets.mk + +$(ELF_TARGETS): + LIBTOCK_LINKER_FLASH=$(F) LIBTOCK_LINKER_RAM=$(R) cargo build --target=$(T) --release + @mkdir -p target/$(A).$(F).$(R)/ + @cp target/$(T)/release/$(DEMO) target/$(A).$(F).$(R)/ + $(eval ELF_LIST += target/$(A).$(F).$(R)/$(DEMO),$(A).$(F).$(R)) + +# This target (`make tab`) is not parallel-safe +.PHONY: tab +tab: $(ELF_TARGETS) + @mkdir -p target/tab + elf2tab --kernel-major 2 --kernel-minor 1 -n $(DEMO) -o target/tab/$(DEMO).tab --stack 1024 --minimum-footer-size 256 $(ELF_LIST)