Skip to main content
Paul. A
Visitor II
May 9, 2023
Question

Imported code does not build in VScode.

  • May 9, 2023
  • 3 replies
  • 2643 views

Hi,

I have always used the STM32cudeIDE but now trying to use the new STM32 VScode extension. But to start with, I have not been able to build the imported code.

[build] [1/1] Linking C executable GM_PRJ01_LL01_FRM.elf
[build] FAILED: GM_PRJ01_LL01_FRM.elf 
[build] 'cmd.exe' is not recognized as an internal or external command,
[build] operable program or batch file.
[build] ninja: build stopped: subcommand failed.

Is there a reason why a code that builds successfully on STM32CudeIDE will not build in vscode?

Thanks

This topic has been closed for replies.

3 replies

Pavel A.
Super User
May 9, 2023

Could you post the failing command (link) from the ninja file?

SRyan.2
Associate
November 19, 2023

Full Output:

[build] cmd.exe /C "cd . && C:\ST\STM32CubeIDE_1.11.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.100.202210260954\tools\bin\arm-none-eabi-gcc.exe -fdata-sections -ffunction-sections --specs=nano.specs -Wl,--gc-sections -g -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -T D:/CVSSource/ARM/Nucleo/Nucleo_RS485Test/STM32L432KCUX_FLASH.ld CMakeFiles/Nucleo_RS485Test.dir/Lib/TimedRun/TimedRun.c.obj CMakeFiles/Nucleo_RS485Test.dir/Core/Src/dma.c.obj CMakeFiles/Nucleo_RS485Test.dir/Core/Src/gpio.c.obj CMakeFiles/Nucleo_RS485Test.dir/Core/Src/lptim.c.obj CMakeFiles/Nucleo_RS485Test.dir/Core/Src/main.c.obj CMakeFiles/Nucleo_RS485Test.dir/Core/Src/stm32l4xx_hal_msp.c.obj CMakeFiles/Nucleo_RS485Test.dir/Core/Src/stm32l4xx_it.c.obj CMakeFiles/Nucleo_RS485Test.dir/Core/Src/syscalls.c.obj CMakeFiles/Nucleo_RS485Test.dir/Core/Src/sysmem.c.obj CMakeFiles/Nucleo_RS485Test.dir/Core/Src/system_stm32l4xx.c.obj CMakeFiles/Nucleo_RS485Test.dir/Core/Src/usart.c.obj CMakeFiles/Nucleo_RS485Test.dir/Core/Startup/startup_stm32l432kcux.s.obj CMakeFiles/Nucleo_RS485Test.dir/Core/ThreadSafe/newlib_lock_glue.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_dma.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_exti.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_gpio.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_lptim.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_rcc.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_usart.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_utils.c.obj -o Nucleo_RS485Test.elf   && cmd.exe /C "cd /D D:\CVSSource\ARM\Nucleo\Nucleo_RS485Test\build\debug\build && C:\ST\STM32CubeIDE_1.11.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.100.202210260954\tools\bin\arm-none-eabi-size.exe D:/CVSSource/ARM/Nucleo/Nucleo_RS485Test/build/debug/build/Nucleo_RS485Test.elf && cd /D D:\CVSSource\ARM\Nucleo\Nucleo_RS485Test\build\debug\build && C:\ST\STM32CubeIDE_1.11.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.100.202210260954\tools\bin\arm-none-eabi-objcopy.exe -O ihex D:/CVSSource/ARM/Nucleo/Nucleo_RS485Test/build/debug/build/Nucleo_RS485Test.elf Nucleo_RS485Test.hex && cd /D D:\CVSSource\ARM\Nucleo\Nucleo_RS485Test\build\debug\build && C:\ST\STM32CubeIDE_1.11.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.100.202210260954\tools\bin\arm-none-eabi-objcopy.exe -O binary D:/CVSSource/ARM/Nucleo/Nucleo_RS485Test/build/debug/build/Nucleo_RS485Test.elf Nucleo_RS485Test.bin""
[build] 'cmd.exe' is not recognized as an internal or external command,
[build] operable program or batch file.
 

Excerpt from ninja:

# =============================================================================
# Link build statements for EXECUTABLE target Nucleo_RS485Test


#############################################
# Link the executable Nucleo_RS485Test.elf

