Muutke küpsiste eelistusi

Microprocessor: A Practical Introduction using the Arm Cortex-M0 Processor [Kõva köide]

(Indian Institute of Science, Bangalore, India), (Indian Institute of Science, Bangalore, India)
Teised raamatud teemal:
Teised raamatud teemal:
Provides a comprehensive introduction to microprocessor architecture and programming concepts, using the Arm® Cortex®-M0 processor as an example

The Microprocessor offers a supremely accessible and user-friendly introduction to microprocessor basics: instruction set, the exception model, system architecture and microcontroller programming. Explaining the working principles with simplified models, this first-level book builds the base for all onward courses at intermediate and advanced levels.

Filled with exercises that can be executed on the free version of Keil® Vision® MDK without any hardware, the book explains the essential aspects of microprocessor architecture with simple programming examples in assembly and C. By blending conceptual knowledge with practical exercises, the book offers valuable insights that equip readers to engage with real-world applications in the fields of microprocessor architecture and embedded systems.

List of Exercises x

Preface xiii

About This Book xv

How to Read This Book xvi

Acknowledgements xviii

About the Companion Website xix

Introduction xxi

Chapter 1 Microprocessor System 1

1.1 Introduction 2

1.2 Processor 3

1.3 Memory 5

1.4 Memory Devices 7

1.5 Bus 10

1.6 IO Ports 14

1.7 Reset, Clock and Power Management 16

1.8 Overview of Arm Cortex-M0 Processor 17

1.9 Summary 20

Chapter 2 Instruction Set Architecture 25

2.1 Introduction 25

2.2 Registers 27

2.3 Instruction Set 28

2.4 Structure of an Instruction 30

2.5 Data-Processing Instructions 33

2.6 Memory-Access Instructions 37

2.7 Program-Control Instructions 43

2.8 Summary 47

Chapter 3 Program Execution 49

3.1 Introduction 49

3.2 Program 50

3.3 Inside the CPU 52

3.4 Fetch Unit 55

3.5 Decode Unit 57

3.6 Execution Unit 59

3.7 Instruction Execution 63

3.8 Processor Pipeline 66

3.9 Summary 68

Chapter 4 Assembly Programming 71

4.1 Statements 72

4.2 Labels 73

4.3 Sections 75

4.4 Text Section 77

4.5 Data Sections 84

4.6 Summary 90

Chapter 5 Arithmetic Operations 93

5.1 Arithmetic Instructions 94

5.2 Unsigned Integers 96

5.3 Signed Integers 99

5.4 APSR Flags 101

5.5 Condition Codes 106

5.6 Summary 110

Chapter 6 Bit-Level Operations 113

6.1 Boolean Instructions 114

6.2 Bit Manipulation 116

6.3 Shift Operations 119

6.4 Word-Length Extension 125

6.5 Byte Ordering Instructions 127

6.6 Summary 129

Chapter 7 Load and Store Operations 131

7.1 Introduction 131

7.2 Alignment 133

7.3 Endianness 135

7.4 Basic Load and Store Operations 140

7.5 Data Types 142

7.6 Offset Addressing 145

7.7 Summary 153

Chapter 8 Branch and Subroutine 155

8.1 Program-Control Instructions 155

8.2 Branch 156

8.3 Conditional Branch 158

8.4 Indirect Branch 162

8.5 Subroutines 166

8.6 Nested Subroutines 169

8.7 Summary 173

Chapter 9 Stack Operations 175

9.1 Introduction 175

9.2 What Is a Stack? 177

9.3 Stack in Cortex-M 0 178

9.4 Stack Operations 180

9.5 Creating a Stack 182

9.6 Using the Stack 185

9.7 Local Variables 190

9.8 Summary 193

Chapter 10 Exceptions 195

10.1 Introduction 196

10.2 Exception Model 198

10.3 Vector Table 200

10.4 Reset 206

10.5 Faults 209

10.6 Exception Stack Frame 211

10.7 Summary 215

Chapter 11 SysTick and Core Interrupts 217

