Skip to content

Instantly share code, notes, and snippets.

@pabigot
Last active June 19, 2020 12:16
Show Gist options
  • Save pabigot/d63ddfa24a30e7a95e902fe986cbbd89 to your computer and use it in GitHub Desktop.
Save pabigot/d63ddfa24a30e7a95e902fe986cbbd89 to your computer and use it in GitHub Desktop.
const device comparisons zephyr issue
#!/bin/sh
CONST_REF=nordic/issue/22941a
SUBOBJ_REF=nordic/20200611a
BASE_REF=$(git merge-base ${CONST_REF} ${SUBOBJ_REF})
build () {
tag=$1 ; shift
ref=$1 ; shift
args="${@}"
id=$(echo ${tag}-${sample}-on-${board} | tr '[/:]' '[__]')
echo 1>&2 "building ${id} ${args:+with ${args}}"
(
git checkout ${ref}
west update
rm -rf build
west build -b ${board} ${sample} ${args}
) > ${id}.buildlog 2>&1
rm -f ${tag}.elf
cp -p build/zephyr/zephyr.elf ${tag}.elf
# Zephyr build memory summary usage summary comes from
# --print-memory-usage used in the final link. It does not match
# anything from size(1), nor does it match the totals from the
# rom/ram report targets. It's not clear that it can be
# reconstructed after the link completes, so extract the data from
# the build log.
cat ${id}.buildlog \
| sed -n -e '/Memory region/,+3p' \
> ${tag}.memuse
}
get_summary () {
tag=$1 ; shift
( echo ${tag} ;
awk '/:/ {print $1, $2}' ${tag}.memuse
) | paste -s
}
(cat << EOText
$(date)
$(git describe --abbrev=24 ${BASE_REF}) base
$(git describe --abbrev=24 ${CONST_REF}) const ref
#22508 updated
https://github.com/pabigot/zephyr/commits/nordic/issue/22941a
$(git describe --abbrev=24 ${SUBOBJ_REF}) sub-object
#26127
https://github.com/pabigot/zephyr/commits/nordic/20200611a
EOText
) > eval.log
(cat <<EOText
samples/hello_world nrf52840dk_nrf52840
samples/hello_world frdm_k64f
samples/basic/button frdm_k64f
samples/boards/reel_board/mesh_badge reel_board
samples/sensor/fxos8700 frdm_k64f
EOText
) | sed -e '/^#/d' \
| while read sample board args; do
build base ${BASE_REF} ${args}
build const ${CONST_REF} ${args}
build subobj ${SUBOBJ_REF} ${args}
# Pull the memory regions and the variant
set - $(get_summary base)
col1=$2
base_1=$3
col2=$4
base_2=$5
set - $(get_summary const)
const_1=$3
const_2=$5
set - $(get_summary subobj)
subobj_1=$3
subobj_2=$5
( echo "${sample} on ${board}:"
for tag in base const subobj ; do
( echo
echo ${tag} ;
awk '/:/ {print $1, $2}' ${tag}.memuse
) | paste -s
done
echo " const - base: ${col1} $((const_1 - base_1)) ; ${col2} $((const_2 - base_2))"
echo " subobj - base: ${col1} $((subobj_1 - base_1)) ; ${col2} $((subobj_2 - base_2))"
) | tee -a eval.log
done
Fri 19 Jun 2020 07:11:16 AM CDT
zephyr-v2.3.0-309-g999c59c1ec627a6fff7db23b base
zephyr-v2.3.0-320-g061a86229ad2ca320d5c8ce5 const ref
#22508 updated
https://github.com/pabigot/zephyr/commits/nordic/issue/22941a
zephyr-v2.3.0-322-g046ceb3a1405336827bc7200 sub-object
#26127
https://github.com/pabigot/zephyr/commits/nordic/20200611a
samples/hello_world on nrf52840dk_nrf52840:
base FLASH: 13240 SRAM: 5200 IDT_LIST: 56
const FLASH: 13288 SRAM: 5112 IDT_LIST: 56
subobj FLASH: 13368 SRAM: 5152 IDT_LIST: 56
const - base: FLASH: 48 ; SRAM: -88
subobj - base: FLASH: 128 ; SRAM: -48
samples/hello_world on frdm_k64f:
base FLASH: 12308 SRAM: 4080 IDT_LIST: 88
const FLASH: 12372 SRAM: 3864 IDT_LIST: 88
subobj FLASH: 12464 SRAM: 3968 IDT_LIST: 88
const - base: FLASH: 64 ; SRAM: -216
subobj - base: FLASH: 156 ; SRAM: -112
samples/basic/button on frdm_k64f:
base FLASH: 14332 SRAM: 4088 IDT_LIST: 88
const FLASH: 14396 SRAM: 3880 IDT_LIST: 88
subobj FLASH: 14508 SRAM: 3976 IDT_LIST: 88
const - base: FLASH: 64 ; SRAM: -208
subobj - base: FLASH: 176 ; SRAM: -112
samples/boards/reel_board/mesh_badge on reel_board:
base FLASH: 253716 SRAM: 59397 IDT_LIST: 168
const FLASH: 253780 SRAM: 59173 IDT_LIST: 168
subobj FLASH: 254188 SRAM: 59269 IDT_LIST: 168
const - base: FLASH: 64 ; SRAM: -224
subobj - base: FLASH: 472 ; SRAM: -128
samples/sensor/fxos8700 on frdm_k64f:
base FLASH: 33656 SRAM: 7696 IDT_LIST: 104
const FLASH: 33732 SRAM: 7440 IDT_LIST: 104
subobj FLASH: 33908 SRAM: 7560 IDT_LIST: 104
const - base: FLASH: 76 ; SRAM: -256
subobj - base: FLASH: 252 ; SRAM: -136
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment