Files
fail/src/experiments/ecos_kernel_test/experimentInfo.hpp.sh

45 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
set -e
TARGET=experimentInfo.hpp
[ ! -e "$1" ] && echo "usage: $0 ecos_binary.elf" && exit 1
function addrof() { nm -C $1 | (fgrep "$2" || echo 99999999) | awk '{print $1}'; }
cat >$TARGET <<EOF
#pragma once
// autogenerated, don't edit!
EOF
function alldefs() {
cat <<EOF
// user-specified start-function address:
// nm -C $(basename $1)|fgrep cyg_start
#define ECOS_FUNC_ENTRY 0x`addrof $1 cyg_start`
// cyg_test_exit address
#define ECOS_FUNC_FINISH 0x`addrof $1 cyg_test_exit`
// cyg_test_output address
#define ECOS_FUNC_TEST_OUTPUT 0x`addrof $1 cyg_test_output`
// the variable that's increased if ECC corrects an error:
#define ECC_ERROR_CORRECTED 0x`addrof $1 errors_corrected`
// the function that is called when an uncorrectable error occurs
#define ECC_FUNC_PANIC 0x`addrof $1 ecc_panic`
// text begin:
// nm -C $(basename $1)|fgrep _stext
#define ECOS_TEXT_START 0x`addrof $1 _stext`
// text end:
// nm -C $(basename $1)|fgrep _etext
#define ECOS_TEXT_END 0x`addrof $1 _etext`
EOF
}
alldefs $1 >>$TARGET
cat >>$TARGET <<EOF
EOF