blob: e05145ec4a5c16b76cf7a8ccff1b972d652b54ef [file] [log] [blame]
Andrew Geissler84ad7c52020-06-27 00:00:16 -05001#! /bin/bash
2
3# Call using:
4#../microblaze/sysroots/x86_64-oesdk-linux/usr/bin/microblaze-xilinx-elf/microblaze-xilinx-elf-gcc -print-multi-lib | mb-convert.sh
5
6# Then copy the output into the special microblaze-tc BSP
7
8mlib_to_feature() {
9 feature_base="microblaze"
10 feature_endian=" bigendian"
11 feature_barrel=""
12 feature_pattern=""
13 feature_multiply=""
14 feature_multiplyhigh=""
15 feature_sixtyfour=""
16 feature_math=""
17 while read feature ; do
18 case $feature in
19 le) feature_endian="";;
20 bs) feature_barrel=" barrel-shift";;
21 p) feature_pattern=" pattern-compare";;
22 m) if [ -z ${feature_multiplyhigh} ]; then feature_multiply=" multiply-low" ; fi ;;
23 mh) feature_multiply="" ; feature_multiplyhigh=" multiply-high";;
24 m64) feature_sixtyfour=" 64-bit";;
25 fpd) feature_math=" fpu-hard";;
26 *) echo "UNKNOWN $feature";;
27 esac
28 done
29 echo "${feature_base}${feature_sixtyfour}${feature_endian}${feature_barrel}${feature_pattern}${feature_multiply}${feature_multiplyhigh}${feature_math}"
30}
31
32sed -e 's,;, ,' |
33 while read mlib args ; do
34 if [ $mlib = '.' ]; then
35 echo '# Base configuration'
36 echo '# CFLAGS:'
37 echo 'DEFAULTTUNE = "microblaze"'
38 echo
39 echo 'AVAILTUNES += "microblaze"'
40 echo 'BASE_LIB_tune-microblaze = "lib"'
41 echo 'TUNE_FEATURES_tune-microblaze = "microblaze bigendian"'
42 echo 'PACKAGE_EXTRA_ARCHS_tune-microblaze = "${TUNE_PKGARCH}"'
43 continue
44 fi
45
46 cflags=$(echo $args | sed -e 's,@, -,g')
47 multilib="libmb$(echo $mlib | sed -e 's,/,,g')"
48 tune="microblaze$(echo $mlib | sed -e 's,m64,64,' -e 's,/,,g')"
49 features=$(echo $mlib | sed -e 's,/, ,g' | xargs -n 1 echo | mlib_to_feature)
50 echo
51 echo
52 echo "# $mlib"
53 echo "# CFLAGS:${cflags}"
54 echo "DEFAULTTUNE_virtclass-multilib-$multilib = \"$tune\""
55 echo
56 echo "AVAILTUNES += \"$tune\""
57 echo "BASE_LIB_tune-$tune = \"lib/$mlib\""
58 echo "TUNE_FEATURES_tune-$tune = \"${features}\""
59 echo "PACKAGE_EXTRA_ARCHS_tune-$tune = \"\${TUNE_PKGARCH}\""
60 done