LPCXpresso version 6 is available. Installing it is as easy as installing version 5.
Slight modification of the default configuration, as I prefer using Chrome instead of Safari: in LPCXpresso / Preferences... / General / Web Browser, I add Chrome, with %URL% as parameter.
Another modification: I configure my own source file header comment, using LPCXpresso / Preferences... / C/C++ / Editor / Templates / comment (on OS X. I guess on Windows, it's Window / Preferences... / ...)
Having developed my first (small, simple) functional project, I need now to spend some time in looking at fundamental characteristics of the LPC1115 I use. Writing code for microcontrollers is far from being something new for me. But that's the first time I use an ARM-based microcontroller. Before going further with projects I have in mind, I want to thoroughly understand its distinctive features. Only then, I'll adapt my cooperating components design pattern, and go on with my projects.
LPC1115 is a Cortex-M0 based MCU. The Cortex-M0 core implements ARMv6 architecture. So, I'll use following documents as reference ones:
ARMv6-M architecture reference manual states that following processor accesses are atomic:
Cortex-M0 generic user guide provides some information about how to ensure atomicity of a code sequence: disable the handling of exceptions by the processor. To do this, MRS and MSR instructions, or CPS instruction can be used to modify PRIMASK register. Only exceptions with configurable priority are disabled: Reset, NMI and HardFault can't be disabled.
For this point, Application Note 312 seems to be the most valuable document. It provides following information:
DMB
is redundant due to the inherent ordering of all loads and stores on the Cortex-M0.To summarize: memory barrier instructions are supported on the Cortex-M0, in order to provide code compatibility for higher end processors. There is no need to use such instructions, as long as code is OK with following architecture characteristics:
CPSIE
instruction and a following CPSID
instructionMSR
side-effects are visible after one further instruction is executed.In case of any doubt while writing some code, refer to section 4 of the Application Note.
According to LPC111x Data Sheet:
system_LPC11xx.c defines SystemCoreClock as being 48000000. It uses the system PLL to boost the external crystal frequency (12 MHz) to 48 MHz. See this page for an explanation of how the PLL is configured, easier to understand than the one in the User Manual. LPC_SYSCON->SYSAHBCLKDIV is set to 1.
I have now to go on working on the project I initiated with 5.2 version. Before importing it, I import the right CMSIS core library, from the archive file that can be found in the Examples folder: /Applications/lpcxpresso_6.0.2_151/lpcxpresso/Examples/NXP/LPC1000/LPC11xx/LPC11xx_LatestCMSIS_Libraries.zip (I use the LPC1115 - the path is for OS X installation).
This LPC11xx version is derived from ARM's CMSIS version 3.20. Provided files are summarized here.
Using File / New / LPCXpresso C Project, I create an LPC11xx C Project (Semihosted), using the project wizard. I choose to disable Code Read Protect. Once this empty project is created, I copy source files from my 5.2 project into this new project. That's it!
After having spent some time testing and debugging my first application, I wanted to generate a production release, and to flash it. I found this way: