| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Is using a library right for you?

Is using a library right for you?
The LPCOpen platform separates code into libraries and executable examples. A library is just a collection of files made into a non-executable library file. The executable examples can use the library to make project file management easier. A library is best used when you have lots of executable projects that depend on a common code base. This is best explained with an example.
Example:
Let's say you have 3 projects in your workspace called 'send', 'receive', and 'monitor'. Each project uses all the files for a specific Chip and Board layer plus the LWIP files (with a common configuration among all projects). You can create the 3 projects with all the necessary files added to the projects, but would most likely have to change all 3 of those projects if the necessary files for the Chip or Board layer, or LWIP code has changed. This would require going into each project and adding and removing files as needed. As the number of projects increases that depend on this same code base gets larger, the more projects that may need to change.

An alternative would be to place the code that is common amoong all of those projects into a common library project that generates a library file and uses the library file in the other projects instead of the individual files. If the common set of files changes, you only need to change the library project instead of each individual project. This would create a 4rth project file - library - that would be used by the send, receive, and monitor projects.

In LPCOpen, the Chip and Board layers are combined into a single 'board' library and used in other projects instead of the individual files.
Examples:

- Embedded Artists LPC4088 board library consists of LPC407x/8X Chip code + Chip common code + EA1788/4088 board code + Board common code + EA4088 sys_config.h
- Xpresso LPC1347 board library consists of LPC1347 Chip code + Chip common code + Xpresso LPC1347 board code + Board common code + Xpresso LPC1347 sys_config.h

USBLIB is also separated into one or more libraries (for example, separate host and device libraries) and used by other projects.

Where do I get a list of all LPCOpen code needed for a library?
LPCOpen library configurations

Toolchain handling of libraries
LPCOpen supports IAR EWARM, Keil UV4, and Xpresso toolchains. Knowing how the supported toolchains handle libraries can help in the decision to use them in your projects.

IAR EWARM and Keil UV4 toolchains can generate libraries in separate projects, but the projects that use those libraries don't have a dependenct relationship on the library project. This means that if you edit code that's part of the library (easy to do), you must manually switch to the library project and re-built it prior to rebuilding the project that uses the library.

Xpresso toolchains can generate libraries in separate projects and other projects the use that library can be setup with the library as a dependency, so the library project automatically gets rebuilt if code in thet library project changes. This is automatic even if only the project that uses the library is built, so there is not need to manually switch to the library project and rebuilt it. This only works if the project that uses the library has the library project setup as a project dependency.