Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


several projects with same drivers

Hi!

How is the best way to create several projects that share the same Drivers/libraries?
Assuming that the project tree is composed of 3 different sub-projects:
/Project1
/Project2
/Project3
/Drivers

I guess I should play with the include and library paths in: Properties -> C/C++ Build -> Settings -> MCU GCC Compiler -> Includes.
So all projects (1, 2 and 3) shall include the correct path to the upper “Drivers” folder.

Is there any other recommended way?
I tried to do something as explained before but for some reason the drivers were not found.

Regards!
yuroscm

France

Hi,

You should create a Static Library project for the same board/MCU with your drivers and three application projects for your applications. All projects should be created by importing the firmware libraries as static external libraries.

In this project create two folders: inc for header files and src for source files; then in Project >> Properties >> C/C++ General >> Paths and Symbols >> Includes add (for all languages and configuration) the workspace path to your inc directory (You can also use the ProjDirPath Eclipse variable by typing ${ProjDirPath}/inc in the Directory field of the Add dialog)

Then, for each application project, go in Project >> Properties >> C/C++ General >> Paths and Symbols >> References and select the library project created first. As the include files are not in the root folder of the library project you must also go in Project >> Properties >> C/C++ General >> Paths and Symbols >> Includes and add (for all languages and configurations) the workspace path to the inc directory of your library

Then when you build your applications SW4STM32 should automatically build first your library, then your application, linked with your library.

Hope this helps,

Bernard (Ac6)


Hi Bernard,

Thanks for your response. Before I read your suggestion I achieved to use the same drivers as external folders by changing Project >> Properties >> C/C++ General >> Paths and Symbols >> Includes in all the three projects. Basically adding ../ to the current path I was using. That applies for all languages and configuration. Besides (and this is what I didn’t do when it failed) I had to add the source location manually in Project >> Properties >> C/C++ General >> Paths and Symbols >> Source Location. Then it worked so I am currently using the same folder for the three projects. I hope this can be useful for other users too.

Anyway, I’ll try to implement the static libraries you mentioned as soon as I have time for that. Because it looks like a better way to keep track of external libraries.

Thanks for the support!
yuroscm


Hi Bernard,

I finally followed your suggested steps and it works.
Thank you

Best regards
yuroscm


 

Newest Forum Posts

  1. Можно ли установить камин на балконе или лоджии? by Grand3kpdErorb, 03:38
  2. reservation car service Seattle by Jamesprede, 2025-05-01 10:06
  3. Last day: drone bonus by Danielrug, 2025-04-19 16:55
  4. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  5. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  6. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  7. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  8. Insightful Perspectives on This Subject by davidsycle, 2025-03-04 05:45
  9. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  10. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05

Last-Modified Blogs