Skip to main content
Associate II
March 31, 2026
Question

Recommendations for reusing Drivers and Middlewares In Repo

  • March 31, 2026
  • 2 replies
  • 203 views

Hi all,

What is the recommended way to not crush our repository and dynamically pull/generate the project's Drivers and Middleware folders?  For instance, our repository has both Bootloader + Application code projects in a repo (and other MCU projects/layouts for the same board).

Is there something similar to Platform.IO (or C#'s NuGet packages) where the platform maintains those 3rd-party files in a volatile location and pulls them if they don't exist on your machine? Especially for the sake of not checking into the repo duplication of +15 MB worth of files for each project.

Please excuse me if this was already asked. I didn't quite find a solid answer.

I'm ok with making a command line script that auto-pulls them too, if that's a possibility.

2 replies

Pavel A.
Super User
March 31, 2026

Git isn't the only version control system known to the humankind. There is another sort of source/version control which constructs "virtual" source tree views from sparse sources located elsewhere. For example: Perforce, Synergy, Clearcase.

Even git has ways to check out a subtree to minimize the size of working directory (git subtree, submodules) or share a repo with another working directory (git worktrees)  There are tools like Google's "repo", Bazel and others.

 

SuessAuthor
Associate II
April 1, 2026

Hi @Pavel A., you bring up a good point for other future viewers regarding other version control systems.

Like many organizations, our official repository is Git. Yes, we are using the Submodules feature to circumvent this. My inquiry was primarily for, is there an STMicro method for doing such actions?  For instance, MPLab reuses cached common libraries across projects as well to an extent

Pavel A.
Super User
April 1, 2026

If you've noticed, CubeMX (and CubeIDE 1.x) gives the user option to link the project to shared drivers & middlewares files in the "repository" instead of copying them into the project tree. So these components can be shared across projects.

 

Andrew Neil
Super User
April 3, 2026

Here's how I share common code between Projects:

https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/same-touchgfx-project-for-multiple-cubemx-files-in-the-same/m-p/672534/highlight/true#M37503

 

To be honest, I prefer to have Projects self-contained.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.