2022-01-24 05:54 AM
Hello
I'm using STM32cubeide with STM32L
I have several applications that are based on the same code base.
What are the good solution(s) to handle this common code with stm32cubeide?
I can consider several solutions, one application = one project or one project for all applications (how? not too dirty ?), codebase like a library (how ?)... what else ?
All applications/projects are for the same target.
thanks
Solved! Go to Solution.
2022-01-29 07:32 AM
As I said, drag and drop, choose linked.
2022-01-24 07:34 AM
If you are using git or other source control, its straightforward to use several projects (==several git repositories) plus one extra repository for the common codebase. For git, this could be a submodule. This works well as long as the common codebase sits in a dedicated folder of your project(s). You can easily pin specific commits of your common codebase in individual projects for reproducible builds.
Note that modern compilers support whole program optimization and source-level debugging is easier if you have all sources in one project.
I would consider a static library only if I want to sell the stuff without sources, or the compilation time of the common codebase is hindering and the common codebase is already stable enough to allow binary (library) releases. STMCubeIDE can create and use static libraries.
hth
KnarfB
2022-01-24 08:02 AM
'Note that modern compilers support whole program optimization and source-level debugging is easier if you have all sources in one project.'
it's a strong argument ! -> no library.
I look at the git submodules... it requires a bit of reading
thanks
2022-01-24 09:44 AM
You can add source or header files as linked files and they will be included in the project. Drag and drop will let you do this.
I don’t like sharing code between projects unless it is third party code that won’t change.
2022-01-28 02:57 PM
@TDK
what do you mean by linked file?
for the git submodule I am doubtful; it's oribly complex from a git point of view
2022-01-29 04:13 AM
You're right with git submodules. Actually, I prefer the repo tool for mixing git repos.
2022-01-29 07:32 AM
As I said, drag and drop, choose linked.
2022-01-29 09:16 AM
it's enormous, thnaks !
I have yet to see how I can handle all of this (versions in the code base???) but it's a simple way to have that code base.