2024-01-05 9:06 AM
Hi, my team works with STM32CubeIDE and shares projects via github. We've been running into somewhat frequent errors where projects settings don't get shared properly when pulling the files down from github. On the flipside, there are a bunch of automatically generated files that change frequently with builds, code generation, etc, that bloat the git log unnecessarily if they are shared.
Is there a standard gitignore that we should be using for STM32CubeIDE projects. Are there any rules of thumb for how to set up stuff like project folder structure, project variables, etc, such that they get properly shared?
2025-08-15 3:58 AM - edited 2025-08-15 4:55 AM
@sominlee wrote:Hi, I found a web page about github setting for STM32CubeIDE projects, and .gitignore example. I think it's not bad.
https://tavotech.com/how-to-use-github-with-stm32cubeide/
Not specific for STM32 and not complete either. Especially if you use TouchGFX. It's also redundant as excluding all build folders means you don't need to exclude specific build artifacts.
Here is our .gitignore:
# winmerge backup files
*.bak
# STM32CubeIDE build folders
Debug/
Release/
#TouchGFX build artifacts, screenshots, cache, backups from migration, visual studio, etc.
TouchGFX/build/
TouchGFX/config/*
TouchGFX/generated/user.config
TouchGFX/*_backup.touchgfx
TouchGFX/simulator/msvs/.vs/
TouchGFX/simulator/msvs/enc_temp_folder/
TouchGFX/simulator/msvs/screenshots/
TouchGFX/screenshots/
TouchGFX/generated/fonts/cache/
TouchGFX/generated/texts/cache/
TouchGFX/assets/texts/translations.xlsx
Middlewares/ST/touchgfx_backup*
*.vcxproj.user
# if you want to exclude TouchGFX libs for all non M7 MCUs:
Source/Middlewares/ST/touchgfx/lib/core/*
!Source/Middlewares/ST/touchgfx/lib/core/cortex_m7/
Source/Middlewares/ST/touchgfx/lib/core/cortex_m7/*
!Source/Middlewares/ST/touchgfx/lib/core/cortex_m7/gcc/
Source/Middlewares/ST/touchgfx/lib/core/cortex_m7/gcc/libtouchgfx.a
# do not track user specific settings, but keep prefs to avoid eclipse encoding warning
.settings/*
!.settings/org.eclipse.core.resources.prefs
Also note that when building the project in TouchGFX Designer it screws up the .cproject file. This issue is still not fixed. This will result in unwanted changes in your gitrepo unless you revert it (or change project settings in STM32CubeIDE so it regenerates the XML file). https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/touchgfx-designer-adds-redundant-line-ending-to-cproject-file/td-p/674111