blob: 263bfbf54cbfd0dbdc21761281ce7299982abdda [file]
# By default, let's print out some help
.PHONY: usage
usage:
@echo "$$(tput bold)Welcome to libtock-rs!$$(tput sgr0)"
@echo
@echo "First things first, if you haven't yet, check out Tocks's doc/Getting_Started."
@echo "After that read the README from libtock-rs"
@echo "You'll need to install a few requirements before we get going."
@echo
@echo "The next step is to choose a board to build Tock for. Mainline"
@echo "libtock-rs currently includes support for the following platforms:"
@echo " - hail"
@echo " - nrf52840"
@echo " - opentitan"
@echo " - hifive1"
@echo " - nrf52"
@echo
@echo "Run 'make setup' to setup Rust to build libtock-rs."
@echo "Run 'make <board>' to build libtock-rs for that board"
@echo " Set the FEATURES flag to enable features"
@echo "Run 'make test' to test any local changes you have made"
check_defined = \
$(strip $(foreach 1,$1, \
$(call __check_defined,$1,$(strip $(value 2)))))
__check_defined = \
$(if $(value $1),, \
$(error Undefined $1$(if $2, $2)))
ifdef FEATURES
features=--features=$(FEATURES)
endif
.PHONY: setup
setup:
rustup target add thumbv7em-none-eabi
rustup target add riscv32imc-unknown-none-elf
rustup component add rustfmt
rustup component add clippy
cargo install elf2tab --version 0.4.0
.PHONY: examples
examples:
PLATFORM=nrf52 cargo build --release --target=thumbv7em-none-eabi --examples
PLATFORM=nrf52 cargo build --release --target=thumbv7em-none-eabi --examples --features=alloc
PLATFORM=opentitan cargo build --release --target=riscv32imc-unknown-none-elf --examples
.PHONY: test
test:
PLATFORM=nrf52 cargo fmt --all -- --check
PLATFORM=nrf52 cargo clippy --workspace --all-targets
PLATFORM=nrf52 cargo test --workspace
make examples
.PHONY: hail
hail:
PLATFORM=hail cargo build --release --target=thumbv7em-none-eabi --examples $(features)
.PHONY: nrf52840
nrf52840:
PLATFORM=nrf52840 cargo build --release --target=thumbv7em-none-eabi --examples $(features)
.PHONY: opentitan
opentitan:
PLATFORM=opentitan cargo build --release --target=riscv32imc-unknown-none-elf --examples $(features)
.PHONY: hifive1
hifive1:
PLATFORM=hifive1 cargo build --release --target=riscv32imac-unknown-none-elf --examples $(features)
.PHONY: nrf52
nrf52:
PLATFORM=nrf52 cargo build --release --target=thumbv7em-none-eabi --examples $(features)
.PHONY: clean
clean:
rm -rf target
rm Cargo.lock