cancel
Showing results for 
Search instead for 
Did you mean: 

Same codebase across multiple projects

po221
Senior

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

1 ACCEPTED SOLUTION

Accepted Solutions

As I said, drag and drop, choose linked.

0693W00000JNomqQAD.png

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

7 REPLIES 7
KnarfB
Principal III

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

po221
Senior

'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

TDK
Guru

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.

If you feel a post has answered your question, please click "Accept as Solution".
po221
Senior

@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

You're right with git submodules. Actually, I prefer the repo tool for mixing git repos.

As I said, drag and drop, choose linked.

0693W00000JNomqQAD.png

If you feel a post has answered your question, please click "Accept as Solution".

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.