Setting up a STM32 solution with a shared library and multiple projects

912 views Asked by At

I am using Rowley CrossWorks as my IDE.

I have several STM32 projects created with STM32CubeMX which have several files that are shared as of now, by copying the source folder into each projects "src" folder.

This is obviously not an ideal solution.

How do I best merge the projects together, so that I can build the individual projects, with the same common files referenced? Preferably where the “drivers” folder and “inc” folder is also share from a common location.

2

There are 2 answers

0
Henrik Rune Jakobsen On

I have found a solution

i put the app specific code in a folder in the src folder. e.g \src\ and \src\appX \src\appY

Each solution is put into the MDK-ARM folder and then i edit the project file

<folder Name="Application/User">
  <file file_name="../Src/AppX/main.c" />

  <file file_name="../Src/AppX/settingsHandler.c" />
  <file file_name="../Src/AppX/settingsHandler.h" />
  <file file_name="../Src/AppX/cryptography.c" />
  <file file_name="../Src/AppX/cryptography.h" />

...

<folder Name="Application/User">
  <file file_name="../Src/AppY/main.c" />

  <file file_name="../Src/AppY/blah.c" />
  <file file_name="../Src/AppY/blah.h" />
  <file file_name="../Src/AppY/foo.c" />
  <file file_name="../Src/AppY/foo.h" />
3
0___________ On

It is time to learn version control - the most popular and free is git

Git user manual

Your common libraries - GIT submodules.