Help us understand the problem. What is going on with this article?

VS CodeでWinAVRを使う

動機

  • とある演習でWinAVRを使うことになった
  • WinAVRに付いてくるProgrammers Notepadが使いづらかった
  • VSCodeが好きだった

前提

  • WinAVRはインストール済み(make.exeにパスが通っていること)
  • ビルドに使用するMakefileは準備済み
  • VSCode 1.40.2
  • 使用するマイコンはATmega168

実際にやったっこと

  • フォルダーを開くmakefileがあるディレクトリを開いて作業する
  • 以下の2つのファイルを直下の.vscodeディレクトリに配置
c_cpp_propaties.json
{
    "configurations": [
        {
            "name": "avr",
            "includePath": [
                "${workspaceFolder}/**",
                "C:/WinAVR/avr/include",
                "C:/WinAVR/lib/gcc/avr/3.4.6/include"
            ],
            "defines": [
                "__AVR_ATmega168__"
            ],
            "compilerPath": "C:\\WinAVR\\bin\\avr-gcc.exe",
            "cStandard": "c99",
            "intelliSenseMode": "gcc-x86"
        }
    ],
    "version": 4
}
tasks.json
{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "process",
            "label": "make all",
            "command": "make",
            "args": [
                "all",
            ],
            "options": {
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        },
        {
            "type": "process",
            "label": "make clean",
            "command": "make",
            "args": [
                "clean",
            ],
            "options": {
            },
            "problemMatcher": [
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        },
        {
            "type": "process",
            "label": "make program",
            "command": "make",
            "args": [
                "program",
            ],
            "options": {
            },
            "problemMatcher": [
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

結果

  • Intelisenseが効くようになった
  • ビルドが楽になった
  • 演習がより楽しくなった

参考文献

c_cpp_properties.json reference - Visual Studio Code
Tasks in Visual Studio Code

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away