Skip to content

Commit ac90c02

Browse files
committed
demos: st7789: make demos standalone apps
1 parent 847a339 commit ac90c02

File tree

6 files changed

+48
-37
lines changed

6 files changed

+48
-37
lines changed

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ members = [
8787
"apis/sensors/proximity",
8888
"apis/sensors/temperature",
8989
"apis/storage/key_value",
90-
"demos/st7789",
91-
"demos/st7789-slint",
9290
"libraries/embedded_graphics_libtock",
9391
"panic_handlers/debug_panic",
9492
"panic_handlers/small_panic",

Makefile

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,6 @@ examples: toolchain
115115
EXCLUDE_RUNTIME := --exclude libtock --exclude libtock_runtime \
116116
--exclude libtock_debug_panic --exclude libtock_small_panic --exclude embedded_graphics_libtock
117117

118-
# Arguments to pass to cargo to exclude demo crates.
119-
EXCLUDE_RUNTIME := $(EXCLUDE_RUNTIME) --exclude st7789 --exclude st7789-slint
120-
121118
# Arguments to pass to cargo to exclude crates that cannot be tested by Miri. In
122119
# addition to excluding libtock_runtime, Miri also cannot test proc macro crates
123120
# (and in fact will generate broken data that causes cargo test to fail).
@@ -138,8 +135,6 @@ test: examples
138135
--target=thumbv7em-none-eabi --workspace
139136
LIBTOCK_PLATFORM=hifive1 cargo clippy $(EXCLUDE_STD) \
140137
--target=riscv32imac-unknown-none-elf --workspace
141-
$(MAKE) apollo3-st7789
142-
$(MAKE) apollo3-st7789-slint
143138
cd nightly && \
144139
MIRIFLAGS="-Zmiri-strict-provenance -Zmiri-symbolic-alignment-check" \
145140
cargo miri test $(EXCLUDE_MIRI) --manifest-path=../Cargo.toml \
@@ -174,22 +169,6 @@ $(1): toolchain
174169
mkdir -p target/tbf/$(1)
175170
cp target/$(1)/$(2)/release/examples/$(EXAMPLE).{tab,tbf} \
176171
target/tbf/$(1)
177-
178-
.PHONY: $(1)-st7789
179-
$(1)-st7789: toolchain
180-
cd demos/st7789 && LIBTOCK_PLATFORM=$(1) cargo run $(features) \
181-
$(release) --target=$(2) --target-dir=target/$(1)
182-
mkdir -p target/tbf/$(1)
183-
cp demos/st7789/target/$(1)/$(2)/release/st7789.{tab,tbf} \
184-
target/tbf/$(1)
185-
186-
.PHONY: $(1)-st7789-slint
187-
$(1)-st7789-slint: toolchain
188-
cd demos/st7789-slint && LIBTOCK_PLATFORM=$(1) cargo run $(features) \
189-
$(release) --target=$(2) --target-dir=target/$(1)
190-
mkdir -p target/tbf/$(1)
191-
cp demos/st7789-slint/target/$(1)/$(2)/release/st7789-slint.{tab,tbf} \
192-
target/tbf/$(1)
193172
endef
194173

195174
# Creates the `make flash-<BOARD> EXAMPLE=<EXAMPLE>` targets. Arguments:
@@ -200,18 +179,6 @@ flash-$(1): toolchain
200179
LIBTOCK_PLATFORM=$(1) cargo run --example $(EXAMPLE) $(features) \
201180
$(release) --target=$(2) --target-dir=target/flash-$(1) -- \
202181
--deploy=tockloader
203-
204-
.PHONY: flash-$(1)-st7789
205-
flash-$(1)-st7789: toolchain
206-
cd demos/st7789 && LIBTOCK_PLATFORM=$(1) cargo run $(features) \
207-
$(release) --target=$(2) --target-dir=target/flash-$(1) -- \
208-
--deploy=tockloader
209-
210-
.PHONY: flash-$(1)-st7789-slint
211-
flash-$(1)-st7789-slint: toolchain
212-
cd demos/st7789-slint && LIBTOCK_PLATFORM=$(1) cargo run $(features) \
213-
$(release) --target=$(2) --target-dir=target/flash-$(1) -- \
214-
--deploy=tockloader
215182
endef
216183

217184
$(eval $(call platform_build,apollo3,thumbv7em-none-eabi))
@@ -246,6 +213,8 @@ $(eval $(call platform_flash,clue_nrf52840,thumbv7em-none-eabi))
246213
demos:
247214
$(MAKE) -C demos/embedded_graphics/spin
248215
$(MAKE) -C demos/embedded_graphics/buttons
216+
$(MAKE) -C demos/st7789
217+
$(MAKE) -C demos/st7789-slint
249218

250219
# clean cannot safely be invoked concurrently with other actions, so we don't
251220
# need to depend on toolchain. We also manually remove the nightly toolchain's

demos/st7789-slint/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "st7789-slint"
33
version = "0.1.0"
44
edition = "2021"
5-
rust-version.workspace = true
5+
rust-version = "1.87"
66
authors = ["Alistair Francis <alistair.francis@wdc.com>"]
77
description = """A demo to use the Slint GUI library with a ST7789 display via SPI using libtock-rs."""
88
license = "Apache-2.0 OR MIT"
@@ -29,3 +29,5 @@ display-interface = "0.5"
2929
libtock_build_scripts = { path = "../../build_scripts" }
3030

3131
slint-build = { git = "https://github.com/slint-ui/slint" }
32+
33+
[workspace]

demos/st7789-slint/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Makefile for the demo app.
2+
3+
# Crate name of the demo app
4+
DEMO := st7789-slint
5+
6+
all: tab
7+
8+
include ../../Targets.mk
9+
10+
$(ELF_TARGETS):
11+
LIBTOCK_LINKER_FLASH=$(F) LIBTOCK_LINKER_RAM=$(R) cargo build --target=$(T) --release
12+
@mkdir -p target/$(A).$(F).$(R)/
13+
@cp target/$(T)/release/$(DEMO) target/$(A).$(F).$(R)/
14+
$(eval ELF_LIST += target/$(A).$(F).$(R)/$(DEMO),$(A).$(F).$(R))
15+
16+
# This target (`make tab`) is not parallel-safe
17+
.PHONY: tab
18+
tab: $(ELF_TARGETS)
19+
@mkdir -p target/tab
20+
elf2tab --kernel-major 2 --kernel-minor 1 -n $(DEMO) -o target/tab/$(DEMO).tab --stack 1024 --minimum-footer-size 256 $(ELF_LIST)

demos/st7789/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "st7789"
33
version = "0.1.0"
44
edition = "2021"
5-
rust-version.workspace = true
5+
rust-version = "1.87"
66
authors = ["Alistair Francis <alistair.francis@wdc.com>"]
77
description = """A demo to drive a ST7789 display via SPI using libtock-rs."""
88
license = "Apache-2.0 OR MIT"
@@ -18,3 +18,5 @@ embedded-graphics = "0.8"
1818

1919
[build-dependencies]
2020
libtock_build_scripts = { path = "../../build_scripts" }
21+
22+
[workspace]

demos/st7789/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Makefile for the demo app.
2+
3+
# Crate name of the demo app
4+
DEMO := st7789
5+
6+
all: tab
7+
8+
include ../../Targets.mk
9+
10+
$(ELF_TARGETS):
11+
LIBTOCK_LINKER_FLASH=$(F) LIBTOCK_LINKER_RAM=$(R) cargo build --target=$(T) --release
12+
@mkdir -p target/$(A).$(F).$(R)/
13+
@cp target/$(T)/release/$(DEMO) target/$(A).$(F).$(R)/
14+
$(eval ELF_LIST += target/$(A).$(F).$(R)/$(DEMO),$(A).$(F).$(R))
15+
16+
# This target (`make tab`) is not parallel-safe
17+
.PHONY: tab
18+
tab: $(ELF_TARGETS)
19+
@mkdir -p target/tab
20+
elf2tab --kernel-major 2 --kernel-minor 1 -n $(DEMO) -o target/tab/$(DEMO).tab --stack 1024 --minimum-footer-size 256 $(ELF_LIST)

0 commit comments

Comments
 (0)