FSBLのビルド
ここでは、FSBLのビルド方法についてまとめた。基本的には、ザイリンクスのサイトに従って行う。 参考サイト:No.1
目次
前提条件
- ザイリンクスSDK(v2018.2)がインストールされていること。
- 使用するOSがUbuntu16.04 LTS であること。
- vivadoでhdfファイルとbitファイルを生成していること。
・ここでは、hdfファイル名をTopZybo.hdf、bitファイル名をTopZybo.bitとする。 - フォルダには、TopZybo.bit TopZybo.hdfのみが入っていること。
例)
tanuki@tanuki-VirtualBox:~/work/GenBootbin/ZYBOv001$ ls TopZybo.bit TopZybo.hdf
FSBLのビルド
FSBLのビルドは、hsiコマンドを使用して実行する。ちなみに、hsiは Hardware Software Interfaceのことらしい。
手順
FSBLのビルド手順について記載する。
gmakeのシンボリックリンク作成
- ビルドは、
gmakeコマンド
を必要とする。
そのため、シンボリックリンクを作成する。 参考サイト:No.2-3
sudo ln -s /usr/bin/make/usr/bin/gmake
※これを行わないと、エラーが発生する。
FSBLビルド用フォルダの作成
- FSBLビルド用フォルダを作成する。
mkdir zynq_fsbl
XSDKの起動
- 次のコマンドを入力し、、XSDKの環境変数を設定する。
source /opt/Xilinx/SDK/2018.2/settings64.sh
hsi
と入力し、XSDKを起動する。起動すると、次のログが表示される。
****** hsi v2018.2 (64-bit) **** SW Build 2258646 on Thu Jun 14 20:02:38 MDT 2018 ** Copyright 1986-2018 Xilinx, Inc. All Rights Reserved. hsi%
hdfファイルを開く
- hdfファイルをセットする。
set hwdsgn [open_hw_design TopZybo.hdf]
FSBLのビルド
次のコマンドを入力し、fsblのビルドを行う。
generate_app -hw $hwdsgn -os standalone -proc ps7_cortexa9_0 -app zynq_fsbl -compile -sw zynq -dir zynq_fsbl
ビルド中に表示されるログを以下に示す。
WARNING : No interface that uses file system is available Running Make include in ps7_cortexa9_0/libsrc/dmaps_v2_3/src Running Make include in ps7_cortexa9_0/libsrc/ddrps_v1_0/src Running Make include in ps7_cortexa9_0/libsrc/standalone_v6_7/src Running Make include in ps7_cortexa9_0/libsrc/scugic_v3_9/src Running Make include in ps7_cortexa9_0/libsrc/xilrsa_v1_5/src Running Make include in ps7_cortexa9_0/libsrc/xilffs_v3_9/src Running Make include in ps7_cortexa9_0/libsrc/xadcps_v2_2/src Running Make include in ps7_cortexa9_0/libsrc/devcfg_v3_5/src Running Make include in ps7_cortexa9_0/libsrc/scuwdt_v2_1/src Running Make include in ps7_cortexa9_0/libsrc/cpu_cortexa9_v2_6/src Running Make include in ps7_cortexa9_0/libsrc/coresightps_dcc_v1_4/src Running Make include in ps7_cortexa9_0/libsrc/scutimer_v2_1/src Running Make libs in ps7_cortexa9_0/libsrc/dmaps_v2_3/src Compiling dmaps arm-none-eabi-ar: ../../../lib/libxil.a を作成しています Running Make libs in ps7_cortexa9_0/libsrc/ddrps_v1_0/src Compiling ddrps Running Make libs in ps7_cortexa9_0/libsrc/standalone_v6_7/src Compiling standalone In file included from sleep.c:57:0: xtime_l.h:89:9: note: #pragma message: For the sleep routines, Global timer is being used #pragma message ("For the sleep routines, Global timer is being used") ^~~~~~~ In file included from xtime_l.c:53:0: xtime_l.h:89:9: note: #pragma message: For the sleep routines, Global timer is being used #pragma message ("For the sleep routines, Global timer is being used") ^~~~~~~ In file included from usleep.c:60:0: xtime_l.h:89:9: note: #pragma message: For the sleep routines, Global timer is being used #pragma message ("For the sleep routines, Global timer is being used") ^~~~~~~ In file included from xil_sleeptimer.c:55:0: xtime_l.h:89:9: note: #pragma message: For the sleep routines, Global timer is being used #pragma message ("For the sleep routines, Global timer is being used") ^~~~~~~ Running Make libs in ps7_cortexa9_0/libsrc/scugic_v3_9/src Compiling scugic Running Make libs in ps7_cortexa9_0/libsrc/xilrsa_v1_5/src Running Make libs in ps7_cortexa9_0/libsrc/xilffs_v3_9/src Compiling XilFFs Library diskio.c: In function 'disk_status': diskio.c:170:6: warning: unused variable 'DelayCount' [-Wunused-variable] u32 DelayCount = 0; ^~~~~~~~~~ diskio.c:169:6: warning: unused variable 'StatusReg' [-Wunused-variable] u32 StatusReg; ^~~~~~~~~ diskio.c: In function 'disk_initialize': diskio.c:258:6: warning: unused variable 'Status' [-Wunused-variable] s32 Status; ^~~~~~ diskio.c: In function 'disk_read': diskio.c:357:9: warning: unused parameter 'buff' [-Wunused-parameter] BYTE *buff, /* Pointer to the data buffer to store read data */ ^~~~ diskio.c:358:9: warning: unused parameter 'sector' [-Wunused-parameter] DWORD sector, /* Start sector number (LBA) */ ^~~~~~ diskio.c: In function 'disk_ioctl': diskio.c:401:7: warning: unused parameter 'pdrv' [-Wunused-parameter] BYTE pdrv, /* Physical drive number (0) */ ^~~~ diskio.c:402:7: warning: unused parameter 'cmd' [-Wunused-parameter] BYTE cmd, /* Control code */ ^~~ diskio.c:403:8: warning: unused parameter 'buff' [-Wunused-parameter] void *buff /* Buffer to send/receive control data */ ^~~~ diskio.c: In function 'disk_write': diskio.c:502:14: warning: unused parameter 'buff' [-Wunused-parameter] const BYTE *buff, /* Data to be written */ ^~~~ diskio.c:503:8: warning: unused parameter 'sector' [-Wunused-parameter] DWORD sector, /* Sector address (LBA) */ ^~~~~~ Running Make libs in ps7_cortexa9_0/libsrc/xadcps_v2_2/src Compiling xadcps Running Make libs in ps7_cortexa9_0/libsrc/devcfg_v3_5/src Compiling devcfg Running Make libs in ps7_cortexa9_0/libsrc/scuwdt_v2_1/src Compiling scuwdt Running Make libs in ps7_cortexa9_0/libsrc/cpu_cortexa9_v2_6/src Compiling cpu_cortexa9 Running Make libs in ps7_cortexa9_0/libsrc/coresightps_dcc_v1_4/src Compiling coresightps_dcc Running Make libs in ps7_cortexa9_0/libsrc/scutimer_v2_1/src Compiling scutimer Finished building libraries arm-none-eabi-gcc -MMD -MP -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -c pcap.c -o pcap.o -Izynq_fsbl_bsp/ps7_cortexa9_0/include -I. In file included from pcap.c:104:0: zynq_fsbl_bsp/ps7_cortexa9_0/include/xtime_l.h:89:9: note: #pragma message: For the sleep routines, Global timer is being used #pragma message ("For the sleep routines, Global timer is being used") ^~~~~~~ arm-none-eabi-gcc -MMD -MP -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -c qspi.c -o qspi.o -Izynq_fsbl_bsp/ps7_cortexa9_0/include -I. arm-none-eabi-gcc -MMD -MP -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -c rsa.c -o rsa.o -Izynq_fsbl_bsp/ps7_cortexa9_0/include -I. arm-none-eabi-gcc -MMD -MP -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -c main.c -o main.o -Izynq_fsbl_bsp/ps7_cortexa9_0/include -I. In file included from main.c:141:0: zynq_fsbl_bsp/ps7_cortexa9_0/include/xtime_l.h:89:9: note: #pragma message: For the sleep routines, Global timer is being used #pragma message ("For the sleep routines, Global timer is being used") ^~~~~~~ arm-none-eabi-gcc -MMD -MP -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -c fsbl_hooks.c -o fsbl_hooks.o -Izynq_fsbl_bsp/ps7_cortexa9_0/include -I. arm-none-eabi-gcc -MMD -MP -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -c md5.c -o md5.o -Izynq_fsbl_bsp/ps7_cortexa9_0/include -I. arm-none-eabi-gcc -MMD -MP -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -c image_mover.c -o image_mover.o -Izynq_fsbl_bsp/ps7_cortexa9_0/include -I. arm-none-eabi-gcc -MMD -MP -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -c ps7_init.c -o ps7_init.o -Izynq_fsbl_bsp/ps7_cortexa9_0/include -I. arm-none-eabi-gcc -MMD -MP -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -c nor.c -o nor.o -Izynq_fsbl_bsp/ps7_cortexa9_0/include -I. arm-none-eabi-gcc -MMD -MP -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -c nand.c -o nand.o -Izynq_fsbl_bsp/ps7_cortexa9_0/include -I. arm-none-eabi-gcc -MMD -MP -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -c sd.c -o sd.o -Izynq_fsbl_bsp/ps7_cortexa9_0/include -I. arm-none-eabi-gcc -MMD -MP -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -c fsbl_handoff.S -o fsbl_handoff.o -Izynq_fsbl_bsp/ps7_cortexa9_0/include -I. arm-none-eabi-gcc -o executable.elf pcap.o qspi.o rsa.o main.o fsbl_hooks.o md5.o image_mover.o ps7_init.o nor.o nand.o sd.o fsbl_handoff.o -MMD -MP -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -Wl,-build-id=none -specs=Xilinx.spec -lrsa -Wl,--start-group,-lxil,-lgcc,-lc,--end-group -Wl,--start-group,-lxilffs,-lxil,-lgcc,-lc,--end-group -Wl,--start-group,-lrsa,-lxil,-lgcc,-lc,--end-group -Wl,--gc-sections -Lzynq_fsbl_bsp/ps7_cortexa9_0/lib -L./ -Tlscript.ld generate_app: Time (s): cpu = 00:00:08 ; elapsed = 00:00:10 . Memory (MB): peak = 452.422 ; gain = 0.000 ; free physical = 14037 ; free virtual = 25604
ビルド後の生成物
- ビルド後の生成物はzynq_fsblフォルダに格納されている。
エラー
- ビルド中に起こったエラーについて記載する。
エラー内容
- シンボリックリンクを作成しないで、hisコマンドを実行すると以下のエラーが発生する。
hsi% generate_app -hw $hwdsgn -os standalone -proc ps7_cortexa9_0 -app zynq_fsbl -compile -sw zynq_fsbl -dir zynq_fsbl WARNING : No interface that uses file system is available ERROR: [Common 17-70] Application Exception: Not found in path: gmake
対策
- 上記に記載しているコマンドを実行すること。
参考サイト
Build FSBL
https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841798/Build+FSBLAR# 68344:SDSoC - SDSoC で使用される Vivado HSI ユーティリティには gmake を提供するホスト OS が必要
https://japan.xilinx.com/support/answers/68344.htmlZYNQ に GPIO 回路を接続し Linux 上で割込みを受け付けてみる(後編)
http://myokota.hatenablog.jp/entry/2015/08/12/233020