本帖最后由 fuqiye 于 2016-3-25 16:27 编辑
madplay在AM335X上移植
/*****************************************************************************************************************************/ begin 1、下载与解压 更改Makefile
#gedit Makefile
改为:CC=arm-linux-gnueabihf-gcc
AR=arm-linux-gnueabihf-ar rc
RANLIB=arm-linux-gnueabihf-ranlib
#make
#make install
b)编译libid3tag-0.15.1b
#cd ../libid3tag-0.15.1b/
#./configure --host=arm-linux-gnueabihf CC=arm-linux-gnueabihf-gcc --prefix=/home/voip_server_am335x_project/app/app/madplay/install CPPFLAGS=-I/home/voip_server_am335x_project/app/app/madplay/install/include LDFLAGS=-L/home/voip_server_am335x_project/app/app/madplay/install/lib
#make
编译时会发生如下错误:
/home/voip_server_am335x_project/app/app/madplay/lib-install/lib/libz.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
这时要重新编译上一个库zlib-1.1.4
回到上个zlib-1.1.4目录中
#cd ../zlib-1.1.4/
更改Makefile
#gedit Makefile
改为:CFLAGS=-O3 -DHAVE_UNISTD_H -DUSE_MMAP -fPIC (就是在最后添加-fPIC选项)
重新编译安装
#make clean ; make ; make install;
回到libid3tag-0.15.1b目录中,继续编译
#cd ../libid3tag-0.15.1b/
#make
#make install
c)编译libmad-0.15.1b
#cd ../libmad-0.15.1b/
#./configure --host=arm-linux-gnueabihf CC=arm-linux-gnueabihf-gcc --prefix=/home/voip_server_am335x_project/app/app/madplay/install CPPFLAGS=-I/home/voip_server_am335x_project/app/app/madplay/install/include LDFLAGS=-L/home/voip_server_am335x_project/app/app/madplay/install/lib
#make
编译时会发生如下错误:
arm-linux-gnueabihf-gcc: error: unrecognized command line option '-fforce-mem'
这个要在Makefile中去了-fforce-mem
#gedit Makefile
将:CFLAGS = -Wall -g -O -fforce-mem -fforce-addr -fthread-jumps -fcse-follow-jumps -fcse-skip-blocks -fexpensive-optimizations -fregmove -fschedule-insns2 -fstrength-reduce
改为:CFLAGS = -Wall -g -O -fforce-addr -fthread-jumps -fcse-follow-jumps -fcse-skip-blocks -fexpensive-optimizations -fregmove -fschedule-insns2 -fstrength-reduce
保存继续编译
#make
编译时又发生如下错误:
/tmp/ccrtagSq.s: Assembler messages:/tmp/ccrtagSq.s:2696: Error: selected processor does not support Thumb mode `rsc r0,r0,#0'
/tmp/ccrtagSq.s:2901: Error: selected processor does not support Thumb mode `rsc r8,r8,#0'
/tmp/ccrtagSq.s:3580: Error: selected processor does not support Thumb mode `rsc r0,r0,#0'
/tmp/ccrtagSq.s:3782: Error: selected processor does not support Thumb mode `rsc r8,r8,#0'
Makefile:383: recipe for target 'synth.lo' failed
make[2]: *** [synth.lo] Error 1
这个问题折磨了我好久T_T,到网上找了好久也没有结果。。。。
在我看./configure -h 时看到了--enable-speed optimize for speed over accuracy这一项,我就好奇加上了这一项,结果编译通过了,瞎猫碰见了死耗子,嘿嘿^_^ ……
这时我们要重新配置Makefile,在原来的后面加上 --enable-speed
#./configure --host=arm-linux-gnueabihf CC=arm-linux-gnueabihf-gcc --prefix=/home/voip_server_am335x_project/app/app/madplay/install CPPFLAGS=-I/home/voip_server_am335x_project/app/app/madplay/install/include LDFLAGS=-L/home/voip_server_am335x_project/app/app/madplay/install/lib --enable-speed
生成Makefile后同样去了-fforce-mem选项重新编译
#make
#make install
d)编译madplay-0.15.2b
#cd ../madplay-0.15.2b/
#./configure --host=arm-linux-gnueabihf CC=arm-linux-gnueabihf-gcc --prefix=/home/voip_server_am335x_project/app/app/madplay/install CPPFLAGS=-I/home/voip_server_am335x_project/app/app/madplay/install/include LDFLAGS=-L/home/voip_server_am335x_project/app/app/madplay/install/lib
#make
#make install
3、移植到目标板上
将install目录下bin中的madplay复制到目标板/usr/sbin/目录中
将install目录下lib中的libid3tag.so libid3tag.so.0 libid3tag.so.0.3.0 libmad.so libmad.so.0 libmad.so.0.2.1复制到目标板/usr/sbin/目录中 (复制时要注意链接文件,cp命令要加上-rfa)。
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
最后在播放测试时报错,如下:
audio: /dev/dsp: No such file or directory
这要重配置内核
<*>Device Drivers--->
<*>sound card support --->
<*>advanced linux soune architecture -->
<*>OSS Mixer API
<*>OSS PCM (digital audio) API
编译运行
此时播放测试又报错,如下:
ASoC: unmatched rate symmetry: 8000 - 44100
output: ioctl(SNDCTL_DSP_SPEED): Invalid argument
这要修改内核驱动代码
打开linux-3.18.24\sound\soc\davinci\davinci-mcasp.c文件
修改:#define DAVINCI_MCASP_RATES SNDRV_PCM_RATE_8000_192000
为:#define DAVINCI_MCASP_RATES SNDRV_PCM_RATE_44100
保存编译运行
此时可以播放MP3文件了^_^
|