点击文件名下载附件
4 ]) |4 @" ?4 \- I' \
目录Table of Contents + [1 @7 S N( F6 B; DARM® Cortex® M4 Cookbook, d5 }# s4 q% X' ~) r- B) A$ `
Credits 3 Q' b m1 f3 Q6 D9 kAbout the Author % b, X7 D6 V& RAbout the Reviewer5 ]) |- s# _; \1 [1 _5 Q www.PacktPub.com4 S8 Z+ r+ H; D. R- Y7 [* t, v( P& }3 M
eBooks, discount offers, and more 2 c) n( r, A; R/ I: R5 gWhy Subscribe? 5 f2 a }9 Y. c ?# FPreface % I6 X/ H/ K5 a1 O" OWhat this book covers( e1 A+ L, V6 R. h6 L2 E
What you need for this book 9 z% y+ F4 a% T8 h; |/ {9 L3 HWho this book is for+ B, o0 a( Y3 Z
Sections $ }0 r4 c! [4 c# r5 yGetting ready " k" j4 S! i; o4 e( XHow to do it… X- i+ O* q- M( H$ a% |
How it works… 3 g+ M9 T' b; \3 \There's more… . b5 W+ y% l* @" Z2 E1 G9 ISee also! Q) P! U3 M' A) ~
Conventions" w: h/ g( M- A
Reader feedback: l, D7 Z- z6 i, h4 M/ I
Customer support3 |' |0 E+ L2 p* J
Downloading the example code( X6 z9 H U. c
Downloading the color images of this book9 ^6 w' z( m0 J6 _( t( z6 ^" d
Errata 1 V; h6 I) e6 f" C9 R0 V# UPiracy( ^! F `0 y( `. H0 V" X( w
Questions5 |6 S0 L' D9 {8 V
1. A Practical Introduction to ARM® CORTEX® ! q5 [. p5 I6 Z0 Z8 _Introduction/ m" |; F! J* R& I
Installing uVision5 ) g# q) l9 [, P5 w9 y' n' uHow to do it… # y6 p) q2 v, O# u# F9 mHow it works… 5 P. n& j8 |4 e& CLinking an evaluation board, z" L3 b5 E) c- T2 M
How to do it… 0 @& E S( @, _" C$ C7 [How it works… 1 P' w# s8 D. x# {* _( i, sThere's more…9 h4 `: R: k5 N( l; \
Running an example program 4 }7 a/ O; \* w( C2 ~How to do it…% V) b/ S) f' D0 j0 ?( h
How it works… & E/ t$ T9 J( _ dWriting a simple program - f; X* T7 J3 M$ uHow to do it… $ N' W3 z4 I' e0 w) @# [7 [4 ZHow it works…0 J# H" t$ d# q
There's more… # i2 O3 b, l! J! Y. U L. dUnderstanding the simple use of GPIO " Z$ S `( i) SHow to do it… + R/ A7 T" @3 H( qHow it works… / Q8 Q( l% t6 X$ TThere's more… + @. r- I! K& f7 cEstimating microcontroller performance8 n5 S" R% ?0 W4 Q6 W
How to do it… ! v: y6 ?5 u) e `1 \There's more…: g5 S) M" P2 a
See also0 m9 n7 q8 V- ^9 ]6 C) G
2. C Language Programming 3 b& g; o7 o! M8 o) V; v ^Introduction F% c( X5 s5 G2 v6 [
Configuring the hardware abstraction layer ! ]. \4 Z: S- F+ C4 K, |How to do it… e1 h! x) m: g% NHow it works…/ Y" L, _& Q/ x/ c( q3 e( f
Writing a C program to blink each LED in turn : b( M, S& |+ F2 V# n- XGetting ready… 6 [8 h: B. u# l7 H1 z$ |How to do it… 0 i* K. c3 C8 b; |: ]6 h- }How it works… # ~9 i; u+ L) w: [! PThere's more… % H" m( }/ X. F5 \) C2 l QWriting a function; M7 T4 P( h' c! [
How to do it ! j& _) O+ o0 R6 U- j1 |( BHow it works… 4 y& T( ^4 l2 Q5 K8 j; T9 P1 f+ BThere's more…1 [" ?, Y2 G8 W' {8 u
Writing to the console window Y7 H1 g' {2 S r
Getting ready ( r# p2 t% H# U1 [ h2 {5 }, tHow to do it…* L, H( @' ?6 `, h0 J
How it works…/ E! S% x$ N& k; |& [2 G
Writing to the GLCD' F3 t" O. u: ]# l
Getting ready * K7 s" K( Y% L+ ?How to do it… 0 [- ~; C; G7 Y$ s1 b: C- Z- vHow it works… ( _7 ?1 N/ M1 V& {- L4 D; iCreating a game application – Stage 1 2 K% E/ _; ~4 e+ V8 x" \+ R- k# _. XHow to do it…9 c0 |) S! s6 h+ r! E3 J3 z- }
How it works… % t6 B0 q0 e) [ I2 KCreating a game application – Stage 2/ g4 L9 ^' H2 C1 ?
There's more… " e# Z" J! \- I6 z7 x0 x" zHow it works… & q+ v0 U8 J: d) o9 N! ODebugging your code using print statements0 Q! h- W$ d! ^7 _
How to do it… 5 G1 o; S* _/ }% e5 f5 wHow it works… ; A% j0 x' k5 c7 |6 L% o7 ?0 ?! O3 hUsing the debugger 5 B, J' i4 v# @! H; THow to do it…+ P G- ~6 L7 J* E. s9 ~- V3 B
See also * U+ n5 v( j. A ?3. Programming I/O % e5 q+ n# b5 w6 [* s, \Introduction / [5 |0 J# q$ z+ PPerforming arithmetic operations + N6 q p7 O6 dHow to do it…% ?/ l( ?0 a7 S# h
How it works… 7 U4 a7 c {- ?- BIllustrating machine storage classes8 C8 |# f+ S) ?( u
How to do it…* Y* t" ~. j' g& t o
How it works… : t. x, \2 m8 aConfiguring GPIO ports ( m) U0 O! o, I7 n- UHow to do it…# n8 G' F! ]! G& h9 g" G$ _
How it works…% x; @+ s* \3 W* B: f
There's more…! A v" `2 l' M' X8 f
Configuring UART ports & m: n) O% A, I& XHow to do it…6 e0 M: o- X7 K3 \1 U
How it works… " i# A. \# Q" z7 JHandling interrupts$ T I2 X% c$ ^1 V
Getting ready , U% C3 `7 p, \& xHow to do it…( M' S; b# j ]; G% Q. ?
How it works… * ~$ d( ^% I: X2 @There's more… ' N. Q( b H+ c. D/ Y$ m7 tUsing timers to create a digital clock $ K' k" j' q+ U) i4 sHow to do it… 0 L3 [1 G _* A3 HHow it works… 7 w r. T$ P$ V. ]' v" c4. Assembly Language Programming + N) e1 {4 N* f! `Introduction( P; a( o$ ?, a: m6 l! f
Writing Cortex-M4 assembly language 5 `$ s% T: s6 ~4 k+ c+ N; zGetting ready 8 f0 {, Z* A4 x3 L$ I9 \How to do it… : M7 m: { d8 `) yHow it works… " p: Z2 i% p( X9 E, u! AThere's more… : f7 o' M8 e4 A/ `See also % v l, m$ B9 { ~" M* LPassing parameters between C and the assembly language* N6 q% h) ~1 r2 @7 v8 E
Getting ready : p' t# x( x& N; GHow to do it…6 G' W# ^+ q$ _, p; y0 ^
How it works…8 t4 H$ a3 l. V/ G: [" R' `
There's more… 0 p, Q: U8 F2 U* D* v7 G* FSee also- f* N" s+ c/ J1 X: c9 r0 B8 H
Handling interrupts in assembly language0 p4 g+ J _$ h
Getting ready " B/ C4 ]+ G) y1 P9 j4 eHow to do it… . n6 W4 J* P/ K& ]& T1 EHow it works…9 Z; {9 h, D/ b7 U+ i. Q' `% Z
There's more…; q. ~' U1 J {- B( Z- G6 V) x, t
Implementing a jump table, j: w3 |5 |9 Y3 }
Getting ready( s( {- a; L* s$ e1 n$ H3 n
How to do it… 2 O! |9 a5 H$ X& b1 K( |4 x- aHow it works…% I4 t6 H) V" s1 y# n5 n( d& v5 e! W' w
Debugging assembly language& R' ?& a- A& w5 U4 y$ G
How to do it… 3 s: r* T3 c5 y( T- @5 bHow it works…3 g; r* D- r' V0 ?: y( p x
There's more… 7 U O* K. [4 c4 t7 }( z0 w5. Data Conversion 0 `3 e! C0 W0 Q6 YIntroduction ) y, M; A- r7 i" e& eSetting up the ADC @; I& _! y& F, M" r2 }) `
How to do it… b- O- b; h W/ bHow it works…& i9 n7 a0 w. I
There's more…' u$ q, g6 {; z f9 X
Configuring general-purpose timers$ b- }3 i9 [. k$ V/ ~- _( _2 w2 |
How to do it…* s! I6 B2 K0 z7 k
How it works… " h2 T) G. {8 g6 [- |7 CUsing timers to trigger conversions $ e# a" k$ C6 v( f) @! a1 yHow to do it… - l5 I l7 E% u# o( tHow it works…, M3 k& v3 E! @, ]
There's more… % `! C' F+ z2 B+ p. W4 x; j4 V6 OSetting up the DAC ' i& S, u0 N2 F7 g) b/ {7 s DHow to do it… 5 ?( @4 g9 R4 N1 j! m4 RHow it works… ' R$ E: T+ j: b6 }; {5 h9 X9 P7 VThere's more…0 a2 X$ N- \/ h# T4 f$ [7 V3 w" {) X
Generating a sine wave7 b4 q" z0 G4 g/ P- D, F
Getting ready # u" V% J4 a8 `3 bHow to do it… # e; y0 h' r! mHow it works… / E! J# A/ Z- P% ~9 c8 m) G6. Multimedia Support ^7 R# a, E; ^" xIntroduction 9 `* Y6 K5 w! `) g* d7 i# DSetting the RTE for the I2C Peripheral Bus$ P) H& z' E5 T6 d) b
How to do it…$ C6 N" @7 t2 y! t
How it works… # C |" D/ r! o$ m0 {1 ?How to use the LCD touchscreen+ O, ?8 h& r" w4 f, q4 \5 @
How to do it… 3 o2 ^" P2 z. W9 RHow it works… , e8 S' f Q2 |# W& HWriting a driver for the audio codec ) a g) Y* l! h( f1 QHow to do it…" H; \( `: y) H% g! P$ _
How it works…, [' ?: p) U6 U% j7 A
How to use the audio codec ! d3 s3 G2 ]# p8 }2 o; y6 kHow to do it… ! o& |; o- l. p9 Q0 lHow it works…* X: F2 h# X* x. m8 @
How to use the camera' F- V6 L, O5 k' ~/ v+ K
How to do it… ( s2 Q1 h) {* k V& S5 f5 F* I6 MHow it works… + H' @% s6 ^; s, t8 H3 B/ \There's more…7 v( f( [/ V; z9 X
Designing bitmapped graphics . b( g' }5 N2 Q) a+ ~( eHow to do it… ! k+ p) R+ Q! J0 MHow it works…! i% I5 M3 C, A$ u) }. b
There's more… 7 I( V( d6 m) R5 w: ]: m) cIdeas for games using sound and graphics - b+ K: O4 z3 m+ O7. Real-Time Signal Processing" _3 \2 a9 `1 c' S/ s0 g( D
Introduction 5 O ?3 G* |; S. c' M/ c: D$ |Configuring the audio codec$ M& f9 b: \" n3 Z i/ w/ e8 @2 Q
How to do it…. I# W8 d" a7 _% x' g5 N/ g
How it works…- X( e7 ?0 w4 f8 n
There's more…% z5 q, G5 v+ J
How to play prerecorded audio; C# o4 W% B! q0 g9 I* |* ]
Getting ready' C, w# H4 E. S- {$ N4 `2 b) j6 W! M
How to do it…; o, n- B9 j+ n8 @. y$ w' Z. }
How it works… 9 `' \) [- x \Designing a low-pass digital filter 1 @7 z6 } }3 y# c* iGetting ready ! c3 m. e9 @" g* y% y. qHow to do it…8 B7 A# ?4 g( Y
How it works… + R/ t* U+ p! B1 S/ J$ yHow to make an audio tone control% v4 g& U* V# {5 X
Getting ready; ?1 g/ o. a7 S r
How to do it… 1 ^# [4 d# |( H( O; ^( aHow it works…4 n* ]9 |( o8 l
There's more... ; X3 v) W( @1 A6 W% ?0 o) ]8. Real-Time Embedded Systems8 t* R5 @. _2 f( O6 }8 b
Introduction ( w; D8 v' Y, w4 B: [Multithreaded programs using event flags4 c1 ^. J6 ~; Z; c
How to do it… % T6 B! O8 n; s; d9 \3 p4 yHow it works…% ^ Z5 P! }+ @
Multithreaded programs using mailboxes * G3 j6 _" Y1 u7 \7 F* {How to do it… 4 X5 i. G9 C+ H! E; u1 kHow it works…& F6 a8 h% o, r Q w) j( w* e
Why ensuring mutual exclusion is important when accessing shared ' P& V; C! n( N" k `( Oresources ! ^+ U7 W1 n* Y1 i. _( UHow to do it…& h( W; F) i) Q) {. E
How it works… ( ]5 K8 }7 K7 bThere's more…" @5 [! R; J! h" u
Why we must use a mutex to access the GLCD ( g2 Y2 f, l9 y5 Q* S, w" oHow to do it… 5 O9 }. ]% p" r4 j: V: t+ ^How it works…8 b) M" @7 G; Q r
How to write a multithreaded Pong game 5 ?) V$ A( E/ J% ZHow to do it…, m) {' m1 V/ a6 U; Z& [
How it works… 6 n* k) E( \; k* l7 wDebugging programs that use CMSIS-RTOS6 H" d, _/ M% u. @8 P8 D0 S
How to do it… 1 j) P9 i% o' m0 r2 Z( \7 YHow it works…/ q) w0 g8 k- ?) T8 t S6 U3 @; s7 M
9. Embedded Toolchain 5 n) j$ r7 u" y1 M$ `: W. f ~0 mIntroduction& y$ R# y$ f5 N) Z2 N( V
Installing GNU ARM Eclipse ! F8 V q# A7 tHow to do it…8 m7 C8 A+ G5 g- V* E
How it works…( [; ~& x' o- ]
Programming the MCBSTM32F400 evaluation board ) Y% q- _# A* N, n/ b7 sHow to do it…; d% M, p6 G( s2 i3 A; d
How it works… W- i: Y: X N" N5 A! W, n# iHow to use the STM32CubeMX Framework (API) ' A6 A b5 Z% L. DHow to do it…! G: V' B) U; v+ y$ B0 l' M0 t6 T
How it works… - S/ b* {5 j$ v$ \) ^There's more… {1 {- ]7 L' PHow to port uVision projects to GNU ARM Eclipse& P* M' c( v/ ^1 z! L: L7 F/ i" `0 y
How to do it…- _' w* }1 g& ?1 k7 ~
Index. p' D" K3 K u6 z+ M