-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile
77 lines (62 loc) · 2.08 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
YAML = lpc55.yaml
SVD = lpc55.svd.patched
PACK_VERSION = 13.0.0
# Path to `svd`/`svdtools`
SVDTOOLS ?= svd
# this make target runs under svdtools, ensure it works at all times.
check: patch generate
cargo check
build: setup patch generate
cargo build
doc: setup patch generate
cargo doc
doc-open: setup patch generate
cargo doc --open
setup: update-venv fetch-svd
cargo install svd2rust --version 0.20.0
cargo install form
patch:
$(SVDTOOLS) patch $(YAML)
sed -i '/alternateGroup/d' $(SVD)
# Generates PAC source code from (patched) SVD
generate:
rm -rf src
mkdir src
svd2rust -i ./$(SVD)
form -i lib.rs -o src/ && rm lib.rs
cargo fmt
show-latest-pack:
@echo $(shell wget -O - -qq https://mcuxpresso.nxp.com/cmsis_pack/repo/NXP.pidx|grep LPC55S69|python -c'import sys; print(sys.stdin.read().rsplit("version=\"", 1)[1].split("\"", 1)[0])')
PACK := NXP.LPC55S69_DFP.$(PACK_VERSION).pack
fetch-svd:
wget -qqO- https://mcuxpresso.nxp.com/cmsis_pack/repo/$(PACK) | bsdtar -xf- LPC55S69_cm33_core0.xml
mv LPC55S69_cm33_core0.xml svd/pack-$(PACK_VERSION)-LPC55S69_cm33_core0.xml
ln -sf svd/pack-$(PACK_VERSION)-LPC55S69_cm33_core0.xml lpc55.svd
# External documentation
fetch-docs:
mkdir -p ref
curl -s https://www.nxp.com/docs/en/data-sheet/LPC55S6x.pdf \
-o ref/datasheet-lpc55s6x.pdf
curl -s https://www.nxp.com/docs/en/errata/ES_LPC55S6x.pdf \
-o ref/errata-lpc55s6x.pdf
curl -sk https://static.docs.arm.com/100235/0004/arm_cortex_m33_dgug_100235_0004_00_en.pdf \
-o ref/genericuserguide-cortexm33.pdf
echo "For the LPC55S6x User manual (UM11126), login is needed"
# curl -s https://www.nxp.com/docs/en/user-guide/UM11126.pdf \
# -o ref/usermanual-lpc55s6x.pdf
# `pip install nxp-dlagent` for the following step
nxp-dl UM11126 && mv UM11126.pdf ref/
# Maintenance
VERSION := $(shell grep version Cargo.toml|head -1|cut -d' ' -f 3|tr -d '"')
tag:
git tag -a $(VERSION) -m"v$(VERSION)"
# For CI
rustup:
rustup target add thumbv8m.main-none-eabi
version:
echo $(VERSION)
update-venv: venv
venv/bin/pip install -U pip
venv/bin/pip install -r requirements.txt
venv:
python3 -m venv venv