**** Advance Notice ****

This site will be closed on 31 December 2015,

Important Information for users of NXP LPCXpresso

This site is for users of Code Red branded products.

NXP LPCXpresso users should visit the LPCXpresso FAQ's for up-to-date information relevant to that product.

Exactly one page like "StaticLibrarySupportv4" found, redirecting to page.

Clear message

Target MCU selection for static library projects

When creating a static library project, it is necessary to select a specific target MCU (for example LPC1768 or LPC1114/301). However this selection basically only controls the CPU used by the compiler/assembler (for example Cortex-M3 or Cortex-M0). This contrasts with "application projects" where the target MCU also controls linker options (in particular the linker script used when generating the final executable) as well as the debug connection.

Sometimes you may want to create a static library project which can be used on multiple different MCUs without being rebuilt. Where the MCUs are in the same family (for example LPC1758 and LPC1768), this is normally straightforward - typically just choose any MCU within the MCU family.

Where the MCUs are in different families (for example LPC1768 and LPC1343, which both use Cortex-M3), then in some cases it may still be possible to produce a library project suitable for use on all the MCUs of interest. However typically in such cases, much more care is required due to differences in peripherals, associated CMSIS projects, etc.

In extreme cases, it is actually possible to generate libraries that may work for MCUs based on different CPUs. This may be achieved in a couple of ways.

First of all, it is possible to create a different built configuration for each CPU/MCU - by modifying the target CPU in the compiler/assembler properties for each build configuration. Again care is required because of differences in peripherals, associated CMSIS projects etc.

Secondly, you could simply create a library project which uses the "lowest common denominator" MCU. Thus a library created for a Cortex-M0 based part may also be usable on a Cortex-M3 based part (again allowing for differences in peripherals, CMSIS projects,etc). This is because the instruction set used by Cortex-M0 is a subset of that for Cortex-M3. However the reverse does not apply - a Cortex-M3 targeted library will not be suitable for use on a Cortex-M0 based part.