Clarification on Cortex-M Development Using VSCode

I’ve been reading Cortex-M Development Using VSCode and in particular, the section Compiling Applications with VS Code where I can see an example of tasks.json
As far as I understand the section

    "env":
    {
        "ARMGCC_DIR": "/<PATH_TO_YOUR_TOOLCHAIN>/gcc-arm-11.2-2022.02-x86_64-arm-none-eabi" //Put here the path to your toolchain
    }

is necessary only if an environment variable named ARMGCC_DIR has not been exported permanently in the OS.
Otherwise the environment variable ARMGCC_DIR is already known at OS level, and is not necessary to set it again in VSCode.

Can you confirm, please?
Do you think that the KB can be clarified a little bit on this aspect?

Hi @vix,

Although I didn’t try that myself, this makes a lot of sense, since the environment is already exported and the terminal that VSCode is using is the “same” as the host OS. Did you try that yourself?

Usually, we believe that’s the best approach because it’s easier to change the task.json configuration instead of global variables on the host OS. Also, we believe that in this case, the configuration is dependent on the VSCode, not some global configuration that our customers need to do.

Do you have any specific reason that you don’t want to use task.json?

Thanks for pointing this out.

Best Regards,
Hiago.