Yifeng Zhu
Embedded Systems with ARM Cortex-M Microcontrollers
in Assembly Language and C (Fourth Edition)
ISBN-13: 978-0982692677, Publisher: E-Man Press LLC; 4th edition (January 2023)
Available from Amazon, Walmart
Home / Introduction / Adoptions / Instructor Site / Sample Labs / Lab Kit / Tutorials / FAQ

I hear and I forget. I see and I remember. I do and I understand.
Confucius (Chinese philosopher, 551–479 BC)

What are the changes in the third edition?

Significant changes in the third edition include updated serial communication description (UART, SPI, and I2C), new serial communication examples, incorporation of GNU gcc compiler, low power modes, modification of example programs from STM32L1 (Cortex-M3) to STM32L4 (Cortex-M4).

What are the changes in the second edition?

The second edition includes three new topics, including floating-point programming (FPU), interfacing with external HD44780-compatible LCD, and digital signal processing (DSP). The inclusion of FPU and DSP expands the coverage of this book to Cortex-M4 and Cortex-M7 processors. The second edition has restructured some chapters to make the book easier to follow.

Why learn embeded systems?

Modern embedded systems exploit a single highly integrated chip consisting of one or more general-purpose processor cores, memories, advanced peripherals, digital logic, and miniaturized sensors. Due to small power dissipation, low fabrication cost, and small size, such a System-on-Chip (SoC) becomes increasingly more popular in many embedded applications, including cellphones, MP3 players, GPS, smart watches, medical devices, fitness gadgets, and automobile control. ARM Cortex processors are of one of such successful SoC chips in industry.

What are featured in this book?

The book introduces basic programming of ARM Cortex-M cores in assembly and C at the register level, and the fundamentals of embedded system design. It presents basic concepts such as data representations (integer, fixed-point, floating-point), assembly instructions, stack, and implementing basic controls and functions of C language at the assembly level. It covers advanced topics such as interrupts, mixing C and assembly, direct memory access (DMA), system timer (SysTick), multi-tasking, SIMD instructions for digital signal processing (DSP), and instruction encoding/decoding. The book also gives detailed examples of interfacing peripherals, such as general purpose I/O (GPIO), LCD driver, keypad interaction, stepper motor control, PWM output, timer input capture, DAC, ADC, real-time clock (RTC), and serial communication (USART, I2C, SPI, and USB).

The book has the following features:

  • Focusing on register-level programming on bare metal hardware, with no or minimum usage of STM, CMSIS, and ARM APIs
  • Emphasis on structured programming and top-down modular design in both C and assembly language
  • Line-by-line translation and comparison between C and ARM assembly
  • Mixture of C and assembly languages, such as a C program calling assembly subroutines, and an assembly program calling C subroutines
  • Balance between theory and practical examples
  • Valuable knowledge that prepares students for the courses of computer architecture and operating systems

Why learn assembly programming?

Although assembly languages are used relatively less in modern embedded systems, learning assembly languages is still very important. First, an assembly language is not another programming language. It is a low-level interface between hardware and software. It provides a better understanding of how a processor executes a program. Assembly programming is the prerequisite knowledge of compilers, operating systems, and computer architecture. Secondly, assembly programs can potentially run faster than programs developed in high-level languages such as C. Compilers sometimes cannot fully exploit the hardware features of a specific processor, particularly when the processor provides specific operations that compilers do not know. Therefore, it is often that some speed-sensitive portion of an application is written in assembly language. Thirdly, some operations have to be performed in assembly language because there is no equivalent statement in high-level languages. This is why assembly programs are often embedded in operating system kernel codes to implement low-level tasks, such as booting and CPU scheduling. Finally yet importantly, understanding how high-level constructs are translated into low-level assembly instructions can help programmers to write more efficient codes in high-level languages.

The audience for this book includes those who want to gain knowledge of the inner working of a System-on-Chip (SoC), and experiences of designing embedded systems at low level. This book would serve better as text or reference material if readers have learned some basic C programming. The book covers both basic concepts and advanced topics, suitable for a wide range of audience.