diff --git a/tools/prettydump b/tools/prettydump new file mode 100755 index 00000000..21d8febf --- /dev/null +++ b/tools/prettydump @@ -0,0 +1,63 @@ +#!/bin/bash + +# This script prettifies the SCC's memory dump +# Its aim is to be nicer to use then "sccDump" + +# If you have questions, ask Jacek. + +# just set the following var's values to +# $1, $2, $3 if you want to define them +# from the command line on every launch + +CORENUM=0 +MEMCTR=0x00 # or set a fixed vaue +STARTADDR=0x100040 # or set a fixed value here +NUM_BYTES=0x1000 # or set a fixed value here. + +if [ $# == 1 ]; then + CORENUM=$1 +elif [ $# == 2 ]; then + CORENUM=$1 + NUM_BYTES=$2 +else + echo "Usage: prettydump [core_num byte_count]" + exit -1; +fi + +if [ $CORENUM -ge 0 ] && [ $CORENUM -lt 6 ]; then + MEMCTR=0x00 + STARTADDR=$((0x29000000*$CORENUM + $STARTADDR)); +elif [ $CORENUM -ge 12 ] && [ $CORENUM -lt 18 ]; then + MEMCTR=0x00 + STARTADDR=$((0x29000000*($CORENUM-6) + $STARTADDR)); +elif [ $CORENUM -ge 24 ] && [ $CORENUM -lt 30 ]; then + MEMCTR=0x20 + STARTADDR=$((0x29000000*($CORENUM-24) + $STARTADDR)); +elif [ $CORENUM -ge 36 ] && [ $CORENUM -lt 42 ]; then + MEMCTR=0x20 + STARTADDR=$((0x29000000*($CORENUM-30) + $STARTADDR)); +elif [ $CORENUM -ge 6 ] && [ $CORENUM -lt 12 ]; then + MEMCTR=0x05 + STARTADDR=$((0x29000000*($CORENUM-6) + $STARTADDR)); +elif [ $CORENUM -ge 18 ] && [ $CORENUM -lt 24 ]; then + MEMCTR=0x05 + STARTADDR=$((0x29000000*($CORENUM-12) + $STARTADDR)); +elif [ $CORENUM -ge 30 ] && [ $CORENUM -lt 36 ]; then + MEMCTR=0x25 + STARTADDR=$((0x29000000*($CORENUM-30) + $STARTADDR)); +elif [ $CORENUM -ge 42 ] && [ $CORENUM -lt 48 ]; then + MEMCTR=0x25 + STARTADDR=$((0x29000000*($CORENUM-36) + $STARTADDR)); +else + echo "ERROR: core number out of range!" + exit -1; +fi + +# Read dump +sccDump -d $MEMCTR $STARTADDR $NUM_BYTES | \ +# Cut the first 14 lines +sed '1,14d' | \ +# Parse the hex codes in the middle column of the output and print +awk '//{for (i=3; i < 11; i++) printf("%c", strtonum("0x"$i));}' | \ +less -N +