11.1 Introduction 218

11.2 SysTick 218

11.3 SysTick Programming Model 219

11.4 Programming SysTick 222

11.5 Using SysTick 224

11.6 Polling with SysTick 226

11.7 SysTick Interrupts 228

11.8 Interrupt Masking 232

11.9 Non-maskable Interrupt (NMI) 235

11.10 Summary 237

Chapter 12 Introduction to C Programming 239

12.1 Programming Languages 240

12.2 Structure of a C Program 241

12.3 Functions 244

12.4 Data 247

12.5 Header Files 250

12.6 Overview of C Language 257

12.7 Summary 259

Chapter 13 Basic Data Types 263

13.1 Characters and Strings 263

13.2 Integers 268

13.3 Floating-Point Numbers 277

13.4 Floating-Point Operations 280

13.5 Type-Casting 284

13.6 Summary 285

Chapter 14 Functions 289

14.1 Function Calls 290

14.2 Arguments 292

14.3 Local Variables 295

14.4 Conditional Execution 297

14.5 Selection 301

14.6 Loops 305

14.7 Summary 312

Chapter 15 Extended Data Types 315

15.1 Arrays 315

15.2 Structures 319

15.3 Pointers 323

15.4 Arrays and Pointers 327

15.5 Pointer to a Structure 330

15.6 Pointer Arithmetic 332

15.7 Uninitialized Pointers 334

15.8 Summary 339

Chapter 16 Compilation Process 341

16.1 Overview of the Compilation Process 342

16.2 Preprocessing 345

16.3 Compilation 348

16.4 Assembler 354

16.5 Linker 357

16.6 Executable Program 361

16.7 Summary 364

Chapter 17 Microcontroller 367

17.1 Introduction 368

17.2 Block Diagram 369

17.3 Pin Diagram 372

17.4 Reset, Clock and Power Management 373

17.5 Peripheral Interrupts 379

17.6 Peripheral Registers 382

17.7 Peripheral API 387

17.8 Summary 389

Chapter 18 IO Programming 393

18.1 IO Devices 394

18.2 GPIO 396

18.3 Timer 400

18.4 ADC 403

18.5 DAC 407

18.6 UART 410

18.7 Interrupts 414

18.8 Summary 419

Chapter 19 Microprocessor Applications 423

19.1 LED Brightness Controller 424

19.2 Ambient Light Sensor 427

19.3 Energy-Efficient Coding 430

19.4 Temperature Monitoring 433

19.5 Motor Speed Control 435

19.6 Summary 441

Appendix A Programming Environment 443

A.1 Introduction 444

A.2 Keil MDK 446

A.3 Assembly Programming Setup 449

A.4 Writing and Building Assembly Programs 452

A.5 Debugging an Assembly Program 454

A.6 c Programming Setup 458

A.7 Writing and Building C Program 460

A.8 Debugging A C Program 461

A.9 Debugger 464

Appendix B Advanced Topics 467

B.1 System-Control Instructions 467

B.2 OS Support 470

Appendix C Startup Code 475

C.1 OS-Less System 475

C.2 Startup Code 478

C.3 Linker Script File 481

Appendix D AM0 Header Files 483

D.1 Register Header File 483

D.2 AM0 Header File 484

Glossary of Acronyms 487

References 491

Index 493

Darshak S. Vasavada has extensive corporate as well as teaching experience in embedded DSP and multimedia systems. At present, he teaches real-time embedded system design at Robert Bosch Center for Cyber-Physical Systems at Indian Institute of Science, Bangalore.

S. K. Sinha, retired from Department of Electronic Systems Engineering (DESE, earlier known as CEDT), Indian Institute of Science, Bangalore, set up the first embedded systems lab at CEDT and has helped introduce MTech courses in several colleges in India. At present, he is Chief Architect at Lab To Market Innovations, specializing in reliable IIoT systems.

The authors have contributed to several workshops on embedded systems for teachers and students in various colleges, which have been the source of motivation behind this book.