Skip to content

Commit b03afb2

Browse files
authored
Merge branch 'tock:master' into master
2 parents 56a548d + 847a339 commit b03afb2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+2120
-299
lines changed

.github/workflows/artifacts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
make -j2 EXAMPLE=low_level_debug nrf52
4040
4141
- name: Archive artifacts
42-
uses: actions/upload-artifact@v3
42+
uses: actions/upload-artifact@v4
4343
with:
4444
name: libtock-rs examples
4545
path: target/tbf

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,4 @@ jobs:
4646
echo 'rustflags = ["-D", "warnings"]' >> .cargo/config.toml
4747
make -j2 setup
4848
make -j2 test
49+
make demos

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
/nightly/target
33
/target
44
/demos/*/target
5+
/demos/*/*/target

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ version = "0.1.0"
1313
[workspace.package]
1414
# This must be kept in sync with rust-toolchain.toml; please see that file for
1515
# more information.
16-
rust-version = "1.77"
16+
rust-version = "1.87"
1717

1818
[features]
1919
rust_embedded = [
@@ -41,6 +41,7 @@ libtock_low_level_debug = { path = "apis/kernel/low_level_debug" }
4141
libtock_ninedof = { path = "apis/sensors/ninedof" }
4242
libtock_platform = { path = "platform" }
4343
libtock_proximity = { path = "apis/sensors/proximity" }
44+
libtock_screen = { path = "apis/display/screen" }
4445
libtock_rng = { path = "apis/peripherals/rng" }
4546
libtock_runtime = { path = "runtime" }
4647
libtock_small_panic = { path = "panic_handlers/small_panic" }
@@ -82,11 +83,13 @@ members = [
8283
"apis/sensors/air_quality",
8384
"apis/sensors/ambient_light",
8485
"apis/sensors/ninedof",
86+
"apis/display/screen",
8587
"apis/sensors/proximity",
8688
"apis/sensors/temperature",
8789
"apis/storage/key_value",
8890
"demos/st7789",
8991
"demos/st7789-slint",
92+
"libraries/embedded_graphics_libtock",
9093
"panic_handlers/debug_panic",
9194
"panic_handlers/small_panic",
9295
"platform",

Makefile

Lines changed: 7 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ examples: toolchain
113113
# Used when we need to build a crate for the host OS, as libtock_runtime only
114114
# supports running on Tock.
115115
EXCLUDE_RUNTIME := --exclude libtock --exclude libtock_runtime \
116-
--exclude libtock_debug_panic --exclude libtock_small_panic
116+
--exclude libtock_debug_panic --exclude libtock_small_panic --exclude embedded_graphics_libtock
117117

118118
# Arguments to pass to cargo to exclude demo crates.
119119
EXCLUDE_RUNTIME := $(EXCLUDE_RUNTIME) --exclude st7789 --exclude st7789-slint
@@ -146,58 +146,7 @@ test: examples
146146
--target-dir=target --workspace
147147
echo '[ SUCCESS ] libtock-rs tests pass'
148148

149-
# Helper functions to define make targets to build for specific (flash, ram,
150-
# target) compilation tuples.
151-
#
152-
# Inspiration from these answers:
153-
# - https://stackoverflow.com/a/50357925
154-
# - https://stackoverflow.com/a/9458230
155-
#
156-
# To create a compilation target for a specific architecture with specific flash
157-
# and RAM addresses, use `fixed-target`:
158-
#
159-
# ```
160-
# $(call fixed-target, F=0x00030000 R=0x20008000 T=thumbv7em-none-eabi A=cortex-m4)
161-
# ```
162-
#
163-
# The "arguments" if you will are:
164-
# - F = Flash Address: The address in flash the app is compiled for.
165-
# - R = RAM Address: The address in RAM the app is compiled for.
166-
# - T = Target: The cargo target to compile for.
167-
# - A = Architecture: The Tock architecture name the target corresponds to.
168-
#
169-
# This technique uses two make variables internally to keep track of state:
170-
# - `ELF_TARGETS`: This is the list of unique targets for each compilation
171-
# tuple. Each target invokes `cargo build` with the specified settings.
172-
# - `ELF_LIST`: The is a list of .elf paths of the generated elfs (one per
173-
# compilation tuple). This is passed to `elf2tab` to generate the output .tab
174-
# file.
175-
#
176-
# Internally, what `fixed-target` does is define a new make target named the
177-
# join of all of the F/R/T/A variables (with the `=` characters removed) and
178-
# then assigns target variables to that new target to represent the compilation
179-
# tuple values.
180-
concat = $(subst =,,$(subst $(eval ) ,,$1))
181-
fixed-target = $(foreach A,$1,$(eval $(call concat,$1): $A)) $(eval ELF_TARGETS += $(call concat,$1))
182-
183-
$(call fixed-target, F=0x00030000 R=0x20008000 T=thumbv7em-none-eabi A=cortex-m4)
184-
$(call fixed-target, F=0x00038000 R=0x20010000 T=thumbv7em-none-eabi A=cortex-m4)
185-
186-
$(call fixed-target, F=0x00040000 R=0x10002000 T=thumbv7em-none-eabi A=cortex-m4)
187-
$(call fixed-target, F=0x00048000 R=0x1000a000 T=thumbv7em-none-eabi A=cortex-m4)
188-
189-
$(call fixed-target, F=0x00040000 R=0x20008000 T=thumbv7em-none-eabi A=cortex-m4)
190-
$(call fixed-target, F=0x00042000 R=0x2000a000 T=thumbv7em-none-eabi A=cortex-m4)
191-
$(call fixed-target, F=0x00048000 R=0x20010000 T=thumbv7em-none-eabi A=cortex-m4)
192-
193-
$(call fixed-target, F=0x00080000 R=0x20006000 T=thumbv7em-none-eabi A=cortex-m4)
194-
$(call fixed-target, F=0x00088000 R=0x2000e000 T=thumbv7em-none-eabi A=cortex-m4)
195-
196-
$(call fixed-target, F=0x403b0000 R=0x3fca2000 T=riscv32imc-unknown-none-elf A=riscv32imc)
197-
$(call fixed-target, F=0x40440000 R=0x3fcaa000 T=riscv32imc-unknown-none-elf A=riscv32imc)
198-
199-
$(call fixed-target, F=0x10020000 R=0x20004000 T=thumbv6m-none-eabi A=cortex-m0)
200-
$(call fixed-target, F=0x10028000 R=0x2000c000 T=thumbv6m-none-eabi A=cortex-m0)
149+
include Targets.mk
201150

202151
$(ELF_TARGETS): toolchain
203152
LIBTOCK_LINKER_FLASH=$(F) LIBTOCK_LINKER_RAM=$(R) cargo build --example $(EXAMPLE) $(features) --target=$(T) $(release)
@@ -293,6 +242,11 @@ $(eval $(call platform_build,msp432,thumbv7em-none-eabi))
293242
$(eval $(call platform_build,clue_nrf52840,thumbv7em-none-eabi))
294243
$(eval $(call platform_flash,clue_nrf52840,thumbv7em-none-eabi))
295244

245+
.PHONY: demos
246+
demos:
247+
$(MAKE) -C demos/embedded_graphics/spin
248+
$(MAKE) -C demos/embedded_graphics/buttons
249+
296250
# clean cannot safely be invoked concurrently with other actions, so we don't
297251
# need to depend on toolchain. We also manually remove the nightly toolchain's
298252
# target directory, in case the user doesn't want to install the nightly

Targets.mk

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Helper makefile to define build location targets for many common tock
2+
# platforms.
3+
#
4+
# To use:
5+
#
6+
# include Targets.mk
7+
8+
# Helper functions to define make targets to build for specific (flash, ram,
9+
# target) compilation tuples.
10+
#
11+
# Inspiration from these answers:
12+
# - https://stackoverflow.com/a/50357925
13+
# - https://stackoverflow.com/a/9458230
14+
#
15+
# To create a compilation target for a specific architecture with specific flash
16+
# and RAM addresses, use `fixed-target`:
17+
#
18+
# ```
19+
# $(call fixed-target, F=0x00030000 R=0x20008000 T=thumbv7em-none-eabi A=cortex-m4)
20+
# ```
21+
#
22+
# The "arguments" if you will are:
23+
# - F = Flash Address: The address in flash the app is compiled for.
24+
# - R = RAM Address: The address in RAM the app is compiled for.
25+
# - T = Target: The cargo target to compile for.
26+
# - A = Architecture: The Tock architecture name the target corresponds to.
27+
#
28+
# This technique uses two make variables internally to keep track of state:
29+
# - `ELF_TARGETS`: This is the list of unique targets for each compilation
30+
# tuple. Each target invokes `cargo build` with the specified settings.
31+
# - `ELF_LIST`: The is a list of .elf paths of the generated elfs (one per
32+
# compilation tuple). This is passed to `elf2tab` to generate the output .tab
33+
# file.
34+
#
35+
# Internally, what `fixed-target` does is define a new make target named the
36+
# join of all of the F/R/T/A variables (with the `=` characters removed) and
37+
# then assigns target variables to that new target to represent the compilation
38+
# tuple values.
39+
concat = $(subst =,,$(subst $(eval ) ,,$1))
40+
fixed-target = $(foreach A,$1,$(eval $(call concat,$1): $A)) $(eval ELF_TARGETS += $(call concat,$1))
41+
42+
$(call fixed-target, F=0x00030000 R=0x20008000 T=thumbv7em-none-eabi A=cortex-m4)
43+
$(call fixed-target, F=0x00038000 R=0x20010000 T=thumbv7em-none-eabi A=cortex-m4)
44+
45+
$(call fixed-target, F=0x00040000 R=0x10002000 T=thumbv7em-none-eabi A=cortex-m4)
46+
$(call fixed-target, F=0x00048000 R=0x1000a000 T=thumbv7em-none-eabi A=cortex-m4)
47+
48+
$(call fixed-target, F=0x00040000 R=0x20008000 T=thumbv7em-none-eabi A=cortex-m4)
49+
$(call fixed-target, F=0x00042000 R=0x2000a000 T=thumbv7em-none-eabi A=cortex-m4)
50+
$(call fixed-target, F=0x00048000 R=0x20010000 T=thumbv7em-none-eabi A=cortex-m4)
51+
52+
$(call fixed-target, F=0x00080000 R=0x20006000 T=thumbv7em-none-eabi A=cortex-m4)
53+
$(call fixed-target, F=0x00088000 R=0x2000e000 T=thumbv7em-none-eabi A=cortex-m4)
54+
55+
$(call fixed-target, F=0x403b0000 R=0x3fca2000 T=riscv32imc-unknown-none-elf A=rv32imc)
56+
$(call fixed-target, F=0x40440000 R=0x3fcaa000 T=riscv32imc-unknown-none-elf A=rv32imc)
57+
58+
$(call fixed-target, F=0x80100000 R=0x80300000 T=riscv32imac-unknown-none-elf A=rv32imac)
59+
$(call fixed-target, F=0x80110000 R=0x80310000 T=riscv32imac-unknown-none-elf A=rv32imac)
60+
$(call fixed-target, F=0x80130000 R=0x80330000 T=riscv32imac-unknown-none-elf A=rv32imac)
61+
$(call fixed-target, F=0x80180000 R=0x80380000 T=riscv32imac-unknown-none-elf A=rv32imac)
62+
63+
$(call fixed-target, F=0x10020000 R=0x20004000 T=thumbv6m-none-eabi A=cortex-m0)
64+
$(call fixed-target, F=0x10028000 R=0x2000c000 T=thumbv6m-none-eabi A=cortex-m0)
65+
66+
$(call fixed-target, F=0x10040000 R=0x20020000 T=thumbv8m.main-none-eabi A=cortex-m33)
67+
$(call fixed-target, F=0x10060000 R=0x20028000 T=thumbv8m.main-none-eabi A=cortex-m33)

apis/display/screen/Cargo.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[package]
2+
name = "libtock_screen"
3+
version = "0.1.0"
4+
authors = ["Tock Project Developers <tock-dev@googlegroups.com>"]
5+
license = "Apache-2.0 OR MIT"
6+
edition = "2021"
7+
repository = "https://www.github.com/tock/libtock-rs"
8+
rust-version.workspace = true
9+
description = "libtock display driver"
10+
11+
[dependencies]
12+
libtock_platform = { path = "../../../platform" }
13+
14+
[dev-dependencies]
15+
libtock_unittest = { path = "../../../unittest" }

0 commit comments

Comments
 (0)