LoginSignup
7
6

More than 5 years have passed since last update.

[メモ] Visual C++ for linux Development でRaspberryPiのデバッグ

Last updated at Posted at 2016-04-01

Visual C++ for linux Developmentで、RaspberryPiのデバッグ。
Visual C++ for linux Developmentのインストールは、前の記事の見てください。


VCforRasp9.png
# ビルドは、RaspberryPi本体で行われるようですね。

環境

  • Windows 10 (64bit)
  • Visual Studio 2015 Update 2 (Enterprise) 全部入りでインストール。
  • Raspberry Pi 2 (model B)
  • Raspbian: Jessie-Lite (2016-03-18-raspbian-jessie-lite.img)

準備: RaspberryPi

  • Raspbianイメージをお好みのツールで、microSDへ書き込み。
  • 初期設定

    sudo apt-get update
    sudo apt-get upgrade
    sudo raspi-config
    

    VCforRasp10.png
    で、この辺↓を設定して、
    > 2 Change User Password
    > 5 Internationalisation Options>I2 Change Timezone
    > 1 Expand Filesystem
    > 9 Advanced Options>A2 Hostname
    => 再起動

  • VC for Linux-devで入れろといわれてるパッケージ類
    sudo apt-get install -y openssh-server g++ gdb gdbserver
    => (すでに最新版が入ってました)

  • お好みのパッケージ
    sudo apt-get install -y byobu htop ccze

VS2015: Getting Started

  1. プロジェクト作成
    1. ファイル > 新規作成 > プロジェクト
      で、新しいプロジェクト ダイアログから、
    2. インストール済み>テンプレート>Visual C++>クロスプラットフォーム > Linux を選んで
    3. Blink (Raspberry)を選んで
      VCforRasp1.png
    4. (名前、場所、とか、かえたり、かえなかったりして)
    5. [OK]
      VCforRasp2.png
  2. RaspPiへの接続設定
    1. ツール > オプション で、CTRL+E で、Linuxを検索
    2. Connection Managerで、[Add]を押して、
      VCforRasp3.png
    3. Connect to Linuxに必要事項を記入して、[Connect]
      VCforRasp4.png
    4. プロジェクト > Blink 1のプロパティ から、
    5. 構成プロパティ > Remote settingsのTarget machineをらずぱいの設定に
    6. [OK]
  3. ビルド・デバッガ

    1. main.cppタブを選択して、
    2. wiringPiSetupSys();の行のあたりにカーソルを持ってきて、[F9]で赤丸つけて(ブレークポイントを張って)、
      VCforRasp5.png
    3. [F5]を押す。ビルドしますか => [はい(Y)]
      VCforRasp6.png
    4. ビルドエラーが発生しました。 ... ぉ?
      VCforRasp7.png
    5. => [いいえ(N)]
    6. wiringPi.h: No such file or directory => wiringPi.hがない?
      VCforRasp8_.png
    7. RaspberryPi側で、wiringpiパッケージをインストール

      pi@raspberrypi:~ $ sudo apt-get install wiringpi
      Reading package lists... Done
      Building dependency tree
      Reading state information... Done
      The following NEW packages will be installed:
      wiringpi
      0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
      Need to get 43.9 kB of archives.
      After this operation, 0 B of additional disk space will be used.
      Get:1 http://archive.raspberrypi.org/debian/ jessie/main wiringpi armhf 2.32 [43.9 kB]
      Fetched 43.9 kB in 0s (58.3 kB/s)
      Selecting previously unselected package wiringpi.
      (Reading database ... 30851 files and directories currently installed.)
      Preparing to unpack .../wiringpi_2.32_armhf.deb ...
      Unpacking wiringpi (2.32) ...
      Setting up wiringpi (2.32) ...
      Processing triggers for libc-bin (2.19-18+deb8u3) ...
      pi@raspberrypi:~ $
      
    8. [F5]で、再度ビルド 。

    9. ビルドが通って、ブレイクポイントのとこでとまりました。

      VCforRasp9.png

7
6
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
7
6