Note: Page numbers followed by “f” and “t” indicate figures and tables respectively.
Access Permission field (AP field),
299, 299tAccidental switching to ARM
® state,
282Advanced High-performance Bus Lite (AHB™ Lite),
13, 166Advanced Microcontroller Bus Architecture (AMBA
®),
23, 32Advanced Peripheral Bus protocol (APB protocol),
166ALU status flags,
96, 96tApplication Interrupt and Reset Control Register (AIRCR),
93–94, 224, 224tApplication Program Status Register (APSR),
93, 117, 661Application Programming Interface (API),
42, 80, 141, 244Application Specific Standard Products (ASSPs),
, 47Application-Specific Integrated Circuits (ASICs),
1–2, 47Architecture Reference Manual (ARM),
23–24accidental switching to ARM
® state,
282Connected Community Web page,
25, 27fprocessor families,
5–8, 6fARM Architecture Procedure Call Standard (AAPCS),
608–610ARM
® Cortex
®-M processors,
315porting software from 8-bit/16-bit microcontrollers to
migration from 8051 to ARM Cortex-M0/Cortex-M0+,
639–641ARM
® Cortex
®-M programming,
64–74accessing peripherals in C,
65–69inside program image,
69–71microcontroller starts,
73–74ARM
® Keil
® Microcontroller Development Kit,
329ARM7TDMI™ processor,
, 642differences with Cortex®-M0/M0+ processor
register bank differences,
643fARM926EJ-S processors,
ARMv6-M architecture,
87–89program image and start-up sequence,
106–108programmer’s model
registers and special registers,
90–96ARMv6-M Architecture Reference Manual (ARMv6-M ARM),
38calling assembly functions from C codes,
618–619calling C functions from assembly,
617–618Assembly language, programming techniques for
allocating data space for variables,
628–630Assembly projects in Keil® MDK-ARM
Assembly wrapper
assembly language wrapper code,
283–284using embedded assembler in Keil
® MDK,
284–285for HardFault handler,
284fBit and bit field computations,
162–164Bit field clear operation,
164fBit field extract operation,
163fBrown Out Detector (BOD),
186, 522Bufferable attribute,
177Bufferable field (B field),
299–300Byte-Invariant big endian mode,
174C codes, calling assembly functions from,
618–619optimization levels,
397taccessing peripherals in,
65–69C/C++ with assembly
accessing special instructions
CMSIS-CORE functions,
631assembly
code for interrupt control,
624–627Embedded Assembler feature,
616–617Central Processing Units (CPUs),
Circular buffer mode,
325for OS kernel management,
572tfor thread management,
573tCompare and branch if not zero (CBNZ),
653Compare and branch if zero (CBZ),
653
Complementary Metal Oxide Semiconductor (CMOS),
22without PendSV exception,
259fwith PendSV exception,
260fdebug configurations,
453fdebug session screen,
456foutput configurations,
453fproject name and path,
449fCoreSight Technical Introduction,
320CoreSight™ debug connector,
147Cortex Microcontroller Software Interface Standard (CMSIS),
78, 79t, 502, 620, 685core registers access functions,
57–58exception enumeration,
55–56Keil MDK project with,
333fnested vectored interrupt controller access functions,
56–57system
and SysTick access functions,
57system level and debug features,
12thigh-level architecture comparison,
648tCortex-M1 processors, porting software between Cortex
®-M0/M0+ processors,
656porting software between Cortex
®-M0/M0+ processors,
657–659Cortex-M4/M7 processor, porting software between Cortex
®-M0/M0+ processors,
659–660Cortex-M7 processor,
Cortex-R processors,
ARMv6-M architecture,
37–38CMSIS functions support for,
632tporting software
software portability,
38–39Count leading zero (CLZ),
653Cross Module Optimization operation,
398Data
bit and bit field computations,
162–164bit field clear operation,
164fbit field extract operation,
163funsigned integer divide function,
160fspace allocation for variables,
628–630data size conversion,
157Data Memory Barrier instruction (DMB instruction),
227, 308Data Synchronization Barrier instruction (DSB instruction),
227, 308, 512Data Watchpoint and Trace unit (DWT unit),
655
Debug connector arrangements,
147legacy 20-pin IDC connector arrangement,
147–14810-pin Cortex
® debug connector,
147, 151fDebug Exception and Monitor Control Register (DEMCR),
111–112debug components in Cortex
®-M0/Cortex-M0+ microcontrollers,
322fconnection inside processors,
319fCoreSight
® debug architecture,
319–320design considerations with,
320Serial Wire Debug Communication Protocol,
317–319Debug registers
in Cortex
®-M0 and Cortex-M0+ processors,
109Device Under Test (DUT),
530Direct Memory Access controller (DMA controller),
18–20, 36Dynamic Voltage and Frequency Scaling (DVFS),
525Embedded Application Binary Interface (EABI),
86, 609Embedded Microprocessor Benchmark Consortium (EEMBC),
48RTX configuration settings,
566fRTX_Config_CM.c customization,
604CPU, core, microprocessor,
2–3learning microcontroller programming,
programming on embedded systems,
3–4Embedded software program flows,
58–63combination of polling and interrupt driven,
60–61handling concurrent processes,
61–63Embedded Trace Macrocell (ETM),
655Embedded-application binary interface (EABI),
428Error Correction Code (ECC),
Error handling
during software development,
283–286in real applications,
283Event communication interface,
517–519Exception return instruction (EXC_RETURN instruction),
195–200acceptance of exception request,
194Cortex
®-M0 and Cortex-M0+ processors,
187–189vector fetch and update PC,
214exception-related instructions,
141–142
fetch and execute from return address,
215unstacking of registers,
215sequence
acceptance of exception request,
194exception return instruction,
195–196Executable attribute,
177eXecute Never field (XN field),
177, 299Execution program status register (EPSR),
93, 281Extend ordering operations,
135–137Fast Interrupt (FIQ),
644Fault handling
accidental switching to ARM
® state,
282comparison
in ARMv7-M architecture,
289in Cortex-M processors,
290faults triggering HardFault exceptions,
280tprogram address identification,
281fFerroelectric Random Access Memory (FRAM),
165–166Finite State Machine (FSM),
506First-In-First-Out (FIFO),
182Floating Point Context Active (FPCA),
650low-power modes on KL25Z,
533multipurpose clock generator operating states,
536fFrequency Locked Loop (FLL),
534General Purpose Input/Output modules (GPIO modules),
35Generic assembly code for interrupt control,
624enable and disable interrupts,
624–625set and clear interrupt pending status,
625–626setting up interrupt priority level,
626–627Generic wait function,
590ARM® embedded processors
using CooCox CoIDE with GNU tools for,
445–457using Keil
® MDK-ARM™ with GNU tools for,
438–445compilation switches,
435tproject with CMSIS-CORE,
430fassembly wrapper for,
284fto report stacked register values,
285Hardware behavior effect to programming,
180–183access to invalid addresses,
181using multiple load and store instructions,
181–182MTB instruction trace with,
421
project with CMSIS-CORE,
411fIdentification registers (ID registers),
87IF-THEN instruction (IT instruction),
653In-circuit debugger,
75–76In-System Programming (ISP),
186, 551Inline assembly
Inputs and outputs (I/Os),
57–58exception-related instructions,
141–142extend and reverse ordering operations,
135–137memory barrier instructions,
139–141moving data within processor,
120–121shift and rotate operations,
132–134sleep mode feature-related instructions,
142–143Instruction Set Architecture (ISA),
29Instruction Synchronization Barrier instruction (ISB instruction),
254, 308Instrumentation Trace Macrocell (ITM),
655Intellectual Properties (IP),
22Inter-Integrated Circuit interface (I2C interface),
500Internal Private Peripheral Bus (internal PPB),
169Internet of Things (IoT),
292, 460Interrupt Clear Enable Register (ICER),
87–89Interrupt program status register (IPSR),
93, 167, 212, 281Interrupt Set Enable Register (ISER),
87inputs and pending behavior,
207–212canceling of interrupt pending status,
209clearing of pending status,
209IRQ assertion for disabled interrupt,
211–212IRQ pulse during ISR execution,
210simple pulse interrupt handling,
208priority
Keil
® Microcontroller Development Kit (Keil MDK),
75, 329Configuration Wizard,
392fdebug session screen,
445fwith GNU tools for ARM
® embedded processors,
438–445project environment customizations,
393–399update gcc installation path,
440fbreakpoint insertion,
389fdebug session screen,
388fdebug session tool bar,
389fperipheral register display using CMSIS-SVD,
390fusing MTB for instruction trace,
404–407KL25Z128VL microcontroller,
533Learning microcontroller programming,
Legacy 20-pin IDC connector arrangement,
147–148Link Register (LR),
92, 126condition during exception sequences,
287fdevice benchmarking
EEMBC Energy Monitor,
530fapproaches to reducing power,
524–525consume power in microcontroller,
522tevent communication interface,
517–519low-power design practices,
523–524PRIMASK use with sleep,
237fSend-Event-on-Pend feature,
515–516with sleep entering methods,
232fLPC1114, low-power features on
Magnetoresistive Random Access Memory (MRAM),
165–166activities with simple OS,
253fCMSIS-CORE functions,
255tperipheral objects support,
467railway controller modeling,
471–476setting up FRDM-KL25Z board,
463–465
Memory Management Fault (MemManage fault),
312reserved memory space,
170Memory Protection Unit (MPU),
14, 30, 87, 99–100, 178, 219, 291–292, 559–560, 649, 670cache coherency in multiprocessor systems,
301fcomparison in Cortex
®-M3/M4/M7 processors,
312–313, 312tmemory barrier and configuration,
308–309Region Base Address Register,
297, 298tbus systems in Cortex
®-M0 and Cortex-M0+ processors,
166–167hardware behavior effect to programming,
180–183Little Endian and Big Endian support,
174–175program memory, boot loader, and memory remapping,
170–173Single Cycle I/O Interface,
99configuration via Configuration Wizard,
405fMicrocontroller development boards,
334Microcontroller Development Kit-ARM (MDK-ARM),
438MicroController Unit (MCU),
165new project creation,
339fproject setup steps
for NXP LPC1114FN28 microcontroller,
376–387for STMicroelectronics STM32F0 Discovery,
362–376for STMicroelectronics STM32L0 Discovery,
351–362Mixed language projects,
617calling assembly functions from C codes,
618–619calling C functions from assembly codes,
617–618Mixed signal microcontrollers,
46MTB instruction trace with IAR EWARM,
421Multiple load and store instructions,
181–182Multiply accumulate instructions (MAC instructions),
Multipurpose Clock Generator (MCG),
534
Nested function call,
152fNested Vectored Interrupt Controller (NVIC),
, 30, 170, 186, 189–190, 219, 482, 624, 636, 675control registers for interrupt control,
200interrupt enable and clear enable,
200–202flexible interrupt management,
104nested interrupt support,
104interrupt priority registers,
90–96vectored exception entry,
104Non-Volatile Memory (NVM),
165Nonexecutable attribute,
177Blinky. c for LPC1114FN28 on Breadboard,
379–381CMSIS-CORE selection and device-specific startup,
377fflash programming algorithm options,
384fflash programming status output,
386fLPC1114FN28/102 selection for DIP part,
376foptions for ULINK2/Cortex debug,
383fproject with start-up code,
377fULINK2/ME Cortex Debugger selection,
383fcontext switching, stack checking in,
670support features,
21, 243context switching in action,
267–277multitasking and context switching,
244fPendable Service Call (PendSV Call),
188Peripherals,
Personal Computer (PC),
Power Management Controller (PMC),
534Power Management IC (PMIC),
47Power management unit (PMU),
239Power on reset (POR),
534PRIMASK register,
94, 502“printf” function handling,
490Private Peripheral Bus (PPB),
303Privileged Thread Mode,
90activities with simple OS,
253fCMSIS-CORE functions,
255tProcessor core/CPU core,
Processors
ARM cortex-M processor series,
8–11ARM Cortex
®-M0 and Cortex-M0+ processors,
12–13ARM processor families,
5–8, 6f
blurring boundaries,
Cortex
®-M0 to Cortex-M0+ processors,
13–17, 15fnested function call,
152fpush and pop of multiple registers in function,
152fusage of branch conditions,
148–150Program Status Register (PSR),
93, 661ARMv6-M
vs. ARMv7-M architectures,
650fProgramming
controller for train modeling,
504–508input and output functions development,
495–501LED with PWM control,
467Read-Only-Memory (ROM),
34Real Time Clock (RTC),
522, 534CMSIS-RTOS RTX options,
570tdebugging applications with,
600generic wait function,
590osSignalWait function,
577fosStatus enumeration definition,
573tRTX_Config_CM. c customization,
604SVC services for unprivileged threads,
593–597Reduced Instruction Set Computing processor (RISC processor),
12Reentrant interrupt service routine,
671–673Reset Handler/Startup Code,
69–70Reverse ordering operations,
135–137SCB-Interrupt Control State Register (SCB-ICSR),
92SecurCore® series,
Secure Digital card interface (SD card interface),
170Send Event instruction (SEV instruction),
143, 236, 519Send-Event-On-Pend feature (SEVONPEND feature),
236, 515–516Serial Peripheral Interface (SPI),
500Serial Wire Debug Communication Protocol,
317–319
Serial Wire Debug protocol (SWD protocol),
105Serial Wire protocol (SW protocol),
33, 358Signed divide instructions (SDIV),
653Simple OS
context switching in,
256ftask initialization in,
255fSimple pulse interrupt handling,
208Single Cycle I/O interface,
14, 99feature-related instructions,
142–143triggering sleep too early,
180–181Software porting
from 8-bit/16-bit microcontrollers to ARM
® Cortex
®-M,
635migration from 8051 to ARM Cortex-M0/Cortex-M0+,
639–641nonapplicable optimizations for,
638–639ARM7TDMI™ processor
vs. Cortex
®-M0/M0+ processor,
641–644from ARM7TDMI™ to Cortex
®-M0/Cortex-M0+ processors,
645software modifications,
656Cortex
®-M0 processors,
635between Cortex®-M0/M0+
and Cortex-M1 processors,
656and Cortex-M4/M7 processor,
659–660Special Function Registers (SFRs),
636Stack analysis
CMSIS-CORE functions,
255tselection switching,
254fseparate memory ranges,
252fSP-related addressing mode,
71task initialization in simple OS,
255fState Retention Power Gating (SRPG),
239, 240fStatic Random Access Memory (SRAM),
, 34, 165STM32F0 discovery, programming UART on,
486–487STM32L0 discovery, programming UART on,
484–485STMicroelectronics STM32F0 Discovery,
336, 337fBlinky. c for STM32F0 Discovery Board,
367–368CMSIS-CORE selection and device-specific startup,
365fcompile result for the blinky project,
374fflash programming algorithm options,
373fflash programming status output,
374ffrequently used buttons on tool bar,
373f
options for ST-LINK,
372fproject with start-up code,
365fST-LINK debug adaptor selection,
371fSTM32F051R8 selection,
364fBlinky. c for STM32L0 Discovery board,
354–355CMSIS-CORE selection and device-specific startup,
352fcompile result for blinky project,
361fflash programming algorithm options,
360fflash programming status output,
362foptions for ST-LINK,
359fproject with start-up code,
352fST-LINK debug adaptor selection,
359fSTM32L053C8 selection,
351fStrongly Ordered memory (SO memory),
178Sub-Region Disable feature (SRD feature),
309allowing efficient memory separation,
309–310to control access right to separate peripherals,
311foverlapped regions with,
310freducing total number of needed regions,
310wasting of memory space without,
309fservices for unprivileged threads,
593–597system exception types,
30priority level registers for programmable system exceptions,
221finside SCB data structure,
220tSystem Control Processor (SCP),
18System Handler Control and State Register (SHCSR),
226, 226tSystem Handler Priority Register 2 (SHR[0]),
96System Handler Priority Register 3 (SHR[1]),
96–97System Handler Priority Registers (SHPR),
221, 221tcalibration value register,
102–103control and status register,
99System-on-a-Chip (SoC),
“SystemCoreClock” standardized software variable,
81, 250SysTick_Config(uint32
_t ticks) function,
248 Technical Reference Manual (TRM),
113–114
10-pin Cortex
® debug connector,
147, 151fThumb
® state (T),
, 90, 109Tightly Coupled Memories,
debug connection affect by I/O setting,
722debug protocol selection/configuration,
723device specific requirements,
723using event output as pulse I/O,
723incorrect SVC parameter passing method,
722OS error reporting support,
603OS feature configurations,
603pitfalls in programming
breakpoints and inline,
728missing volatile keyword,
726problem in Run/Start program,
165–166program started, but enter HardFault,
169stack size requirements,
602TrustZone®,
Type Extension field (TEX field),
299–300ULPBench-Core Profile (ULPBench-CP),
528–531Ultra Low Leakage (ULL),
41Ultralow-power (ULP),
511debug considerations,
527Universal Asynchronous Receiver/Transmitter (UART),
264, 479, 620–621configurations on microcontroller,
482programming
Universal Synchronous/Asynchronous Receiver/Transmitter (USART),
479Unprivileged Thread Mode,
90Unsigned divide instructions (UDIV),
653Unsigned integer divide function,
160fVectored exception entry,
104comparison with WFI instruction,
237tsleep wake-up behavior,
236twake-up characteristics,
233tcomparison with WFE instruction,
237tsleep wake-up behavior,
236twake-up characteristics,
233t
Wireless communication microcontrollers,
46Write Back Write Allocate behavior (WBWA behavior),
178Write Through behavior (WT behavior),
178xPSR Combined Program Status Register,
93–94