build Nucleo_RS485Test.elf: C_EXECUTABLE_LINKER__Nucleo_RS485Test_Debug CMakeFiles/Nucleo_RS485Test.dir/Lib/TimedRun/TimedRun.c.obj CMakeFiles/Nucleo_RS485Test.dir/Core/Src/dma.c.obj CMakeFiles/Nucleo_RS485Test.dir/Core/Src/gpio.c.obj CMakeFiles/Nucleo_RS485Test.dir/Core/Src/lptim.c.obj CMakeFiles/Nucleo_RS485Test.dir/Core/Src/main.c.obj CMakeFiles/Nucleo_RS485Test.dir/Core/Src/stm32l4xx_hal_msp.c.obj CMakeFiles/Nucleo_RS485Test.dir/Core/Src/stm32l4xx_it.c.obj CMakeFiles/Nucleo_RS485Test.dir/Core/Src/syscalls.c.obj CMakeFiles/Nucleo_RS485Test.dir/Core/Src/sysmem.c.obj CMakeFiles/Nucleo_RS485Test.dir/Core/Src/system_stm32l4xx.c.obj CMakeFiles/Nucleo_RS485Test.dir/Core/Src/usart.c.obj CMakeFiles/Nucleo_RS485Test.dir/Core/Startup/startup_stm32l432kcux.s.obj CMakeFiles/Nucleo_RS485Test.dir/Core/ThreadSafe/newlib_lock_glue.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_dma.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_exti.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_gpio.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_lptim.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_rcc.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_usart.c.obj CMakeFiles/Nucleo_RS485Test.dir/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_utils.c.obj
FLAGS = -g
LINK_FLAGS = -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -T D:/CVSSource/ARM/Nucleo/Nucleo_RS485Test/STM32L432KCUX_FLASH.ld
OBJECT_DIR = CMakeFiles\Nucleo_RS485Test.dir
POST_BUILD = cmd.exe /C "cd /D D:\CVSSource\ARM\Nucleo\Nucleo_RS485Test\build\debug\build && C:\ST\STM32CubeIDE_1.11.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.100.202210260954\tools\bin\arm-none-eabi-size.exe D:/CVSSource/ARM/Nucleo/Nucleo_RS485Test/build/debug/build/Nucleo_RS485Test.elf && cd /D D:\CVSSource\ARM\Nucleo\Nucleo_RS485Test\build\debug\build && C:\ST\STM32CubeIDE_1.11.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.100.202210260954\tools\bin\arm-none-eabi-objcopy.exe -O ihex D:/CVSSource/ARM/Nucleo/Nucleo_RS485Test/build/debug/build/Nucleo_RS485Test.elf Nucleo_RS485Test.hex && cd /D D:\CVSSource\ARM\Nucleo\Nucleo_RS485Test\build\debug\build && C:\ST\STM32CubeIDE_1.11.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.100.202210260954\tools\bin\arm-none-eabi-objcopy.exe -O binary D:/CVSSource/ARM/Nucleo/Nucleo_RS485Test/build/debug/build/Nucleo_RS485Test.elf Nucleo_RS485Test.bin"
PRE_LINK = cd .
TARGET_FILE = Nucleo_RS485Test.elf
TARGET_PDB = Nucleo_RS485Test.elf.dbg


#############################################
# Utility command for edit_cache

build CMakeFiles/edit_cache.util: CUSTOM_COMMAND
COMMAND = cmd.exe /C "cd /D D:\CVSSource\ARM\Nucleo\Nucleo_RS485Test\build\debug\build && C:\Users\Sean\AppData\Roaming\Code\User\globalStorage\ms-vscode.vscode-embedded-tools\vcpkg\root\downloads\artifacts\vcpkg-ce-default\tools.kitware.cmake\3.20.1\bin\cmake-gui.exe -SD:\CVSSource\ARM\Nucleo\Nucleo_RS485Test -BD:\CVSSource\ARM\Nucleo\Nucleo_RS485Test\build\debug\build"
DESC = Running CMake cache editor...
pool = console
restat = 1

build edit_cache: phony CMakeFiles/edit_cache.util


#############################################
# Utility command for rebuild_cache

build CMakeFiles/rebuild_cache.util: CUSTOM_COMMAND
COMMAND = cmd.exe /C "cd /D D:\CVSSource\ARM\Nucleo\Nucleo_RS485Test\build\debug\build && C:\Users\Sean\AppData\Roaming\Code\User\globalStorage\ms-vscode.vscode-embedded-tools\vcpkg\root\downloads\artifacts\vcpkg-ce-default\tools.kitware.cmake\3.20.1\bin\cmake.exe --regenerate-during-build -SD:\CVSSource\ARM\Nucleo\Nucleo_RS485Test -BD:\CVSSource\ARM\Nucleo\Nucleo_RS485Test\build\debug\build"
DESC = Running CMake to regenerate build system...
pool = console
restat = 1

build rebuild_cache: phony CMakeFiles/rebuild_cache.util

# =============================================================================
# Target aliases.

build Nucleo_RS485Test: phony Nucleo_RS485Test.elf

SRyan.2
Associate
November 19, 2023

I am getting this same error, did you find anything?

Pavel A.
Super User
November 19, 2023

So it looks like ninja loses or corrupts the normal Windows PATH and cannot find cmd.exe. Sorry, don't have time to dig into this further.