16FXlib
Introduction on how to use the library

This page covers the different ways how to use the library in your own projects under Eclipse. Other IDEs probably provide similar methods for doing so. There are basically three options to choose from:

  1. Linked source directories
  2. Library as static library
  3. Copying the library's code to the project


Option 1: Linked source directories

This is the preferred choice since on one hand the library is kept separately and can be used by all projects and on the other hand the library code is compiled with the project so the settings of the project will be applied to the library code too.

  1. Create a project for the processor includes
    1. "File" -> "New" -> "Project" -> "General" -> "Project"
      1. Select a project name (e.g. "mb96348includes")
      2. Select the path where the processor includes are located
      3. Press "Finish"
  2. Create a project for the library
    1. "File" -> "New" -> "C Project"
      1. Select a project name (e.g. "library")
      2. Select the path where the library code is located
      3. "Project type" is not important. "Static Library" with the appropriate controller is suggested so you can also compile the library on its own to find errors.
      4. Press "Finish"
    2. If you want to be able to compile the library on its own:
      1. Open the properties of the new project (right click on the project name in the project explorer -> "Properties")
      2. Go to "C/C++ Build" -> "Settings"
        1. In the inner tree navigate to "Fujitsu C Compiler" -> "Include Path"
        2. Add the "mb96348includes" project from the workspace
        3. Press "Apply" and close the dialog
  3. Create your own project
    1. "File" -> "New" -> "C Project"
      1. Select a project name (e.g. "demo")
      2. Select a path where you want your project to be stored or leave "Default Location" enabled
      3. Select "Fujitsu LX Executable" as "Project type" and the appropriate controller from the "Toolchain" list.
      4. Press "Finish"
    2. Setup the project
      1. Open the properties of the project (right click on the project name in the project explorer -> "Properties")
      2. Go to "C/C++ Build" -> "Settings"
        1. In the inner tree navigate to "Fujitsu C Compiler" -> "Include Path"
        2. Add the "mb96348includes" project from the workspace
        3. Add the "library" project from the workspace
        4. Press "Apply"
      3. Go to "C/C++ General" -> "Paths and Symbols"
        1. Switch to the tab "Source Location"
        2. Press "Link Folder..."
          1. Select a folder name (e.g. "mb96348")
          2. Open the "Advanced" area and enable "Link to folder in the file system"
          3. Browse to the path where the processor include files are stored
          4. Press "OK"
        3. Repeat the steps for the library folder
        4. "Apply" and close the dialog


Option 2: Library as static library

In this setup the library is packed as a static library. It is the more "professional" way but has the disadvantage that changes to the compiler/linker settings of the project will not be reflected in the library.

  1. Follow the steps of Option 1 up to 3.b.iii.B (do not execute 3.b.iii.C). Steps from 2.b are important this time!
  2. Go to "C/C++ Build" -> "Settings" => "Fujitsu C Linker" -> "Libraries"
    1. Add "library" (adapt it to the name you gave the library project) to the upper box "Libraries -l"
    2. Add the "Release" folder from the "library" project to the lower box "Library search path"

Hint: If you do any changes to the library code you have to recompile the library before the changes will be propagated to new compiler runs on the main project.


Option 3: Copying the library's code to the project

This is the easiest and fastest way to set up but can get quite confusing because of all the files in the project. It also is harder to maintain if you got multiple projects and each of them contains a copy of the library code.

  1. Copy all .c/.h files from the library folder to the source root of your project
  2. Copy the processor include files to your source root