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

  • 相关阅读:
    【转载】数据结构与算法设计
    【转载】简述Linux的启动过程
    【转载】20分钟MySQL基础入门
    【转载】linux内核笔记之进程地址空间
    【转载】linux内核笔记之高端内存映射
    Logical Address->Linear Address->Physical Address
    【转载】教你分分钟学会用python爬虫框架Scrapy爬取心目中的女神
    【转载】不会编程也能写爬虫?可视化爬虫工具是什么东东
    【转载】我是一个键盘
    80. Remove Duplicates from Sorted Array II
  • 原文地址:https://www.cnblogs.com/Howbin/p/14379282.html
Copyright © 2011-2022 走看看