计费控制单元软硬件技术参数要求中,有大概指明所用到的GCC交叉编译器,但是仍不太明确。要想让TCU程序正常运行,务必弄清楚TCU程序运行的软件环境。
最近分析了两款TCU系统,已探究清楚TCU程序所用到的GCC交叉编译器及其所用到的GLIB库版本。现予以详细说明,并提供该GCC交叉编译器(预编译版本)的下载链接地址。
使用strings指令获取GCC交叉编译器版本
/mnt/nandflash/app# strings -a tcu_main | grep -i gcc
libgcc_s.so.1
GCC_3.5
GCC: (Sourcery CodeBench Lite 2014.05-29) 4.8.3 20140320 (prerelease)
/mnt/nandflash/app# strings -a /usr/lib/libtcu.so | grep -i gcc
libgcc_s.so.1
GCC_3.5
GCC: (Sourcery CodeBench Lite 2014.05-29) 4.8.3 20140320 (prerelease)
/opt/am335x-cross-compile-4.8.3-sdk/arm-2014.05/lib/gcc/arm-none-linux-gnueabi/4.8.3/include
使用strings指令获取使用的GLIB库版本
/mnt/nandflash/app# strings -a tcu_main | grep -i GLIB
GLIBC_2.4
GLIBCXX_3.4.9
GLIBCXX_3.4.11
GLIBCXX_3.4
TCU GCC交叉编译器
从上面可看到,TCU所用的GCC交叉编译器为arm-none-linux-gnueabi 4.8.3。
该交叉编译器下载链接:
安装后,该交叉编译器版本信息如下:
dev@ubuntu:/opt/am335x-sdk/toolschain/arm-2014.05/bin$
dev@ubuntu:/opt/am335x-sdk/toolschain/arm-2014.05/bin$ ./arm-none-linux-gnueabi-gcc -v
Using built-in specs.
COLLECT_GCC=./arm-none-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/opt/am335x-sdk/toolschain/arm-2014.05/bin/../libexec/gcc/arm-none-linux-gnueabi/4.8.3/lto-wrapper
Target: arm-none-linux-gnueabi
Configured with: /scratch/maciej/arm-linux-2014.05-rel/src/gcc-4.8-2014.05/configure –build=i686-pc-linux-gnu –host=i686-pc-linux-gnu –target=arm-none-linux-gnueabi –enable-threads –disable-libmudflap –disable-libssp –disable-libstdcxx-pch –enable-extra-sgxxlite-multilibs –with-arch=armv5te –with-gnu-as –with-gnu-ld –with-specs=’%{save-temps: -fverbose-asm} %{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables} -D__CS_SOURCERYGXX_MAJ__=2014 -D__CS_SOURCERYGXX_MIN__=5 -D__CS_SOURCERYGXX_REV__=29′ –enable-languages=c,c++ –enable-shared –enable-lto –enable-symvers=gnu –enable-__cxa_atexit –with-pkgversion=’Sourcery CodeBench Lite 2014.05-29′ –with-bugurl=https://sourcery.mentor.com/GNUToolchain/ –disable-nls –prefix=/opt/codesourcery –with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc –with-build-sysroot=/scratch/maciej/arm-linux-2014.05-rel/install/opt/codesourcery/arm-none-linux-gnueabi/libc –with-gmp=/scratch/maciej/arm-linux-2014.05-rel/obj/pkg-2014.05-29-arm-none-linux-gnueabi/arm-2014.05-29-arm-none-linux-gnueabi.extras/host-libs-i686-pc-linux-gnu/usr –with-mpfr=/scratch/maciej/arm-linux-2014.05-rel/obj/pkg-2014.05-29-arm-none-linux-gnueabi/arm-2014.05-29-arm-none-linux-gnueabi.extras/host-libs-i686-pc-linux-gnu/usr –with-mpc=/scratch/maciej/arm-linux-2014.05-rel/obj/pkg-2014.05-29-arm-none-linux-gnueabi/arm-2014.05-29-arm-none-linux-gnueabi.extras/host-libs-i686-pc-linux-gnu/usr –with-isl=/scratch/maciej/arm-linux-2014.05-rel/obj/pkg-2014.05-29-arm-none-linux-gnueabi/arm-2014.05-29-arm-none-linux-gnueabi.extras/host-libs-i686-pc-linux-gnu/usr –with-cloog=/scratch/maciej/arm-linux-2014.05-rel/obj/pkg-2014.05-29-arm-none-linux-gnueabi/arm-2014.05-29-arm-none-linux-gnueabi.extras/host-libs-i686-pc-linux-gnu/usr –disable-libgomp –disable-libitm –enable-libatomic –disable-libssp –enable-poison-system-directories –with-build-time-tools=/scratch/maciej/arm-linux-2014.05-rel/install/opt/codesourcery/arm-none-linux-gnueabi/bin –with-build-time-tools=/scratch/maciej/arm-linux-2014.05-rel/install/opt/codesourcery/arm-none-linux-gnueabi/bin SED=sed
Thread model: posix
gcc version 4.8.3 20140320 (prerelease) (Sourcery CodeBench Lite 2014.05-29)
编写测试程序验证交叉编译器
写个简单测试程序gcc_test.c(只是简单的打印一条信息),验证下载的交叉编译器是OK的。
—————— gcc_test.exe 没有strip ——————-
[root@ ~]# strings -a gcc_test.exe | grep -i gcc
libgcc_s.so.1
GCC_3.5
test tcu gcc !
GCC: (Sourcery CodeBench Lite 2014.05-29) 4.8.3 20140320 (prerelease)
gcc_test.c
__aeabi_unwind_cpp_pr0@@GCC_3.5
__aeabi_unwind_cpp_pr1@@GCC_3.5
[root@ ~]#
[root@ ~]#
[root@ ~]#
[root@ ~]# strings -a gcc_test.exe | grep -i GLIB
GLIBC_2.4
/scratch/maciej/arm-linux-2014.05-rel/obj/glibc-2014.05-29-arm-none-linux-gnueabi-i686-pc-linux-gnu/default/csu/abi-note.o
/scratch/maciej/arm-linux-2014.05-rel/obj/glibc-2014.05-29-arm-none-linux-gnueabi-i686-pc-linux-gnu/default/csu/start.o
puts@@GLIBC_2.4
__libc_start_main@@GLIBC_2.4
abort@@GLIBC_2.4
—————— gcc_test.exe strip 之后 ——————-
[root@ ~]# strings -a gcc_test.exe | grep -i gcc
libgcc_s.so.1
GCC_3.5
test tcu gcc !
GCC: (Sourcery CodeBench Lite 2014.05-29) 4.8.3 20140320 (prerelease)
[root@ ~]#
[root@ ~]#
[root@ ~]#
[root@ ~]# strings -a gcc_test.exe | grep -i GLIB
GLIBC_2.4
[root@ ~]#
[root@ ~]#
该测试程序在TCU上可以正常运行。
经上所述,证明下载的交叉编译器是对的。