点击文件名下载附件
& W* M- d0 P7 c/ \% Y/ }
目录Table of Contents ! Q% Y" n4 R6 P. HARM® Cortex® M4 Cookbook 7 g) s" i8 R+ M" L' BCredits ! V/ l* ^7 H/ n6 | EAbout the Author ) E3 {1 [8 ?* w" }. pAbout the Reviewer: x0 r% p+ B/ Z www.PacktPub.com % _0 Y" g# A& ]+ q2 o" `$ feBooks, discount offers, and more0 y3 _$ z3 j. h# }
Why Subscribe? / J1 |. n$ t/ k8 Y9 qPreface9 l {' [- x7 Z) e( H
What this book covers- k2 Y) n# Z4 N8 j7 q# V* d
What you need for this book 6 W. S2 u6 Y' s0 |7 i1 D3 aWho this book is for 1 g. o0 u1 S0 n3 b. oSections : p5 l7 J0 f; v6 T0 q% \) `' ]Getting ready- m( ~! H2 ]2 p; y3 H+ S
How to do it…' r! w8 h) B) j- W, _
How it works… * Z S; }4 e# B1 X" R0 m) g' kThere's more… 3 {% @# E( B& ~+ d6 n- p5 A1 I6 DSee also# {3 B$ @/ q) L* L* q' n3 d
Conventions 7 c2 B+ Z& Z1 j. cReader feedback 2 ^3 l7 F3 a# D* y: |$ i% G6 m# dCustomer support ; p% r$ U- S# ]3 V8 {+ v" X9 V) SDownloading the example code% }! g* n3 E. K
Downloading the color images of this book 7 j0 n. {5 d8 R9 ]: bErrata - k4 D8 \3 M2 e1 z% }Piracy 0 y- F1 b0 Q9 l1 tQuestions/ i7 K. m$ G* `& T
1. A Practical Introduction to ARM® CORTEX® + X! K% A/ C5 `' ~# aIntroduction8 m; i6 @1 k: s @5 c
Installing uVision5 ! r- D- q" ^) kHow to do it…; L' {; j/ K* s% C% `. g5 @! k
How it works…+ L V$ r% X8 G
Linking an evaluation board 0 D1 n* |: ^ }7 e/ `5 bHow to do it…+ R" Z1 I5 z$ V
How it works…* `1 B; Q e# V! H- d. u2 i
There's more… - ~! \9 Z( u" z! ^: w% @# sRunning an example program : I% N" \: O9 }" c" lHow to do it…) g8 r3 e6 g( {1 B
How it works…3 ~. U; Y% z( [, q7 g+ }3 e. G8 G
Writing a simple program! I, Z* a$ L. {+ x0 j5 T' V
How to do it… ' ]& s, U. t" m1 P# [$ T6 ^How it works… ' U6 i* b, ^# s% b. ?; hThere's more…8 ]% C% W. W: p( \# i
Understanding the simple use of GPIO & m V- e2 W* ZHow to do it… " g3 m" {& X: W7 D" t) D% t6 vHow it works… ! R5 L9 _( M3 J% x; Z% EThere's more… % M# c; o; N A9 n8 W( z$ FEstimating microcontroller performance 8 z# N$ O4 g1 u, C2 t9 F" HHow to do it… ( f2 l; }9 z' p: m5 F% lThere's more…2 W& |9 R. r$ ] M
See also1 w4 Y3 m) x; v9 C/ F. k
2. C Language Programming, F* ]. y) U# G+ r0 h
Introduction0 q) q) ]' Q' m6 I
Configuring the hardware abstraction layer / Y( V l6 J" e' ]How to do it… ! M$ K9 a1 A1 z! k( vHow it works… 7 g- B, G$ E. `Writing a C program to blink each LED in turn / N9 J/ E* w* `+ b5 k* n, sGetting ready…, \6 b( \) _0 f2 l/ h
How to do it…( W+ k1 H4 ?" U- J. p6 A! s
How it works… & r* v5 y8 }( R% l/ ^# S4 wThere's more…6 D& N3 F- O: r; Z0 P! R' Q( X
Writing a function " }4 y# a/ r" x) l0 L9 fHow to do it5 h, f* ?# c/ M* t
How it works… e$ T7 I0 ~9 _" O3 Z) _/ ^There's more… ' b& {, R/ K+ k( gWriting to the console window # B- f7 k7 }. W, PGetting ready& B( D( k) X& i$ u
How to do it… . R. J' g( V% ]/ z& RHow it works…, H' e. \) ? T. C& M, _
Writing to the GLCD ! T; h! Z U$ }3 X8 u0 dGetting ready 4 b. o& M' q& Q- X7 SHow to do it…8 [6 _, c9 k$ Q! Y9 @
How it works…$ p8 B- L# S; T0 e" P
Creating a game application – Stage 1 / |5 ^! e, a+ U7 F7 SHow to do it…/ z3 C2 q/ z& x3 r
How it works… 0 B x9 j$ s. x: Y1 `$ OCreating a game application – Stage 2 9 M/ _$ y' e! X+ aThere's more…) a8 I& ~0 Y8 U2 X! ^3 m% f
How it works… T7 w4 V/ u' x4 s, C4 G. H& ?+ v
Debugging your code using print statements9 `' g" O Q' ~, L4 f8 K
How to do it… ' W4 Y$ A2 L( j& C0 PHow it works…4 N9 y# |: a/ V2 Q+ E
Using the debugger3 k; B; q4 @+ q& z. O+ Z+ m- ~
How to do it… 8 N/ Y" V2 c( X8 nSee also$ r6 m; t5 `; `& b/ x# G/ C2 {
3. Programming I/O1 a' v3 O5 t2 ]- X
Introduction1 ?5 A9 }- X: R9 D3 b& u
Performing arithmetic operations & q W5 }. ]* J" ~1 F# J" r* Z, @How to do it… : C7 U( B. F- V0 q% \, x& B, |How it works… ) @: a' Q/ x# U' y5 jIllustrating machine storage classes 8 Y. i( d% h6 O) \How to do it…% b& C- c+ R- r# `
How it works…& |; x& e9 @/ d% Q. A$ x8 ?: d- y
Configuring GPIO ports s3 F; d, D, ~& o
How to do it…+ ~$ j9 a" J( X6 E, Z) t& o7 E* s
How it works…( E# E1 G( v7 S$ q, W. g# L
There's more… " ]; X {" x' r; | e$ B) [Configuring UART ports 3 p3 A7 k$ P/ A4 gHow to do it…2 \; U* N. B+ P' c
How it works…+ a9 |/ I0 G2 w+ p
Handling interrupts 1 S! w, v! E, q7 n4 o% l. w9 dGetting ready5 d$ U! o) X7 b. f3 E
How to do it…$ |* Z% C$ D9 ^( X
How it works… 2 Y$ p# Y/ i% x% q& pThere's more…1 y9 z) S- I- Y) F- m* ^
Using timers to create a digital clock" ~. O# A0 E* ^; g' F( r( k$ G
How to do it…/ b) |$ Z1 S) H& M" W7 h1 q
How it works… 7 e+ T% I- I `2 g$ L4 ~ X+ x0 l$ m4. Assembly Language Programming 5 f; i5 U8 w! FIntroduction & Q8 w2 a7 L& R: p4 x" h' ZWriting Cortex-M4 assembly language) ~ a9 ^( V' [. @% V4 |
Getting ready5 W1 e. @7 I" J3 d- f0 n' J, r- i
How to do it…" t# X) a/ @5 I( ?; D- b) c
How it works… ]& i2 c( i$ p9 J5 R2 a6 a% q; f
There's more…; o/ A% u$ a* w- O" k
See also + ^/ C# w. p& j) T: KPassing parameters between C and the assembly language9 ?) s% \' t! l: M3 `8 w( `" @
Getting ready / d' n+ {- [7 l: X2 D+ Q m$ v* c) GHow to do it… $ o; p+ S# E7 o5 aHow it works… ( ~) Z) G, i( ~% {: g T- v& z7 ^There's more…) f3 G5 Y! d' R D) a
See also& T" F2 Q7 E5 x
Handling interrupts in assembly language- v- L& a2 Q, x0 V/ d/ p2 p/ h
Getting ready% g! e- o/ l- q
How to do it…1 V/ i1 U2 S3 F, g4 F$ x- |
How it works…* [0 R8 F, ~) [7 z& J
There's more… 7 F' y1 l9 F. u- {Implementing a jump table 4 b; X' |, d* d: S, J% BGetting ready3 U. `- W* I" w% Z: G
How to do it…8 w6 G" s; d0 J4 A% X. L3 w
How it works…0 h" d/ G) f) b4 J7 n8 X9 X
Debugging assembly language 8 K! W) c2 U8 P9 ^8 @5 b" f. zHow to do it… 9 W0 V! w: q- {% F8 K: DHow it works… 4 K3 _) b# u, sThere's more…- y$ V: b3 s5 n* x7 [
5. Data Conversion. D. a5 Z( A& _$ }
Introduction+ x. `& V' U, M: I6 `& R
Setting up the ADC 0 n6 L+ X& F+ ^* A8 K rHow to do it… / u' U/ ?/ B; HHow it works… d$ @5 I, C/ V8 e* c: V" ]
There's more…/ D6 f! }8 V j7 ^, b
Configuring general-purpose timers 4 Z2 Z X! k4 s/ ~4 ~+ T+ g9 KHow to do it…# `( \( v, w" m F7 i& k, j
How it works…2 x i/ j7 K8 u
Using timers to trigger conversions9 F8 l" K M+ ]7 H, J. h
How to do it… 9 S5 }7 W ~# p' G- {% V, F1 zHow it works…. z& ?, ^8 c% Y' k
There's more… - K( t% h" M3 C. s- d% g: X. q( dSetting up the DAC ( S1 a( { F" @+ j' ~. F5 a" \5 mHow to do it… 1 i( C' U. y( K% z+ IHow it works…8 `: q* M4 e8 }3 z8 r" n) J' b9 c
There's more… 7 X! s+ \- F4 U m0 H/ u! z# r6 ]Generating a sine wave ( p/ N1 V- p( ~! t) x9 \3 IGetting ready ! b: H# s- Y4 h6 a4 nHow to do it…/ A/ T& d9 h5 H4 m
How it works… w( c, a* @" R) u) T6. Multimedia Support 1 \ t, n( y- b0 AIntroduction , J6 j" [- y6 v% Q4 F, ?Setting the RTE for the I2C Peripheral Bus% `; R0 ]: q' Z8 b3 S( }- c
How to do it…/ s& `% W: h# Z
How it works… - x$ c. y5 c; \. c. oHow to use the LCD touchscreen 9 V, p2 l& l m9 H7 C5 HHow to do it… 6 f! M% E- v$ A( j* T6 iHow it works… 1 V+ m" |4 v; x7 J: EWriting a driver for the audio codec 4 C Q) A9 _0 \, JHow to do it…' T4 c0 F4 b: m$ U' X
How it works…& _! E# \7 ^3 ]5 n
How to use the audio codec 9 k' q) |, m) U1 I0 d- q) MHow to do it… }! R& `% @3 g
How it works… f7 [4 M- B1 Q+ I5 W8 m# T- z
How to use the camera ! k0 {% u; f( m4 y+ Z7 [How to do it… ( a/ @# P" r' R, B. GHow it works… 3 k+ R! O% d3 qThere's more…# @" r3 d; e q# ^
Designing bitmapped graphics& w8 w h/ L/ P. E, N0 b
How to do it… - V# Z% \% {+ r) V# _8 h( MHow it works…6 V& {( a* H; Y8 D
There's more… 2 u6 y: p- |* P0 W+ O5 X& sIdeas for games using sound and graphics 4 ]1 X9 C8 F/ z2 T* Y6 Q% ^, k$ k% i7. Real-Time Signal Processing2 y' g: X% u& {: Q
Introduction * y* h2 Y; \$ j" U# E# v+ ]Configuring the audio codec 2 j6 J+ | }. A8 m6 GHow to do it…3 I. z' s4 v' s$ @
How it works… ; Z5 i4 A+ I% o0 v' g9 \3 rThere's more…- p, [( Q6 o3 M
How to play prerecorded audio5 b* q# {) C6 c1 U7 f
Getting ready$ }: i: j# @7 E& M9 t, I
How to do it… $ y2 X6 t0 ]" W a( o' \! sHow it works… 7 I* Q0 F9 E- x3 V7 fDesigning a low-pass digital filter( {# f, ?( o1 s y
Getting ready/ n! D7 v7 H, F
How to do it…+ h$ k' @" {5 g6 G3 [' K' h; I
How it works…( w! D8 E, g: c' R% D: z" J" B# V
How to make an audio tone control. a. \ |. x7 c2 G4 b
Getting ready ) f+ h( E7 c) S7 uHow to do it… ; \4 d7 z+ ]' q GHow it works… ' q" i7 r1 h! D1 j9 V8 TThere's more... # n& Q. L& ]5 d/ v; {; E& d5 }4 v8. Real-Time Embedded Systems ) M8 B! v6 c# G3 UIntroduction* t9 N/ f6 }4 b; ]4 Y7 N
Multithreaded programs using event flags : P4 \5 }9 L5 Q. O. mHow to do it… 1 E A% `* Q) D& u- P' ]3 Z! bHow it works…8 m' }6 Q4 @# D
Multithreaded programs using mailboxes2 f" f7 H$ F8 }; ^' P- H. D) p
How to do it… 0 O" T) \3 `/ |2 `+ yHow it works… ! `5 V( X' l+ nWhy ensuring mutual exclusion is important when accessing shared; I @9 t" u6 e+ z2 k) d! D
resources / t; n5 e: q2 M( E" V- J, x% tHow to do it… : v1 E* E; f9 }9 M' ZHow it works…* C% q& a0 o E2 h8 F7 w) W
There's more… ) }' ~' L V6 `0 Y- |Why we must use a mutex to access the GLCD 3 ?4 J; ?" J4 n7 k }How to do it… 5 ~! P3 ]( e) R& U3 L' \% _How it works… " w, W/ J z* M* f* t CHow to write a multithreaded Pong game5 ^: ?* r0 k# Y; N
How to do it… ) i7 k9 P" g8 e# I4 p8 P; ]9 cHow it works… $ F' r$ ~3 f" e& T3 u% MDebugging programs that use CMSIS-RTOS 4 G' C0 Z* Y1 V" kHow to do it… + ]# h+ U: c# n6 NHow it works… $ l8 s9 P) q6 h6 Z W9. Embedded Toolchain+ ~. O4 ~/ M; u" X
Introduction ' }2 r& l5 }7 f1 p5 H$ ~Installing GNU ARM Eclipse7 ?, G+ I4 E/ o- x9 I) x' b
How to do it… ( h3 y1 f$ b0 u% S( t0 E- B$ oHow it works…4 H% g; [7 O& B8 S
Programming the MCBSTM32F400 evaluation board 7 e' T4 m2 D: {. zHow to do it…# G9 p3 a! u' m+ z& X7 K3 Z
How it works…+ R% Y3 R% z( a5 q
How to use the STM32CubeMX Framework (API)3 F: j/ k! e4 k4 u3 M
How to do it…& P* r4 N' g' u4 r
How it works…! K0 W# v2 j4 L# D- |% A/ G
There's more… ) N- a$ d& f+ H( S4 K7 VHow to port uVision projects to GNU ARM Eclipse ! b! q! T' W/ hHow to do it… 9 q0 e* Z- s9 w) P; k1 L8 s. iIndex & n/ k. A6 z& H