Skip to content

Conversation

@multiplemonomials
Copy link
Collaborator

@multiplemonomials multiplemonomials commented Dec 4, 2025

Summary of changes

This adds a CMake script which can manage submodules in the repository. It is designed to improve the user experience in several different ways over just having the user manually manage submodules:

  1. Only clone the submodules if CMake determines we actually need them. This can save a lot of disk space by not checking out stuff like STM32Cube HALs for chips that the user is not using.
  2. Clone the submodules automatically without the user having to run git submodule update or git clone --recursive. This is both for backwards compatibility and convenience.
  3. Print a helpful error if the submodule is needed but not cloned.
  4. Clone submodules shallowly by default, but provide a way to disable this
  5. Detect if a submodule is out of date (as in, we updated the commit but the user didn't run git submodule update) and fix this automatically, as long as there are no local changes

As a "test run" for this PR, I updated the STM32U0 HAL to use a submodule, as this is a directory that is already available on github and that we don't seem to have made any local modifications to

Impact of changes

  • Submodule manager script added
  • STM32U0 HAL and headers removed from Mbed source tree and made into submodules (significant repo size decrease!)

Migration actions required

Documentation


Pull request type

[] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[X] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

@multiplemonomials multiplemonomials changed the title [draft] Add submodule manager script Add submodule manager script Dec 6, 2025
@JohnK1987 JohnK1987 merged commit 3e14eb5 into master Dec 6, 2025
50 checks passed
@JohnK1987 JohnK1987 deleted the dev/add-submodule-manager branch December 6, 2025 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants