jep106: add SPDX tag and JEDEC copyright
[fw/openocd] / src / helper / bin2char.sh
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0-or-later
3
4 [ $# != 0 ] && {
5     echo "Usage: $0"
6     echo
7     echo "Read binary data from standard input and write it as a comma separated"
8     echo "list of hexadecimal byte values to standard output. The output is usable"
9     echo "as a C array initializer. It is terminated with a comma so it can be"
10     echo "continued e.g. for zero termination."
11     exit 1
12 }
13
14 echo "/* Autogenerated with $0 */"
15 od -v -A n -t x1 | sed 's/ *\(..\) */0x\1,/g'