#!/bin/sh # # Copyright (c) 2004, 2008 Don Stewart - http://www.cse.unsw.edu.au/~dons # BSD3-style license. # OBJ=$* ARR=`mktemp -t hsincXXXXXXXXX` # get new file name NEW=`echo $1 | sed 's/\..*$//'` # translate a.out into an array # maybe won't work if we change the endianness? hexdump -v -e "16/1 \"%4u,\"" -e '"\n"' $OBJ | sed ' # declare array type 1i\ #include \ #include \ \ uint8_t code[] = { # clean up last line # $s/[^0-9ul].*$// # end array, and add glue $a\ }; ' >> $ARR mv $ARR $NEW.c