mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
CI: print elf segment size info for example sketches
This commit is contained in:
parent
5cec3345ad
commit
324c41fd7f
@ -26,15 +26,12 @@ script:
|
|||||||
- ln -s $TRAVIS_BUILD_DIR esp8266
|
- ln -s $TRAVIS_BUILD_DIR esp8266
|
||||||
- cd esp8266/tools
|
- cd esp8266/tools
|
||||||
- python get.py
|
- python get.py
|
||||||
- /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16
|
|
||||||
- sleep 3
|
|
||||||
- export DISPLAY=:1.0
|
|
||||||
- export PATH="$HOME/arduino_ide:$PATH"
|
- export PATH="$HOME/arduino_ide:$PATH"
|
||||||
- which arduino
|
- which arduino
|
||||||
- cd $TRAVIS_BUILD_DIR
|
- cd $TRAVIS_BUILD_DIR
|
||||||
- source tests/common.sh
|
- source tests/common.sh
|
||||||
- install_libraries
|
- install_libraries
|
||||||
- build_sketches $HOME/arduino_ide $TRAVIS_BUILD_DIR "python tools/build.py -l $HOME/Arduino/libraries -b generic -v"
|
- build_sketches $HOME/arduino_ide $TRAVIS_BUILD_DIR "-l $HOME/Arduino/libraries"
|
||||||
|
|
||||||
after_success:
|
after_success:
|
||||||
- pushd $TRAVIS_BUILD_DIR/tests/host
|
- pushd $TRAVIS_BUILD_DIR/tests/host
|
||||||
|
@ -1,13 +1,49 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
function print_size_info()
|
||||||
|
{
|
||||||
|
elf_file=$1
|
||||||
|
|
||||||
|
if [ -z "$elf_file" ]; then
|
||||||
|
printf "sketch data rodata bss text irom0.text dram flash\n"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
elf_name=$(basename $elf_file)
|
||||||
|
sketch_name="${elf_name%.*}"
|
||||||
|
# echo $sketch_name
|
||||||
|
declare -A segments
|
||||||
|
while read -a tokens; do
|
||||||
|
seg=${tokens[0]}
|
||||||
|
seg=${seg//./}
|
||||||
|
size=${tokens[1]}
|
||||||
|
addr=${tokens[2]}
|
||||||
|
if [ "$addr" -eq "$addr" -a "$addr" -ne "0" ] 2>/dev/null; then
|
||||||
|
segments[$seg]=$size
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
done < <(xtensa-lx106-elf-size --format=sysv $elf_file)
|
||||||
|
|
||||||
|
total_ram=$((${segments[data]} + ${segments[rodata]} + ${segments[bss]}))
|
||||||
|
total_flash=$((${segments[data]} + ${segments[rodata]} + ${segments[text]} + ${segments[irom0text]}))
|
||||||
|
|
||||||
|
printf "%-28s %-8d %-8d %-8d %-8d %-8d %-8d %-8d\n" $sketch_name ${segments[data]} ${segments[rodata]} ${segments[bss]} ${segments[text]} ${segments[irom0text]} $total_ram $total_flash
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
function build_sketches()
|
function build_sketches()
|
||||||
{
|
{
|
||||||
set +e
|
set +e
|
||||||
local arduino=$1
|
local arduino=$1
|
||||||
local srcpath=$2
|
local srcpath=$2
|
||||||
local build_cmd=$3
|
local build_arg=$3
|
||||||
echo $build_cmd
|
local build_dir=build.tmp
|
||||||
|
mkdir -p $build_dir
|
||||||
|
rm -rf $build_dir/*
|
||||||
|
local build_cmd="python tools/build.py -b generic -v -k -p $PWD/$build_dir $build_arg "
|
||||||
local sketches=$(find $srcpath -name *.ino)
|
local sketches=$(find $srcpath -name *.ino)
|
||||||
|
print_size_info >size.log
|
||||||
export ARDUINO_IDE_PATH=$arduino
|
export ARDUINO_IDE_PATH=$arduino
|
||||||
for sketch in $sketches; do
|
for sketch in $sketches; do
|
||||||
local sketchdir=$(dirname $sketch)
|
local sketchdir=$(dirname $sketch)
|
||||||
@ -33,8 +69,12 @@ function build_sketches()
|
|||||||
return $result
|
return $result
|
||||||
fi
|
fi
|
||||||
rm build.log
|
rm build.log
|
||||||
|
print_size_info $build_dir/*.elf >>size.log
|
||||||
done
|
done
|
||||||
set -e
|
set -e
|
||||||
|
echo -e "\n ------------ Size report ------------ \n"
|
||||||
|
cat size.log
|
||||||
|
echo -e "\n ------------------------------------- \n"
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_libraries()
|
function install_libraries()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user