Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>KostalCodeProjectDevelopmentPlatformNew to Visual Studio Code? Get it now.
KostalCodeProjectDevelopmentPlatform

KostalCodeProjectDevelopmentPlatform

HZC

|
34 installs
| (0) | Free
KostalCodeProjectDevelopmentPlatform
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

KostalCodeProjectDevelopmentPlatform README

中文 英文

一、环境准备

1. 配置环境变量

一般不需要配置,默认即可

  1. 点击vscode左下角设置按钮,并点击设置文字按钮打开设置页面
  2. 输入Kostal搜索本插件配置
  • MSYS:配置make工具环境, KOSTAL Eclipse中已集成
  • MINGW:配置make文件或bat文件使用的一些命令工具环境, KOSTAL Eclipse中已集成

TIP:上述环境后续将在本插件中集成

2. 创建kpm-package.json文件

在项目根目录下创建名为kpm-package.json的文件

示例

{
    "name": "projectName",
    "type": "KOSTAL_CODE_PROJECT",
    "version": "0.0.0",
    "author": "AENJ",
    "private": false,
    "scripts": {},
    "additional": {
        "compiler": "iar",
        "rootMakePath":"./Tools/Make",
        "makeArgs":"VERBOSE_OFF -j8",
        "compileMakeFilePath": "./Tools/ToolsConfig/compile_opt.mk"
    },
    "dependencies": {},
    "devDependencies": {}
}
  • name:[可选] 项目的名字
  • type:KOSTAL代码项目必须填写KOSTAL_CODE_PROJECT
  • version:[可选] 项目版本号
  • author:[可选] 项目作者
  • private:[可选] 项目是否是私有的
  • scripts:项目post build或pre build执行的脚本配置,必须配合kpm使用
  • additional:额外的配置项,不同的项目类型有不同的配置项,以下子配置仅针对KOSTAL_CODE_PROJECT
    • compiler:项目编译所使用的编译器类型,现阶段支持iar,ghs,tasking,用于编译时提取编译警告和错误,并在问题页面显示
    • rootMakePath:项目编译所执行的make入口文件路径(相对项目根目录)
    • makeArgs:传递给make.bat的参数,非特殊项目需要,默认不需要修改
    • compileMakeFilePath:KOSTAL代码项目compile make文件的相对路径(相对项目根目录),用于自动获取在make文件中定义的CC_DEFLIST宏,在编辑代码时可识别到这里定义的宏

3. C或CPP项目集成环境安装-vscode插件(在插件市场搜索安装)

一般第一次打开C或CPP文件,vscode会自动提醒安装

  1. C/C++
  2. C/C++ Extension Pack
  3. C/C++ Themes

二、使用

确保项目根目录已有kpm-package.json文件

1. 插件的激活

打开已有kpm-package.json的项目,插件会自动激活。如果是第一次创建kpm-package文件的话,在创建之后使用ctrl+shift+alt+k快捷键,可主动激活插件。插件激活后,你将在资源管理器视图的下方看到MAKE TARGET和KPM DEPENDENCIES界面.

  • MAKE TARGET界面
    • 点击MAKE TARGET界面右上角的+按钮,可在弹出的输入框中添加新的target
    • 在target上点击鼠标右键,会出现delete按钮,点击可删除该target
  • KPM DEPENDENCIES界面
    KPM包依赖展示界面

2. KOSTAL代码项目compile make文件定义的宏获取(快捷键ctrl+shift+alt+r)

KOSTAL代码项目中常常有一些宏定义在compile_opt.mk这种文件中,这里的宏在Eclipse项目中没有办法识别,在代码中看起来这段代码没有使能,但是实际编译是使能的,导致一些不必要的逻辑错误出现。本插件可提取compile_opt.mk这种文件中定义的宏,可在代码编辑时显示出这些宏导致的使能或失能。

TIP:要求compile_opt.mk文件中必须要以下列形式定义宏

CC_DEFLIST = xxx\
			 xxxx\
			 xxxxx\

