2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

岩手県立大学Advent Calendar 2019

Day 8

VS CodeでWinAVRを使う

Last updated at Posted at 2019-12-07

動機

  • とある演習で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

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?