The use of LPCOpen is now recommend for most LPC MCUs, rather than the 'old-style' CMSIS-CORE library projects and examples. For more details please see the LPCXpresso IDE User Manual, and visit the LPCOpen webpages.
CMSIS - the Cortex Microcontroller Software Interface Standard - was originally a specification defined by ARM for Cortex-M based systems to provide:
However, CMSIS has now expanded to encompass a number of other specifications (such as CMSIS-DSP), and its original focus as described above is now known as CMSIS-CORE.
By using CMSIS compliant software components, ARM's aim was that the user would be able to more easily re-use template code; CMSIS is intended to enable the combination of software components from multiple middleware vendors. Note that CMSIS is focussed on Cortex-M based MCUs. It does not support ARM7 or ARM9 based MCUs. More information on CMSIS plus the full CMSIS releases can be found at: http://www.arm.com/cmsis
The standard CMSIS documentation can also be found within the LPCXpresso IDE's built in help.
A number of releases of CMSIS have been made, though generally, for most users, there is actually very little functional differences between different CMSIS-CORE versions. The main versions (and the changes included in them) of relevance to LPCXpresso users at the current time are:
For details of the latest CMSIS releases please visit ARM's website.
Note: For details of the support for CMSIS-DSP in LPCXpresso IDE, please see the FAQ "CMSIS DSP Library Support".
Within the LPCXpresso IDE examples subdirectory for a particular Cortex-M based MCU family, you will typically find one or more CMSIS library projects. Each of these CMSIS library projects contain the appropriate CMSIS header files and source code for that specific MCU family
Note that these library projects do NOT typically provide actual driver code for the peripherals on the MCU. Peripheral drivers will be provided through example code or peripheral driver libraries. Some example code and driver libraries do have the word CMSIS in their titles though, which sometimes causes confusion. This simply refers to the fact that the code has been written to use the CMSIS way of accessing the peripherals.
However where more than one library version exists for your target MCU family, you should typically use the latest version, though you may need to take into account the library version used by any other library projects that your application project will make use of.Typically CMSIS library project names are of the form:
The CMSIS library option within the LPCXpresso IDE project wizards allows you to select which (if any) CMSIS library you want to link to from the project that you are creating. Note that the appropriate CMSIS library project must have been imported into the workspace before starting the wizard, otherwise an error will be given when the wizard attempts to create your project.
Note As of LPCXpresso 6, CMSIS 3.20 based CMSIS-CORE library projects are now provided and supported in the project wizards, although many supplied example projects still build against earlier versions of the CMSIS-CORE library projects.
A summary of the source files within the library is as follows...
One thing that CMSIS provides is a set of headers defining the peripheral set of the MCU family that you are using. For example, the following code taken from an LPC1768 example enables the A/D converter:
#include "LPC17xx.h" // PCADC / PCAD #define ADC_POWERON (1 << 12) #define PCLK_ADC 24 #define PCLK_ADC_MASK (3 << 24) // AD0.0 - P0.23, PINSEL1 [15:14] = 01 #define SELECT_ADC0 (0x1<<14) : // Turn on power to ADC block LPC_SC->PCONP |= ADC_POWERON; // Turn on ADC peripheral clock LPC_SC->PCLKSEL0 &= ~(PCLK_ADC_MASK); LPC_SC->PCLKSEL0 |= (3 << PCLK_ADC); // Set P0.23 to AD0.0 in PINSEL1 LPC_PINCON->PINSEL1 |= SELECT_ADC0; :
It also provides access to functionality contained within the Cortex-M processor core. For example, the below code snippet enables the SysTick timer built into most Cortex-M class by MCUs:
// Setup SysTick Timer to interrupt at 1 msec intervals if (SysTick_Config(SystemCoreClock / 1000)) { while (1); // Capture error }