最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

VSCode?IDE?配置環(huán)境過程解析

 更新時(shí)間:2022年02月24日 08:41:57   作者:Milton  
這篇文章主要介紹了VSCode?IDE?環(huán)境配置,這里說的是僅使用?VSCode?創(chuàng)建C/CPP項(xiàng)目時(shí)的配置,VSCode?有代碼提示,?定位來源和各種快捷鍵,?更適合日常編碼工作,需要的朋友可以參考下

如果用 PlatformIO 創(chuàng)建 libopencm3 項(xiàng)目可以做到零配置, 只是 libopencm3 的版本會(huì)舊一點(diǎn). 這里說的是僅使用 VSCode 創(chuàng)建C/CPP項(xiàng)目時(shí)的配置. VSCode 有代碼提示, 定位來源和各種快捷鍵, 更適合日常編碼工作.

說明

因?yàn)?PlatformIO 的 platform:st-stm32 自帶 libopencm3, 如果用 PlatformIO 創(chuàng)建 libopencm3 項(xiàng)目可以做到零配置, 只是 libopencm3 的版本會(huì)舊一點(diǎn). 這里說的是僅使用 VSCode 創(chuàng)建C/CPP項(xiàng)目時(shí)的配置. VSCode 有代碼提示, 定位來源和各種快捷鍵, 更適合日常編碼工作.

前提條件

參考如何linux環(huán)境下配置環(huán)境變量過程圖解  ,自行百度先將 GNU Arm Embedded Toolchain 和 st-flash 工具準(zhǔn)備好

創(chuàng)建項(xiàng)目

導(dǎo)出模板項(xiàng)目

git clone --recurse-submodules https://github.com/libopencm3/libopencm3-template.git
或者
git clone --recurse-submodules https://gitee.com/iosetting/libopencm3-template.git

VSCode 創(chuàng)建項(xiàng)目

用 VSCode 的 Open Folder 打開. 需要修改一下 my-project/Makefile 中的配置, 將 DEVICE 修改為實(shí)際使用的MCU型號(hào)

DEVICE=stm32f103c8t6

配置C/CPP環(huán)境

快捷鍵Ctrl+Shift+P, 在打開的對(duì)話框中, 輸入/找到 C/C++: Edit Configurations (JSON), 用JSON進(jìn)行配置

配置內(nèi)容

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**",
                "${workspaceFolder}/libopencm3/include"
            ],
            "defines": [
                "STM32F1"
            ],
            "compilerPath": "/opt/gcc-arm/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-gcc",
            "cStandard": "gnu11",
            "cppStandard": "gnu++14",
            "intelliSenseMode": "gcc-arm"
        }
    ],
    "version": 4
}
  1. compilerPath 根據(jù)自己的工具鏈路徑進(jìn)行修改
  2. defines 下的 STM32F1 與編譯無關(guān)(編譯使用的是DEVICE和鏈接庫(kù)), 不設(shè)置也能正確編譯, 設(shè)置這個(gè)是為了 VSCode 能正確定位變量和函數(shù)聲明

配置編譯任務(wù)

快捷鍵Ctrl+Shift+P, 在打開的對(duì)話框中, 輸入/找到 Tasks: Configure Task, 用others模板創(chuàng)建

配置內(nèi)容, 其中TARGETS=stm32/f1根據(jù)實(shí)際的MCU型號(hào)修改

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build libopencm3",
            "type": "shell",
            "command": "PREFIX=/opt/gcc-arm/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi- TARGETS=stm32/f1 make -C libopencm3",
            "problemMatcher": []
        },
        {
            "label": "build clean libopencm3",
            "type": "shell",
            "command": "PREFIX=/opt/gcc-arm/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi- make -C libopencm3 clean",
            "problemMatcher": []
        },
        {
            "label": "build",
            "type": "shell",
            "command": "PREFIX=/opt/gcc-arm/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi- make -C my-project",
            "problemMatcher": []
        },
        {
            "label": "build clean",
            "type": "shell",
            "command": "PREFIX=/opt/gcc-arm/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi- make -C my-project clean",
            "problemMatcher": []
        },
        {
            "label": "build download",
            "type": "shell",
            "command": "st-flash --reset write my-project/awesomesauce.bin 0x8000000",
            "problemMatcher": []
        }
    ]
}

使用時(shí), 通過Shift + Alt + F10調(diào)出菜單并選中執(zhí)行.

先執(zhí)行一次 build libopencm3 , 生成 libopencm3 的鏈接庫(kù)之后, 編譯項(xiàng)目就只需要執(zhí)行 build 了.

到此這篇關(guān)于VSCode IDE 環(huán)境配置的文章就介紹到這了,更多相關(guān)VSCode IDE 環(huán)境配置內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論

吕梁市| 保山市| 星座| 汉中市| 平陆县| 卢龙县| 永新县| 灵台县| 夏津县| 栾城县| 磐石市| 武宁县| 湘乡市| 迭部县| 冷水江市| 马山县| 项城市| 磴口县| 靖州| 抚顺市| 无为县| 建昌县| 上饶县| 清远市| 遂川县| 灵石县| 扎鲁特旗| 湖南省| 静安区| 宜春市| 彩票| 阆中市| 仪征市| 淮北市| 瑞昌市| 中宁县| 漾濞| 满洲里市| 延安市| 田阳县| 济源市|