Buildspy works by serving as an intermediary for the build system. Its a good option for generating an accurate Understand project when other options like Build Watcher, CMake, or Bear are not available. Here is how we got STM32 IDE, which is based on Eclipse, working with Buildspy.


  • In STM32 IDE, duplicate existing config, I created the "Buildspy" config
  • Disable the "Use default build command" (which by default is "make"), and set it to "..\buildspy.bat":



In Windows explorer, create "buildspy.bat": 


  • The file buildspy.bat" is simply a batch (.bat) script in the dir above the "Buildspy" config working dir. I had to resort to that because setting the command directly in the IDE text box did not work as soon as I started adding multiple options to the command.
  • The batch file contains a single line: buildspy.exe -db undproject.und -cc arm-none-eabi-gcc -cmd "make %1" 
    Using %1 is great because it means when I clean the project and the project actually gets cleaned.
  • In C/C++ build settings, edit the toolchain compiler binary to "gccwrapper.exe":



I couldn't get STM32 IDE to give up its compiler_prefix, so I duplicated the gccwrapper.exe binary to "arm-none-eabi-gccwrapper.exe" in Understand's Buildspy install dir: 



After building the project using my "Buildspy" config in STM32 IDE, I have my undproject.und: 



Setting compiler related settings in Understand. But it is still missing some system includes: 




Use "arm-none-eabi-gcc.exe -xc -E -v -" to get the list of system include search paths. On my side it gave:


:sysroot:
C:\Program Files\ST\STM32CubeIDE_1.10.1\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi
<...> include search list:
c:\program files\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\bin\../lib/gcc/arm-none-eabi/10.3.1/include
c:\program files\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\bin\../lib/gcc/arm-none-eabi/10.3.1/include-fixed
c:\program files\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\bin\../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/include

After setting the sysroot in Understand the missing include is resolved so in that case the logic to discover the include path automatically worked fine: