1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-24 00:26:13 +01:00
CommandStation-EX/objdump.sh

14 lines
543 B
Bash
Raw Normal View History

2020-07-16 13:54:47 +02:00
#!/bin/bash
# Find avr-objdump that matches the installed arduino binary
ARDUINOBIN=$(ls -l $(type -p arduino)| awk '{print $NF ; exit 0}')
PATH=$(dirname "$ARDUINOBIN")/hardware/tools/avr/bin:$PATH
2020-09-26 22:28:29 +02:00
LASTBUILD=$(ls -tr /tmp/arduino_build_*/*.ino.elf | tail -1)
avr-objdump --private=mem-usage "$LASTBUILD"
2020-07-16 13:54:47 +02:00
for segment in .text .data .bss ; do
echo '++++++++++++++++++++++++++++++++++'
2020-09-26 22:28:29 +02:00
avr-objdump -x -C "$LASTBUILD" | awk '$2 == "'$segment'" && $3 != 0 {print $3,$2} ; $4 == "'$segment'" && $5 != 0 { print $5,$6}' | sort -r
2020-07-16 13:54:47 +02:00
done