nxp-mcuxpresso / vscode-for-mcux

Support for NXP Visual Studio Code for MCUXpresso Extension project.
13 stars 0 forks source link

What should I keep under git version control? #18

Open escherstair opened 8 months ago

escherstair commented 8 months ago

After I have setup the environment as described in the wiki, and I have imported a project from the repository, I have the following folder structure project

|--- .vscode
|--- __repo__
|    |--- core
|    |--- middleware
|    |--- rtos
|--- armgcc

where the children of __repo__ are symbolic links. My question is: what should I keep under git version control for my project? What should another developer of my team do before starting working on this project? I suppose cloning my repo and what else? Setting up the environment with the extension and importing the existing project as described here?

/ EDIT / After some investigation I can add that:

A lot of doubts and open questions, but I'm confident I can get the result, at the end.

DragosMiloiuNXP commented 8 months ago

Hi @escherstair ,

There are two options for saving an MCUXpresso SDK based project under git:

Regarding paths present in mcuxpresso-tools.json and cmake-kits.json, Import Project feature should update them once the project is imported on another computer.

As you pointed out the __repo__ folder is not necessary for build, debug, IntelliSense, etc. It is added for two reasons: so, the search functionality in VS Code is able to look through SDK’s code as well whenever a developer is looking for something and, as you said, “to make clearer the dependencies in the "Explorer" view”.

PS. If you think we can improve the user experience here in any way, please do not hesitate to let us know.

escherstair commented 8 months ago

Hi @DragosMiloiuNXP thank you very much for your explanation.

Regarding paths present in mcuxpresso-tools.json and cmake-kits.json, Import Project feature should update them once the project is imported on another computer.

Yes, this is true, but it's no so convenient because when the developer "B" pushes his/her commits to remote, the paths are updated too. And the developer "A" will see changes... And so on.

Do mcuxpresso-tools.json and cmake-kits.json support VS code variable substitution? I mean, can I use some VS code variables (${userHome}, ${workspaceFolder}, ...) in the paths? In this way it's quite easy changing the file to avoid absolute paths.

PS. If you think we can improve the user experience here in any way, please do not hesitate to let us know.

Thank you for this opportunity. For sure I will share here my feedback, because I think that customer feedback is important to drive the development

DragosMiloiuNXP commented 8 months ago

Hi @escherstair,

In cmake-kits.json and mcuxpresso-tools.json you can define your paths (like: toolchainPath, sdk.path, etc.) by using the value of environment variables. Example: "toolchainPath": "%HOMEPATH%/.mcuxpressotools/arm-gnu-toolchain-12.2.rel1-mingw-w64-i686-arm-none-eabi".

escherstair commented 8 months ago

Hi @DragosMiloiuNXP %HOMEPATH% doesn't work as "ARMGCC_DIR" in cmake-kits.json. When I try to configure the project with cmake I get the error

[cmake] -- TOOLCHAIN_DIR: %HOMEPATH%/.mcuxpressotools/arm-gnu-toolchain-12.2.rel1-mingw-w64-i686-arm-none-eabi
[cmake] -- BUILD_TYPE: debug
[cmake] -- TOOLCHAIN_DIR: %HOMEPATH%/.mcuxpressotools/arm-gnu-toolchain-12.2.rel1-mingw-w64-i686-arm-none-eabi
[cmake] -- BUILD_TYPE: debug
[cmake] -- The ASM compiler identification is unknown
[cmake] -- Found assembler: %HOMEPATH%/.mcuxpressotools/arm-gnu-toolchain-12.2.rel1-mingw-w64-i686-arm-none-eabi/bin/arm-none-eabi-gcc.exe
[cmake] CMake Error at CMakeLists.txt:18 (ENABLE_LANGUAGE):
[cmake]   The CMAKE_ASM_COMPILER:
[cmake] 
[cmake]     %HOMEPATH%/.mcuxpressotools/arm-gnu-toolchain-12.2.rel1-mingw-w64-i686-arm-none-eabi/bin/arm-none-eabi-gcc.exe
[cmake] 
[cmake]   is not a full path and was not found in the PATH.
[cmake] 
[cmake]   Tell CMake where to find the compiler by setting either the environment
[cmake]   variable "ASM" or the CMake cache entry CMAKE_ASM_COMPILER to the full path
[cmake]   to the compiler, or to the compiler name if it is in the PATH.

If I use ${userHome} it works

  "ARMGCC_DIR": "${userHome}/.mcuxpressotools/arm-gnu-toolchain-12.2.rel1-mingw-w64-i686-arm-none-eabi",

Product Suggestion: Maybe ${userHome} can be automatically set by the extension (instead of the explicit path to the user home).

DragosMiloiuNXP commented 8 months ago

Hi @escherstair,

Thank you for the suggestion. I'll try it locally and include the fix in a future extension release. We are also working on reducing the number of absolute paths present in various json files.

escherstair commented 8 months ago
  • Delete __repo__ and build folders (like armgcc/debug, armgcc/release) and keep the remaining files in git (including .vscode folder). The other developers should clone your project from git and import it using Import Project.

I've just tried, but when the developer 'B' imports the project through Import Project, __repo__ symbolic link is not created (under Windows 11, at least). He had to create it manually with an elevated command prompt mklink /d "Link" "Source Target"

DragosMiloiuNXP commented 6 months ago

Hi @escherstair,

In the latest version of the extension we reduced the number of absolute paths in our JSON files. Please refer to the documentation here, or import a new example to see the updates.

escherstair commented 6 months ago

Hi @DragosMiloiuNXP I see some improvements, but something else doesn't work as expected:

DragosMiloiuNXP commented 6 months ago

Hi @escherstair

For example, let's say the toolchain is located somewhere under your userHome folder. Then we can determine that and set the "toolchainPath" as a path relative to ${userHome}. If it's not under userHome, we can try to set it as relative to ${workspaceFolder}. Even with this approach it won't handle all the cases. For example you may have your project on drive C and the toolchain or repository on a different drive (or even mapped network drive).