Muutke küpsiste eelistusi

E-raamat: Real-Time C++: Efficient Object-Oriented and Template Microcontroller Programming

  • Formaat: PDF+DRM
  • Ilmumisaeg: 14-Jul-2021
  • Kirjastus: Springer-Verlag Berlin and Heidelberg GmbH & Co. K
  • Keel: eng
  • ISBN-13: 9783662629963
  • Formaat - PDF+DRM
  • Hind: 55,56 €*
  • * hind on lõplik, st. muud allahindlused enam ei rakendu
  • Lisa ostukorvi
  • Lisa soovinimekirja
  • See e-raamat on mõeldud ainult isiklikuks kasutamiseks. E-raamatuid ei saa tagastada.
  • Formaat: PDF+DRM
  • Ilmumisaeg: 14-Jul-2021
  • Kirjastus: Springer-Verlag Berlin and Heidelberg GmbH & Co. K
  • Keel: eng
  • ISBN-13: 9783662629963

DRM piirangud

  • Kopeerimine (copy/paste):

    ei ole lubatud

  • Printimine:

    ei ole lubatud

  • Kasutamine:

    Digitaalõiguste kaitse (DRM)
    Kirjastus on väljastanud selle e-raamatu krüpteeritud kujul, mis tähendab, et selle lugemiseks peate installeerima spetsiaalse tarkvara. Samuti peate looma endale  Adobe ID Rohkem infot siin. E-raamatut saab lugeda 1 kasutaja ning alla laadida kuni 6'de seadmesse (kõik autoriseeritud sama Adobe ID-ga).

    Vajalik tarkvara
    Mobiilsetes seadmetes (telefon või tahvelarvuti) lugemiseks peate installeerima selle tasuta rakenduse: PocketBook Reader (iOS / Android)

    PC või Mac seadmes lugemiseks peate installima Adobe Digital Editionsi (Seeon tasuta rakendus spetsiaalselt e-raamatute lugemiseks. Seda ei tohi segamini ajada Adober Reader'iga, mis tõenäoliselt on juba teie arvutisse installeeritud )

    Seda e-raamatut ei saa lugeda Amazon Kindle's. 

With this book, Christopher Kormanyos delivers a highly practical guide to programming real-time embedded microcontroller systems in C++. It is divided into three parts plus several appendices. Part I provides a foundation for real-time C++ by covering language technologies, including object-oriented methods, template programming and optimization. Next, part II presents detailed descriptions of a variety of C++ components that are widely used in microcontroller programming. It details some of C++s most powerful language elements, such as class types, templates and the STL, to develop components for microcontroller register access, low-level drivers, custom memory management, embedded containers, multitasking, etc. Finally, part III describes mathematical methods and generic utilities that can be employed to solve recurring problems in real-time C++. The appendices include a brief C++ language tutorial, information on the real-time C++ development environment and instructions for building GNU GCC cross-compilers and a microcontroller circuit.





For this fourth edition, the most recent specification of C++20 is used throughout the text. Several sections on new C++20 functionality have been added, and various others reworked to reflect changes in the standard. Also several new example projects ranging from introductory to advanced level are included and existing ones extended, and various reader suggestions have been incorporated. Efficiency is always in focus and numerous examples are backed up with runtime measurements and size analyses that quantify the true costs of the code down to the very last byte and microsecond.





The target audience of this book mainly consists of students and professionals interested in real-time C++. Readers should be familiar with C or another programming language and will benefit most if they have had some previous experience with microcontroller electronics and the performance and size issues prevalent in embedded systems programming.
Part I Language Technologies for Real-Time C++
1 Getting Started with Real-Time C++
3(18)
1.1 The LED Program
3(3)
1.2 The Syntax of C++
6(1)
1.3 Class Types
6(4)
1.4 Members
10(2)
1.5 Objects and Instances
12(1)
1.6 tinclude
13(1)
1.7 Namespaces
14(2)
1.8 C++ Standard Library
16(1)
1.9 The main () Subroutine
16(1)
1.10 Low-Level Register Access
17(1)
1.11 Compile-Time Constant
18(3)
References
19(2)
2 Working with a Real-Time C++ Program on a Board
21(14)
2.1 The Target Hardware
21(1)
2.2 Build and Flash the LED Program
22(4)
2.3 Adding Timing for Visible LED Toggling
26(2)
2.4 Run and Reset the LED Program
28(1)
2.5 Recognizing and Handling Errors and Warnings
28(2)
2.6 Reaching the Right Efficiency
30(5)
References
33(2)
3 An Easy Jump Start in Real-Time C++
35(34)
3.1 Declare Locals When Used
35(1)
3.2 Fixed-Size Integer Types and Prime Number Example
36(6)
3.3 The bool Type
42(1)
3.4 Organization with Namespaces
42(3)
3.5 Basic Classes
45(1)
3.6 Basic Templates
46(2)
3.7 Nullptr Replaces NULL
48(1)
3.8 Generalized Constant Expressions with cons texpr
49(2)
3.9 static_assert
51(1)
3.10 Using <limits>
51(1)
3.11 std: :array
52(1)
3.12 Basic STL Algorithms
53(1)
3.13 <numeric>
54(1)
3.14 atomic_load () and atomic_store ()
55(1)
3.15 Digit Separators
55(1)
3.16 Binary Literals
56(1)
3.17 User-Defined Literals
57(3)
3.18 Using alignof and alignas
60(1)
3.19 The Specifier final
61(1)
3.20 Alias as an Alternative to typedef
62(2)
3.21 Delimiting Pointer Ranges with <span>
64(1)
3.22 Generating Random Numbers with <random>
64(5)
References
68(1)
4 Object-Oriented Techniques for Microcontrollers
69(32)
4.1 Object Oriented Programming
69(5)
4.2 Objects and Encapsulation
74(2)
4.3 Inheritance
76(1)
4.4 Dynamic Polymorphism and a Detailed LED Example
77(7)
4.5 The Real Overhead of Dynamic Polymorphism
84(1)
4.6 Pure Virtual and Abstract
85(1)
4.7 Class Relationships
86(2)
4.8 Non-copyable Classes
88(1)
4.9 Constant Methods
89(4)
4.10 Static Constant Integral Members
93(2)
4.11 Class Friends
95(2)
4.12 Virtual Is Unavailable in the Base Class Constructor
97(4)
References
100(1)
5 C++ Templates for Microcontrollers
101(36)
5.1 Template Functions
101(2)
5.2 Template Scalability, Code Re-Use and Efficiency
103(3)
5.3 Template Member Functions
106(3)
5.4 Template Class Types
109(1)
5.5 Template Default Parameters
110(1)
5.6 Template Specialization
111(2)
5.7 Static Polymorphism
113(3)
5.8 Using the STL with Microcontrollers
116(2)
5.9 Variadic Templates
118(3)
5.10 Template Metaprogramming
121(4)
5.11 Tuples and Generic Metaprogramming
125(4)
5.12 Variable Templates
129(3)
5.13 Template Integer Sequences
132(5)
References
136(1)
6 Optimized C++ Programming for Microcontrollers
137(40)
6.1 Use Compiler Optimization Settings
137(4)
6.2 Know the Microcontroller's Performance
141(1)
6.3 Know an Algorithm's Complexity
142(2)
6.4 Use Assembly Listings
144(1)
6.5 Use Map Files
145(1)
6.6 Understand Name Mangling and De-mangling
145(2)
6.7 Know When to Use Assembly and When Not to
147(2)
6.8 Use Sensible Comments
149(1)
6.9 Simplify Code with typedef and Alias
149(3)
6.10 Use Native Integer Types
152(2)
6.11 Use Scaling with Powers of Two
154(2)
6.12 Potentially Replace Multiply with Shift-and-Add
156(1)
6.13 Consider Advantageous Hardware Dimensioning
156(2)
6.14 Consider ROM-ability
158(5)
6.15 Minimize the Interrupt Frame
163(3)
6.16 Use Custom Memory Management
166(1)
6.17 Use the STL Consistently
167(2)
6.18 Use Lambda Expressions
169(1)
6.19 Use Templates and Scalability
170(1)
6.20 Use Metaprogramming to Unroll Loops
171(1)
6.21 Potential Costs of Runtime Type Information (RTTI)
171(6)
References
174(3)
Part II Components for Real-Time C++
7 Accessing Microcontroller Registers
177(12)
7.1 Defining Constant Register Addresses
177(2)
7.2 Using Templates for Register Access
179(3)
7.3 Generic Templates for Register Access
182(3)
7.4 Bit-Mapped Structures
185(4)
Reference
188(1)
8 The Right Start
189(16)
8.1 The Startup Code
189(3)
8.2 Initializing RAM
192(2)
8.3 Initializing the Static Constructors
194(2)
8.4 The Connection Between the Linker and Startup
196(2)
8.5 Understand Static Initialization Rules
198(2)
8.6 Avoid Using Uninitialized Objects
200(2)
8.7 Jump to main () and Never return
202(1)
8.8 When in ma in (), What Comes Next?
203(2)
References
204(1)
9 Low-Level Hardware Drivers in C++
205(34)
9.1 An I/O Port Pin Driver Template Class
205(2)
9.2 Programming Interrupts in C++
207(5)
9.3 Implementing a System Tick
212(3)
9.4 A Software PWM Template Class
215(4)
9.5 A Serial SPI™ Driver Class
219(3)
9.6 CPU-Load Monitors
222(3)
9.7 Controlling a Seven-Segment Display
225(7)
9.8 Animating an RGB LED
232(7)
References
237(2)
10 Custom Memory Management
239(40)
10.1 Dynamic Memory Considerations
239(2)
10.2 Using Placement-new
241(1)
10.3 Allocators and STL Containers
242(1)
10.4 The Standard Allocator
243(1)
10.5 Writing a Specialized ring_allocator
244(3)
10.6 Using ring_allocator and Other Allocators
247(2)
10.7 Recognizing and Handling Memory Limitations
249(2)
10.8 Off-Chip Memory and Computing 100,001 Digits of it
251(15)
10.9 Using Ample RAM on Arm®-Based Single-Board Computer
266(13)
References
276(3)
11 C++ Multitasking
279(16)
11.1 Multitasking Schedulers
279(2)
11.2 Task Timing
281(1)
11.3 The Task Control Block
282(2)
11.4 The Task List
284(1)
11.5 The Scheduler
285(1)
11.6 Extended Multitasking
286(2)
11.7 Preemptive Multitasking
288(3)
11.8 The C++ Thread Support Library
291(4)
References
292(3)
Part III Mathematics and Utilities for Real-Time C++
12 Floating-Point Mathematics
295(34)
12.1 Floating-Point Arithmetic
295(3)
12.2 Mathematical Constants
298(2)
12.3 Elementary Functions
300(2)
12.4 Special Functions
302(10)
12.5 Complex-Valued Mathematics
312(4)
12.6 Compile-Time Evaluation of Functions with constexpr
316(4)
12.7 Generic Numeric Programming
320(9)
References
327(2)
13 Fixed-Point Mathematics
329(24)
13.1 Fixed-Point Data Types
329(3)
13.2 A Scalable Fixed-Point Template Class
332(4)
13.3 Using the fixed_point Class
336(2)
13.4 Fixed-Point Elementary Transcendental Functions
338(11)
13.5 A Specialization of std: : numeric_limits
349(4)
References
351(2)
14 High-Performance Digital Filters
353(18)
14.1 A Floating-Point Order-1 Filter
353(3)
14.2 An Order-1 Integer Filter
356(4)
14.3 Order-N Integer FIR Filters
360(5)
14.4 Some Worked-Out Filter Examples
365(6)
References
369(2)
15 C++ Utilities
371(18)
15.1 The nothing Structure
371(3)
15.2 The noncopyable Class
374(2)
15.3 A Template timer Class
376(3)
15.4 Linear Interpolation
379(3)
15.5 A circular_buffer Template Class
382(4)
15.6 The Boost Library
386(3)
References
387(2)
16 Extending the C++ Standard Library and the STL
389(38)
16.1 Defining the Custom dynamic_array Container
389(3)
16.2 Implementing and Using dynamic_array
392(4)
16.3 Writing Parts of the C++ Library if None Is Available
396(1)
16.4 Implementation Notes for Parts of the C++ Library and STL
396(9)
16.5 Providing now () for <chrono>'s High-Resolution Clock
405(2)
16.6 Extended-Complex Number Templates
407(3)
16.7 An Embeddable Big Integer Class
410(4)
16.8 Customizing <random>
414(10)
16.9 Freestanding Implementation
424(3)
References
425(2)
17 Using C-Language Code in C++
427(8)
17.1 Accessing C Language Code in C++
427(1)
17.2 An Existing C-Language CRC Library
428(2)
17.3 Wrapping the C-Based CRC Library with C++ Classes
430(3)
17.4 Return to Investigations of Efficiency and Optimization
433(2)
References
434(1)
18 Additional Reading
435(4)
18.1 Literature List
435(4)
References
437(2)
A A Tutorial for Real-Time C++
439(38)
A.1 C++ Cast Operators
439(1)
A.2 Uniform Initialization Syntax
440(3)
A.3 Overloading
443(1)
A.4 Compile-Time Assert
443(1)
A.5 Numeric Limits
444(4)
A.6 STL Containers
448(2)
A.7 STL Iterators
450(3)
A.8 STL Algorithms
453(4)
A.9 Lambda Expressions
457(1)
A.10 Initializer Lists
458(2)
A.11 Type Inference and Type Declaration with auto and decltype
460(2)
A.12 Range-Based for(:)
462(1)
A.13 Tuple
462(4)
A.14 Regular Expressions
466(2)
A.15 The <type_traits> Library
468(3)
A.16 Using std: : any and std: : variant
471(3)
A.17 Structured Binding Declarations
474(1)
A.18 Three-Way Comparison
475(2)
References
475(2)
B A Robust Real-Time C++ Environment
477(6)
B.1 Addressing the Challenges of Real-Time C++
477(2)
B.2 Software Architecture
479(1)
B.3 Establishing and Adhering to Runtime Limits
480(3)
References
481(2)
C Building and Installing GNU GCC Cross Compilers
483(10)
C.1 The GCC Prerequisites
483(1)
C.2 Getting Started
484(1)
C.3 Building GMP
485(1)
C.4 Building MPFR
486(1)
C.5 Building MPC
486(1)
C.6 Building PPL
487(1)
C.7 Building ISL
488(1)
C.8 Building the Binary Utilities for the Cross Compiler
488(2)
C.9 Building the Cross Compiler
490(1)
C.10 Using the Cross Compiler
491(2)
References
492(1)
D Building a Microcontroller Circuit
493(3)
D.1 The Circuit Schematic
493(2)
D.2 Assembling the Circuit on a Breadboard
495(1)
References 496(1)
Glossary 497(2)
Index 499
Christopher Kormanyos is a senior system architect at a major automotive supplier with more than 25 years of experience in software development, microcontroller system design and application deployment. Chris is well-connected in the microcontroller industry and has strong professional ties to both tier-one silicon suppliers as well as compiler and tool vendors. He received a PhD in experimental particle physics from the University of Colorado in 1994 and also holds several patents for automotive electronic technologies.