What This Book Covers
Chapter 1, Setting Up the Tools of the Trade
This chapter introduces the essential tools you’ll need for development. From navigating datasheets to setting up your Integrated Development Environment (IDE), this chapter lays the groundwork for everything that follows.
Chapter 2, Constructing Peripheral Registers from Memory Addresses
In this chapter, we dive into the core of bare-metal programming. You’ll learn how to define and access peripheral registers directly from memory addresses, using the official microcontroller documentation as your guide.
Chapter 3, Understanding the Build Process and Exploring the GNU Toolchain
In this chapter, we take a closer look at the embedded C build process. You’ll explore how to compile and link code manually using the GNU Toolchain, gaining complete control over how your firmware is created.
Chapter 4, Developing the Linker Script and Startup File
In this chapter, you will learn how to write a custom linker script to define how your firmware is placed in the microcontroller’s memory, including allocating sections like code, data, and stack. Additionally, you’ll develop a startup file that configures the microcontroller’s initial state, sets up the stack, initializes memory, and jumps to your main code.
Chapter 5, The “Make” Build System
Automating the build process is a critical part of embedded development. This chapter teaches you how to use the Make build system to streamline your workflow by creating custom Makefiles that automate repetitive tasks.
Chapter 6, The Common Microcontroller Software Interface Standard (CMSIS)
CMSIS simplifies development on ARM Cortex microcontrollers. In this chapter, you’ll learn how to leverage CMSIS to write efficient code that takes advantage of the microcontroller’s features while maintaining simplicity.
Chapter 7, The General-Purpose Input/Output (GPIO) Peripheral
GPIO allows your microcontroller to interact with external devices. This chapter guides you through developing both input and output drivers for GPIO, one of the most frequently used peripherals in embedded systems.
Chapter 8, System Tick (SysTick) Timer
Timing is essential in embedded systems, and the SysTick timer provides an easy way to generate precise time delays and system ticks. This chapter walks you through developing SysTick drivers for use in your embedded applications.
Chapter 9, General-Purpose Timers (TIM)
This chapter introduces you to the general-purpose timers (TIM) in STM32 microcontrollers, teaching you how to develop timer drivers for tasks that require precise timing.
Chapter 10, The Universal Asynchronous Receiver/Transmitter Protocol
Communication is a key aspect of embedded systems. This chapter focuses on the UART protocol, one of the most widely used communication protocols. You’ll learn how to develop UART drivers, enabling your microcontroller to send and receive data from external devices.
Chapter 11, Analog-to-Digital Converter (ADC)
Many embedded applications require converting analog signals into digital data that your microcontroller can process. This chapter covers how to configure the ADC peripheral, allowing you to read and convert analog inputs into meaningful digital values.
Chapter 12, Serial Peripheral Interface (SPI)
SPI is a high-speed communication protocol commonly used in embedded systems. This chapter guides you through developing SPI drivers, enabling efficient communication between your microcontroller and other peripherals, such as sensors or memory devices.
Chapter 13, Inter-Integrated Circuit (I2C)
I2C is another popular communication protocol for connecting devices, it is often used for short-distance communication in embedded systems. This chapter covers the development of I2C drivers, allowing your microcontroller to communicate with multiple devices over a shared bus.
Chapter 14, External Interrupts and Events (EXTI)
Responsiveness is critical in embedded systems, and external interrupts allow your system to react to changes in its environment. This chapter covers how to configure and manage external interrupts and events (EXTI) for timely and efficient responses to external stimuli.
Chapter 15, The Real-Time Clock (RTC)
For systems that require accurate timekeeping, the RTC peripheral is indispensable. In this chapter, you’ll learn how to set up and use the RTC to track time in low-power systems, even when the microcontroller is in sleep mode.
Chapter 16, Independent Watchdog (IWDG)
Stability is crucial for embedded systems, and the Independent Watchdog Timer (IWDG) ensures that your system can recover from unexpected malfunctions. This chapter teaches you how to configure the IWDG to automatically reset your microcontroller if it stops responding, ensuring reliable operation.
Chapter 17, Direct Memory Access (DMA)
Direct Memory Access (DMA) allows data transfers to occur independently of the CPU, significantly improving system efficiency. This chapter covers how to configure and use DMA for memory-to-memory transfers, as well as for peripherals like ADC and UART, offloading the work from the CPU.
Chapter 18, Power Management and Energy Efficiency in Embedded Systems
Power management is essential for energy-efficient systems, especially in battery-powered devices. In this final chapter, you’ll learn techniques for reducing power consumption, including how to use sleep modes, wake-up sources, and optimize firmware to achieve the best balance between performance and energy efficiency.