zoukankan      html  css  js  c++  java
  • VS Code编写stm32

    说明

    • virtual code实现编辑功能,其有强大的代码提示、代码阅读功能。

    • 通过bat文件,通过cmd编译、下载,具体下载器设置仍需在keil软件中设置

    • 具体代码调试仍需在keil软件下

    项目配置文件

    新建.vscode文件夹,在其下建立两个文件settings.json,c_cpp_properties.json

    settings.json文件如下:

     {
         "files.associations": {
             "stm32f10x.h": "c"
        },
         "files.encoding": "gb2312",
         "editor.detectIndentation": false,
         "editor.tabSize": 2
     }

    c_cpp_properties.json文件如下:

     {
         "configurations": [
            {
                 "name": "Win32",
                 "includePath": [
                     "${workspaceFolder}/**",
                     "C:/Keil_v5/ARM/ARMCC/include"
                ],
                 "defines": [
                     "USE_STDPERIPH_DRIVER",
                     "STM32F10X_MD",
                     "__CC_ARM"
                ],
                 "intelliSenseMode": "msvc-x64"
            }
        ],
         "version": 4
     }

    这里第7行keil路径要换成自己的。

    编写.bat文件实现编译、下载

    编写的keil.bat文件如下:

     @echo off
     set UV=C:Keil_v5UV4UV4.exe
     if "%1" == "" goto NOP
     set UV_PRO_PATH=%cd%USER%1.uvprojx
     if "%2" == "-b" (
         echo Init building ...
         %UV% -j0 -b %UV_PRO_PATH% -o %cd%build_log.txt
         type build_log.txt
     ) else if "%2" == "-f" (
         echo Init flashing ...  
         %UV% -j0 -f %UV_PRO_PATH% -o %cd%build_log.txt
         type build_log.txt
     ) else (
         echo Init building ...
         %UV% -j0 -b %UV_PRO_PATH% -o %cd%build_log.txt
         type build_log.txt
         echo Init flashing ...
         %UV% -j0 -f %UV_PRO_PATH% -o %cd%build_log.txt
         type build_log.txt
     )
     if "%3" == "-f" (
         echo Init flashing ...
         %UV% -j0 -f %UV_PRO_PATH% -o %cd%build_log.txt
         type build_log.txt
     )
     goto end
     
     :NOP
     echo No ProjectName
     goto end
     
     :end
     exit

    这里需要需改的是2,4行的路径。

    编译+下载: .keil.bat 项目名

    仅编译:.keil.bat 项目名 -b

    仅烧写:.keil.bat 项目名 -f

  • 相关阅读:
    python中的各种排序
    python 实现求和、计数、最大最小值、平均值、中位数、标准偏差、百分比。
    python中的lambda
    python中有趣的函数
    python中的小技巧
    python 删除list中重复元素
    django-pagination的使用
    django-south
    ios复制到剪贴板
    iOS系统验证关闭
  • 原文地址:https://www.cnblogs.com/Howbin/p/14379282.html
Copyright © 2011-2022 走看看