-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile
79 lines (63 loc) · 2.01 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
TARGET := thumbv7em-none-eabi
BOARD ?= stm32f407-discovery
RUSTCFLAGS := ${RUSTCFLAGS} -g --target $(TARGET) -C opt-level=3
CLIPPYFLAGS := \
-A unknown_lints \
-A char_lit_as_u8 \
-A inline_always \
-A identity_op \
-A doc_markdown \
-A empty_loop \
-W cast_possible_wrap \
-W cast_sign_loss \
-W float_arithmetic \
-W non_ascii_literal \
-W nonminimal_bool \
-W result_unwrap_used \
-W shadow_unrelated \
-W similar_names \
-W unseparated_literal_suffix \
-W used_underscore_binding \
-W wrong_pub_self_convention \
-W cast_possible_truncation \
DEVICE ?= /dev/ttyUSB0
.PHONY: all
all: build doc test
du -b kernel.bin
.PHONY: build
build: kernel.bin
kernel.bin: target/$(TARGET)/release/bkernel $(LD_SOURCES) # kernel.elf
$(OBJCOPY) -O binary $< $@
target/$(TARGET)/release/bkernel: $(SOURCES)
RUSTFLAGS="${RUSTFLAGS}" cargo build --target=$(TARGET) --release
.PHONY: doc
doc:
RUSTFLAGS="${RUSTFLAGS}" cargo doc --target=$(TARGET)
.PHONY: test
test:
RUSTFLAGS="${RUSTFLAGS}" cargo test -p bkernel -p stm32f4 -p breactor -p smalloc -p dev
.PHONY: clippy
clippy:
cargo clean
RUSTFLAGS="${RUSTFLAGS}" cargo clippy --target=thumbv7em-none-eabi -p stm32f4 -- ${CLIPPYFLAGS}
RUSTFLAGS="${RUSTFLAGS}" cargo clippy --target=thumbv7em-none-eabi -p breactor -- ${CLIPPYFLAGS}
RUSTFLAGS="${RUSTFLAGS}" cargo clippy --target=thumbv7em-none-eabi -p smalloc -- ${CLIPPYFLAGS}
RUSTFLAGS="${RUSTFLAGS}" cargo clippy --target=thumbv7em-none-eabi -p linkmem -- ${CLIPPYFLAGS}
RUSTFLAGS="${RUSTFLAGS}" cargo clippy --target=thumbv7em-none-eabi -p dev -- ${CLIPPYFLAGS}
RUSTFLAGS="${RUSTFLAGS}" cargo clippy --target=thumbv7em-none-eabi -p bkernel -- ${CLIPPYFLAGS}
.PHONY: openocd
openocd:
openocd -f ${BOARD}.cfg -s openocd/
.PHONY: flash
flash: kernel.bin
openocd -f ${BOARD}.cfg -s openocd/ -c 'flash_bkernel kernel.bin; exit'
.PHONY: reset
reset:
openocd -f ${BOARD}.cfg -s openocd/ -c 'reset; exit'
.PHONY: device_test
device_test:
expect tests/test.exp $(DEVICE)
.PHONY: clean
clean:
rm -rf *.elf *.bin lib
cargo clean