3. 项目特定的环境变量的配置

  • 点击vscode左下角设置按钮,并点击设置文字按钮打开设置页面
  • 输入Kostal搜索本插件配置,点击添加项,添加特定的环境变量,比如"MAKE_CORE":"core0",注意格式

注意事项

  1. Vscode的默认命令终端应设置为powershell

Enjoy!

English Chinese

一、Environment Preparation

1. Configure Environment Variables

Generally no configuration is needed, use the default settings

  1. Click the settings button at the bottom left of VSCode and click the text button to open the settings page
  2. Enter "Kostal" to search for this plugin's configuration
  • MSYS: Configure the make tool environment, already integrated in KOSTAL Eclipse
  • MINGW: Configure command tool environments for make files or bat files, already integrated in KOSTAL Eclipse

TIP: The above environments will be integrated into this plugin in the future

2. Create kpm-package.json File

Create a file named kpm-package.json in the project root directory.

Example

{
    "name": "projectName",
    "type": "KOSTAL_CODE_PROJECT",
    "version": "0.0.0",
    "author": "AENJ",
    "private": false,
    "scripts": {},
    "additional": {
        "compiler": "iar",
        "rootMakePath":"./Tools/Make",
        "makeArgs":"VERBOSE_OFF -j8",
        "compileMakeFilePath": "./Tools/ToolsConfig/compile_opt.mk"
    },
    "dependencies": {},
    "devDependencies": {}
}
  • name: [Optional] Project name
  • type: Must be set to KOSTAL_CODE_PROJECT for KOSTAL code projects
  • version: [Optional] Project version number
  • author: [Optional] Project author
  • private: [Optional] Whether the project is private
  • scripts: Script configurations for post-build or pre-build execution, must be used with kpm
  • additional: Additional configuration items (different project types have different configurations; the following sub-configurations apply only to KOSTAL_CODE_PROJECT)
    • compiler: Compiler type used for project compilation (currently supports iar, ghs, tasking), used to extract compilation warnings/errors and display them in the problems panel
    • rootMakePath: Path to the make entry file for project compilation (relative to the project root)
    • makeArgs: Parameters passed to make.bat (no modification needed by default for non-special projects)
    • compileMakeFilePath: Relative path to the compile make file for KOSTAL code projects (relative to the project root), used to automatically retrieve macros defined in the make file (these macros will be recognized during code editing)

3. Install C/C++ Project Integration Environment - VSCode Plugins (search and install from the plugin marketplace)

VSCode will usually automatically prompt for installation when opening a C/C++ file for the first time

  1. C/C++
  2. C/C++ Extension Pack
  3. C/C++ Themes

二、Usage

Ensure the project root directory already has a kpm-package.json file

1. Activate the Plugin

Open a project with an existing kpm-package.json file; the plugin will activate automatically. If creating a kpm-package file for the first time, use the shortcut ctrl+shift+alt+k after creation to manually activate the plugin. After activation, you will see MAKE TARGET and KPM DEPENDENCIES interfaces below the Explorer view.

  • MAKE TARGET interface
    • Click the + button in the top-right corner of the MAKE TARGET interface to add a new target in the pop-up input box.
    • Right-click on a target to display a delete button, and click it to remove the target.
  • KPM DEPENDENCIES interface
    Displays KPM package dependencies

2. Retrieve Macros Defined in KOSTAL Code Project Compile Make Files (shortcut ctrl+shift+alt+r)

KOSTAL code projects often have macros defined in files like compile_opt.mk. These macros are not recognized in Eclipse projects, causing code to appear disabled in the editor while being enabled during actual compilation, leading to unnecessary logical errors. This plugin can extract macros defined in compile_opt.mk-like files, showing whether they are "enabled" or "disabled" during code editing.

TIP: The compile_opt.mk file must define macros in the following format:

CC_DEFLIST = xxx\
			 xxxx\
			 xxxxx\

Notes

  1. VSCode's default command terminal should be set to PowerShell

Enjoy!

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft