ARM-software / vscode-keil-studio-pack

Extension pack for all VS Code extensions
https://arm-software.github.io/vscode-keil-studio-pack/
Other
36 stars 6 forks source link

When the project configuration file is not in the root directory of vscode's workspace, it will not build. #3

Closed HalfSweet closed 1 year ago

HalfSweet commented 1 year ago

Type: Bug Report

Describe the bug

In general, when using the STM32CubeMX software to generate an MDK project, the typical file path looks like this

.
│ .mxproject
│ f030test.ioc
│
├──.vscode
│ settings.json
│ ├──.vscode │ settings.json │ ├──.
├───Core
│ ├───Inc
│ │ xxx.h
│ │
│ └──Src
│ xxx.c
│
├───Drivers
│ ├───CMSIS
│ │ xxx
│ │
│ └───STM32F0xx_HAL_Driver
│ │
│ ├───Inc
│ │ │ xxx
│ │
│ └──Src
│ xxx
│
└──MDK-ARM
    │ .clangd
    │ f030test.cproject.yaml
    │ f030test.csolution.yaml
    │ f030test.uvguix.HalfSweet
    │ f030test.uvoptx
    │ f030test.uvprojx
    │ f030test_f030test.sct
    │ startup_stm32f030x8.s
    │ vcpkg-configuration.json
    │
    ├──.vscode
    │ launch.json
    │ tasks.json
    │ vscode │ vcpkg-configuration.json │ tasks.json
    ├───DebugConfig
    │ xxx
    └───RTE
        └───xxx

But this poses a problem, when we use the outermost folder as the root directory of the workspace, the plugin will not be able to do the build job. Of course, we can set MDK-ARM as the root directory of the workspace, but since the rest of the code files will be leveled with it, we can't do a good job of managing the whole project.

Terminal output:

 *  正在执行任务: CMSIS Build 

spawn cbuild ENOENT

 *  终端进程启动失败(退出代码: 1)。 
 *  终端将被任务重用,按任意键关闭。 

To Reproduce Steps to reproduce the behavior:

  1. Set the root directory of the workspace to the same level as the ,ioc file.
  2. Click on the build button in CMSIS

Expected behavior I want to build a project that manages any subdirectory in the root directory of the workspace.

Code sample and logs

Screenshots

图片

Additional context

mcgordonite commented 1 year ago

Hi @HalfSweet, the cause of this issue is that the extension only activates the vcpkg environment automatically when the vcpkg-configuration.json is at the root of the workspace.

You can manually activate the environment by right clicking on the vcpkg-configuration.json file in the file explorer, and click "Activate vcpkg environment.

Once that completes, the build task should be able to find the build tools.

HalfSweet commented 1 year ago

This worked and solved my problem, thanks a lot!