1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Vitis】Standaloneアプリでprintfを使う

Posted at

はじめに

Vitisでスタンドアロンアプリを作成する際、printfが使えるとDebugに便利です。
本記事では、Vitisでスタンドアロンアプリを作成する際にprintfを使う方法について説明します。

環境

  • Vivado/Vitis 2024.2
  • Zynq7010
  • PLのUARTが接続されていること

設定

VivadoでZynq Block DesignでUARTを有効します。

image.png

私の場合は、MIO24、25をUART1が接続されているのでこのような設定となっています。

Vitisでプラットフォームを作成した後、Settingsを開きます。

image.png

Boar Support Packageのstandaloneを選択すると、standalone_stdin, standalone_stdoutの設定があるので、使用するUARTを選択します。
UARTが1つしか無い場合は、デフォルトの状態で問題ないとおもいます。

使い方

xil_printfを使うことで、UARTに出力することができます。

#include "xil_printf.h"

int main() {
    xil_printf("Hello from UART!\r\n");
    return 0;
}

実行すると、シリアルコンソールに出力されます。
デフォルトの通信速度は、115200bpsなので、この速度でシリアルコンソールを設定しておいて下さい。

image.png

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?