How to create a library project and use it in executable project

From SEGGER Wiki
Revision as of 14:00, 7 August 2019 by Nino (talk | contribs) (Setup Guide)
Jump to: navigation, search

SEGGER Embedded Studio can not only be used to create executable projects but also library projects can be created. This article will show how a library project can be created in the same solution as an executable project and being used in the latter.

Example Setup

The setup guide will be based on the following software component:

  • Embedded Studio V4.18 or later

The example project can be found here: SES_Library_Example

Setup Guide

  1. Create a new executable project in a new solution for your target device
  2. Create a new library project in the same solution
  3. Add your library .c and .h files to the library project and build the library
  4. Create a new folder in the executable project and call it e.g. Lib/
  5. Drag & Drop the newly build library into the newly created Lib/ folder
  6. Use the library functions in your executable main application
  7. In Project Settings under Code->Build->Project Dependencies set the executable project to be dependent of the library project. This ensures that the library project will always be build before the executable project.
  8. Build and run the executable application with your new library