Xilinxドキュメント確認
ZynqはXilinx SDKのEclipseを使ってビルドするチュートリアルが多いですが、コマンドラインからもビルドができるようなので試してみます。
ターゲットボードはUltra96-V2です。
"Xilinx Software Command-Line Tool (XSCT)"を使います。
https://www.xilinx.com/html_docs/xilinx2018_1/SDK_Doc/xsct/intro/xsct_introduction.html
Graphical development environments such as the Xilinx® Software Development Kit (Xilinx SDK) are useful for getting up to speed on development for a new processor architecture. It helps to abstract away and group most of the common functions into logical wizards that even the novice can use. However, scriptability of a tool is also essential for providing the flexibility to extend what is done with that tool. It is particularly useful when developing regression tests that will be run nightly or running a set of commands that are used often by the developer.
「GUIもいいけど、スクリプトでレグレッションテスト走らせるなど、拡張する場合にはコマンドライン使うでしょ」とのことで用意されているそうです。
XSCTでビルドしてみる
前提
Vivadoで.hdfファイルは作成されているとします。
ツール起動
VivadoをInstallすると既に入っていました。
※windowsのbatファイルなのでcygwinからは起動できないみたいです。
https://forums.xilinx.com/t5/Embedded-Development-Tools/XSCT-fails-on-windows/td-p/877875
プロジェクト作成
SDK プロジェクト関連のコマンドは
https://www.xilinx.com/html_docs/xilinx2018_1/SDK_Doc/xsct/sdk/reference_xsct_sdk.html
にドキュメントがあります。
以下が、コマンドラインの手順です。 ※ # 以降は説明のためのコメントで、実際の入出力ではないです。
xsct% cd ws_xsct
xsct% setws ./ #"ワークスペースの設定"
xsct% createhw -name hw0 -hwspec ./ultra96.hdf #"ultra96.hdfを使って、hw0という名前のhwプロジェクトを生成する"
Starting xsdk.bat. This could take few seconds... done
CRITICAL WARNING: [Board 49-71] The board_part definition was not found for em.avnet.com:ultra96v2:part0:1.0. The project's board_part property was not set, but the project's part property was set to xczu3eg-sbva484-1-e. Valid board_part values can be retrieved with the 'get_board_parts' Tcl command. Check if board.repoPaths parameter is set and the board_part is installed from the tcl app store.
INFO: [Hsi 55-1698] elapsed time for repository loading 1 seconds
hsi::open_hw_design: Time (s): cpu = 00:00:09 ; elapsed = 00:00:09 . Memory (MB): peak = 287.887 ; gain = 237.453
xsct% createbsp -name bsp0 -hwproject hw0 -proc psu_cortexr5_0 -os freertos10_xilinx #"HWプロジェクト:hw0, cpu:CortexR5の0, OS:FreeRTOSでbsp0という名前のBSPプロジェクトを作る"
In start copy psu_cortexr5
INFO:[hsi-utils-101] "xprint_generated_header" tcl procedure is deprecated, use "hsi::utils::write_c_header " instead
xsct% configbsp -bsp bsp0 stdin psu_uart_1 #"標準入力をuart1にする(ultra96用の設定)"
xsct% configbsp -bsp bsp0 stdout psu_uart_1 #"標準出力をuart1にする(ultra96用の設定)"
xsct% updatemss -mss bsp0/system.mss #"configbspしたら必要"
xsct% regenbsp -bsp bsp0 #"configbspしたら必要"
xsct% createapp -name hello0 -bsp bsp0 -hwproject hw0 -proc psu_cortexr5_0 -os freertos10_xilinx -lang c #"BSPプロジェクト:bsp0 HWプロジェクト:hw0 cpu:CortexR5の0 OS:FreeRTOSでhello0という名前のアプリケーションプロジェクトを生成する。テンプレートは指定していないのでhello worldになる"
App name
Description
App name
Description
WARNING: [Hsi 61-9] Current Software design may not be compatible with "hello_world" app. Tool is ignoring the MSS file specified in the app directory
Application project 'hello0' created successfully.
ワークスペースの設定。好きなところにフォルダを作れば大丈夫です。
setwsはコンソール開くたびに必要なので注意
CPUやOSのオプションの詳細は載っていなかったので、Eclipseの設定画面で確認しました。
と思ったら、repo -apps と打つと出力されました。
repo -appsの出力
xsct% repo -apps
App name
Description
================================================================================
APPLICATION SUPPORTED PROCESSOR SUPPORTED OS
================================================================================
DDR self refresh psu_cortexr5 standalone
--------------------------------------------------------------------------------
Dhrystone microblaze standalone
ps7_cortexa9
--------------------------------------------------------------------------------
Empty Application microblaze standalone
ps7_cortexa9 xilkernel
psu_cortexa53 freertos10_xilinx
psu_cortexr5
psv_cortexr5
psu_cortexa72
psv_cortexa72
--------------------------------------------------------------------------------
FreeRTOS Hello World psu_cortexr5 freertos10_xilinx
psv_cortexr5
ps7_cortexa9
psu_cortexa53
microblaze
--------------------------------------------------------------------------------
FreeRTOS lwIP Echo Server psu_cortexa53 freertos10_xilinx
psu_cortexr5
ps7_cortexa9
microblaze
--------------------------------------------------------------------------------
FreeRTOS lwIP TCP Perf Client psu_cortexa53 freertos10_xilinx
psu_cortexr5
ps7_cortexa9
microblaze
--------------------------------------------------------------------------------
FreeRTOS lwIP TCP Perf Server psu_cortexa53 freertos10_xilinx
psu_cortexr5
ps7_cortexa9
microblaze
--------------------------------------------------------------------------------
FreeRTOS lwIP UDP Perf Client psu_cortexa53 freertos10_xilinx
psu_cortexr5
ps7_cortexa9
microblaze
--------------------------------------------------------------------------------
FreeRTOS lwIP UDP Perf Server psu_cortexa53 freertos10_xilinx
psu_cortexr5
ps7_cortexa9
microblaze
--------------------------------------------------------------------------------
Hello World microblaze standalone
ps7_cortexa9 xilkernel
psu_cortexa53
psu_cortexr5
psv_cortexr5
psu_cortexa72
psv_cortexa72
--------------------------------------------------------------------------------
Libmetal AMP Demo psu_cortexr5 freertos10_xilinx
standalone
--------------------------------------------------------------------------------
lwIP Echo Server psu_cortexa53 standalone
psu_cortexr5
ps7_cortexa9
microblaze
--------------------------------------------------------------------------------
lwIP TCP Perf Client psu_cortexa53 standalone
psu_cortexr5
ps7_cortexa9
microblaze
--------------------------------------------------------------------------------
lwIP TCP Perf Server psu_cortexa53 standalone
psu_cortexr5
ps7_cortexa9
microblaze
--------------------------------------------------------------------------------
lwIP UDP Perf Client psu_cortexa53 standalone
psu_cortexr5
ps7_cortexa9
microblaze
--------------------------------------------------------------------------------
lwIP UDP Perf Server psu_cortexa53 standalone
psu_cortexr5
ps7_cortexa9
microblaze
--------------------------------------------------------------------------------
Memory Tests microblaze standalone
ps7_cortexa9
psu_cortexa53
psu_cortexr5
--------------------------------------------------------------------------------
OpenAMP echo-test psu_cortexr5 freertos10_xilinx
ps7_cortexa9 standalone
--------------------------------------------------------------------------------
OpenAMP matrix multiplication Demo psu_cortexr5 freertos10_xilinx
ps7_cortexa9 standalone
--------------------------------------------------------------------------------
OpenAMP RPC Demo psu_cortexr5 freertos10_xilinx
ps7_cortexa9 standalone
--------------------------------------------------------------------------------
Peripheral Tests ps7_cortexa9 standalone
psu_cortexa53 xilkernel
psu_cortexr5
microblaze
psv_cortexa72
psv_cortexr5
--------------------------------------------------------------------------------
RSA Authentication App ps7_cortexa9 standalone
--------------------------------------------------------------------------------
SREC Bootloader microblaze standalone
--------------------------------------------------------------------------------
SREC SPI Bootloader microblaze standalone
--------------------------------------------------------------------------------
versal PLM psu_pmc standalone
psv_pmc
--------------------------------------------------------------------------------
versal PSM Firmware psu_psm standalone
psv_psm
--------------------------------------------------------------------------------
Xilkernel POSIX Threads Demo microblaze xilkernel
--------------------------------------------------------------------------------
Zynq MP DRAM tests psu_cortexa53 standalone
--------------------------------------------------------------------------------
Zynq MP FSBL psu_cortexa53 standalone
psu_cortexr5
--------------------------------------------------------------------------------
ZynqMP PMU Firmware psu_pmu standalone
--------------------------------------------------------------------------------
Zynq DRAM tests ps7_cortexa9 standalone
--------------------------------------------------------------------------------
Zynq FSBL ps7_cortexa9 standalone
--------------------------------------------------------------------------------
async_buffer ai_engine freertos10_xilinx
standalone
linux
--------------------------------------------------------------------------------
GMIO_bandwidth ai_engine freertos10_xilinx
standalone
linux
--------------------------------------------------------------------------------
Linux Empty Application ps7_cortexa9 linux
psu_cortexa53
microblaze
psv_cortexa72
--------------------------------------------------------------------------------
Linux Hello World ps7_cortexa9 linux
psu_cortexa53
microblaze
psv_cortexa72
--------------------------------------------------------------------------------
ビルド
projects -build
でビルドできます。
xsct% projects -build
Building '/bsp0'
Invoking Make Builder...bsp0
17:19:00 **** Build of project bsp0 ****
・・・
Invoking: ARM R5 Print Size
armr5-none-eabi-size hello0.elf |tee "hello0.elf.size"
text data bss dec hex filename
55724 4272 89104 149100 2466c hello0.elf
Finished building: hello0.elf.size
17:19:34 Build Finished (took 1s.655ms)
Invoking scanner config builder on project
Building '/hw0'
Eclipseで確認
Switching Between XSCT and Xilinx SDK Development Environment
にあるとおり、切り替えられるはず
XSCTで作ったワークスペースをEclipseで開けるか確認してみます。(コンソール閉じないと開けなかった)
ちゃんと開けました。↓
stdin, stdoutをuartに変えたつもりですが、ここもOK↓
Hello Worldがテンプレで実装されているので、出力もできました。↓
備考
実際にボードを動かすとこまでもコマンドラインでできるみたいですね。
これでレグレッションテストできるとよさそう。