-
Notifications
You must be signed in to change notification settings - Fork 85
/
analyze-bloat.sh
executable file
·69 lines (60 loc) · 1.56 KB
/
analyze-bloat.sh
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
#!/bin/bash
declare -a Crates=(
"xous-kernel"
"loader"
"gam"
"status"
"shellchat"
"ime-frontend"
"ime-plugin-shell"
"graphics-server"
"xous-ticktimer"
"xous-log"
"com"
"xous-names"
"keyboard"
"trng"
"llio"
"xous-susres"
"codec"
"sha2"
"engine-25519"
"spinor"
"root-keys"
"jtag"
"net"
"dns"
"pddb"
"modals"
"usb-device-xous"
"vault"
"ball"
"repl"
)
if [ -e "$HOME/.cargo/env" ]; then
. "$HOME/.cargo/env"
fi
# Now using xpack tools installed in standard path
#RISCV_TOOLS=/opt/riscv64-unknown-elf
#export PATH=$RISCV_TOOLS/bin:$PATH
env | sort > env.txt
#cargo clean
mkdir -p reports
mkdir -p reports/old
# move just the files, not the directory
find reports/ -maxdepth 1 -type f -name '[!.]*' -exec mv {} reports/old/ \;
echo "===== TURNING OFF STRIP ====="
sed -i 's/strip = true/strip = false/g' Cargo.toml
echo "===== STARTING BUILD at $(date) ====="
cargo xtask app-image ball repl vault
echo "===== ANALYZING at $(date) ====="
for val in ${Crates[@]}; do
# dump the header summary
riscv-none-elf-objdump -h target/riscv32imac-unknown-xous-elf/release/$val > reports/$val.txt
# dump the sorted list of objects
riscv-none-elf-nm -r --size-sort --print-size target/riscv32imac-unknown-xous-elf/release/$val | rustfilt >> reports/$val.txt
# dump the disassembly
riscv-none-elf-objdump -S -d target/riscv32imac-unknown-xous-elf/release/$val | rustfilt > reports/$val.list
done
echo "===== REVERTING STRIP ====="
git checkout Cargo.toml