cd linux-socfpga
git checkout -b de1soc_audio origin/socfpga-3.17_audio
注:需要安装git,教育网下载速度可能会快些。
编译硬件工程 在linux上安装quartus可以参考.USB Blaster II on LinuxInstalling DS-5 on "Unsupported" Linux Distros
也可直接在windos 下编译,操作步骤一致。打开硬件工程后按如下操作
1.add the 'ip/i2s' Path to the ip library in QsysOpen the Hardware project in de1soc_media
[mw_shl_code=bash,false]Open Qsys-->Tools-->IP Search Path-->Add,add the 'xxxx/ip/i2s' path[/code]
2.Compile the Qsys
[mw_shl_code=bash,false]Open the soc_system.qsys,Click 'Generate HDL' [/code]
3.Compile project
[mw_shl_code=bash,false]Click the 'Start Compilation'[/code]
4.Convert programming files,in shell run the command
[mw_shl_code=bash,false]quartus_cpf -c DE1_SOC_Linux_Audio.sof soc_system.rbf[/code]
need the "quartus_cpf" path in PATH environment
生成 uboot.img 和 PreloaderWithHeader.img
1.run altera embedded command shell
[mw_shl_code=bash,false]~/altera/14.1/embedded/embedded_command_shell.sh[/code]
2.Generate Bsp and Uboot
[mw_shl_code=bash,false]bsp-editor&[/code]
According to the steps Generating and Compiling the Preloader
3.make bsp and uboot
cd to 'project path'/software/spl_bsp/
[mw_shl_code=bash,false]make -j4[/code]
cd to'project path'/software/spl_bsp/uboot-socfpga/
[mw_shl_code=bash,false]make[/code]
4.generate preloader_with_header.img
copy the u-boot-spl.bin form 'software/spl_bsp/uboot-socfpga/spl' to 'software/spl_bsp'
cd to 'project path'/software/spl_bsp/
[mw_shl_code=bash,false]mkpimage -o preloader_with_header.img u-boot-spl.bin -hv 0[/code]
Image
path
Description
preloader_with_header.img
software/spl_bsp
preloader
u-boot.img
software/spl_bsp/uboot-socfpga
u-boot
更新 SD卡的 uboot
Write Terasic de1soc_ubuntu_1604.img to SD Cardon Linux PC,Check which disk is your SD card.Change the sdX according to your situation.
先将上述的官方镜像写到SD卡,然后再将uboot更新,更新步骤如下:
[mw_shl_code=bash,false]sudo dd if=preloader_with_header.img of=/dev/sdX3 bs=64k seek=0
sudo dd if=u-boot.img of=/dev/sdX3 bs=64k seek=4
sudo sync[/code]
注:dd貌似在win下支持的不太好,建议该步骤在linux下操作
将编译环境添加到环境变量
about Path environment,Write the following to env.sh file,change paths for your situation.
#!/bin/bash
export ARCH=arm
export CROSS_COMPILE=/home/tank/app/gcc-linaro-arm-linux-gnueabihf-4.9-xxxxxxxx/bin/arm-linux-gnueabihf-export LOADADDR=0x8000
export PATH=$PATH:/home/tank/app/gcc-linaro-arm-linux-gnueabihf-4.9-xxxxxxxx/bin
编译zImage 和 Device Tree [mw_shl_code=bash,false]source env.sh[/code]
cd to linux-socfpga
[mw_shl_code=bash,false]cp Linux_config .config
make zImage
make socfpga_audio.dtb[/code]
将 rbf zImage dtb拷贝到SD卡的FAT分区
Image
rename
Description
zImage
zImage
socfpga_audio.dtb
socfpga.dtb
soc_system.rbf
soc_system.rbf
在 DE1_SOC 上使用软件 alsamixer 选择音频的 Line out on DE1_SOC run alsamixer
use "M" to change the Output Line to DE1_SOC HIFI ,then
[mw_shl_code=bash,false]aplay jouHisaishi.wav[/code]