Home IoT & Hardware The Insider's Guide to Arm Cortex-M Development

The Insider's Guide to Arm Cortex-M Development

By Zachary Lasiuk , Pareena Verma , Jason Andrews
books-svg-icon Book
eBook $37.99 $25.99
Print $46.99
Subscription $15.99 $10 p/m for three months
$10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
BUY NOW $10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
eBook $37.99 $25.99
Print $46.99
Subscription $15.99 $10 p/m for three months
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
  1. Free Chapter
    Chapter 1: Selecting the Right Hardware
About this book
Cortex-M has been around since 2004, so why a new book now? With new microcontrollers based on the Cortex-M55 and Cortex-M85 being introduced this year, Cortex-M continues to expand. New software concepts, such as standardized software reuse, have emerged alongside new topics including security and machine learning. Development methodologies have also significantly advanced, with more embedded development taking place in the cloud and increased levels of automation. Due to these advances, a single engineer can no longer understand an entire project and requires new skills to be successful. This book provides a unique view of how to navigate and apply the latest concepts in microcontroller development. The book is split into two parts. First, you’ll be guided through how to select the ideal set of hardware, software, and tools for your specific project. Next, you’ll explore how to implement essential topics for modern embedded developers. Throughout the book, there are examples for you to learn by working with real Cortex-M devices with all software available on GitHub. You will gain experience with the small Cortex-M0+, the powerful Cortex-M55, and more Cortex-M processors. By the end of this book, you’ll be able to practically apply modern Cortex-M software development concepts.
Publication date:
October 2022
Publisher
Packt
Pages
276
ISBN
9781803231112

 

Selecting the Right Hardware

It may be surprising that the first chapter of this book, which is written for Cortex-M software developers, is all about hardware. This is because software, in all its forms, is ultimately run on hardware. It is critical to understand which hardware capabilities exist to properly leverage them in software.

Additionally, you will likely need a development board for debugging your code during development. Some of you reading may even have a level of influence over which hardware is ultimately selected for your device. All in all, no matter what specific situation you are in, understanding what Cortex-M hardware is out there—and what it can do—will help you develop quality software for your current and future projects.

So, in this opening chapter, we will explain how to select Cortex-M hardware and provide an overview of where to find development boards. Note that we will be discussing both individual Cortex-M processors and Cortex-M development boards.

There are different ways to frame which Cortex-M hardware is best suited for your specific project. Examples can be helpful; the first section of this chapter lists common embedded/IoT use cases and presents Cortex-M processors that fit that situation. The side-by-side comparison is also helpful; the second section ranks processors by performance, power, and area metrics. The third section then focuses on development boards, discussing trade-offs.

The chapter ends by selecting two boards that will be used for hands-on examples in future chapters. In a nutshell, the topics we’ll discuss in this chapter are presented here:

  • Processor selection through use cases
  • Processor selection based on performance and power
  • Microcontroller development boards
 

Processor selection through use cases

IoT and machine learning (ML) applications are not only rapidly evolving and changing the way modern businesses operate but also transforming our everyday experiences. As these applications evolve and become more complex, it is essential to make the right hardware choices that meet application requirements. Ultimately, the processor choice comes down to the right balance of functionality, cost, power, and performance. Defining your use case and workload requirements makes determining this balance a lot simpler.

In this section, we will walk through the requirements of some common consumer embedded use cases and determine the Arm Cortex-M processor choices that are ideally suited. The list of use cases and the resulting processor selections are not exhaustive, mainly highlighting that if workload requirements are well understood, the processor decision-making process becomes much easier.

Medical wearable

Let’s start with a smart medical wearable use case. The requirements of this wearable include that it will be a wrist-worn device, with long battery life and special sensors to continuously monitor heart activity. Security is a vital requirement as the wearable stores private medical data. Processing power is equally important, operating within the size and power constraints of a battery-operated wearable.

For this case, the Arm Cortex-M33 processor provides an excellent combination of security, processing power, and power consumption. Cortex-M33 includes security features for hardware-enforced isolation, known as TrustZone for Cortex-M. It reduces the potential for attacks by creating isolation between the critical firmware and the rest of the application. The Cortex-M33 has many optional hardware features including a digital signal processing (DSP) extension, memory protection unit (MPU), and a floating-point unit (FPU) for handling compute-intensive operations. The Arm custom instruction and coprocessor interface in the Cortex-M33 provide the customization and extensibility to address processing power demands while still decreasing power consumption.

Note that these hardware features are optional; once manufactured and sold, these features are either present or not. Make sure to check whether the microcontroller or development board you are buying has these Arm Cortex-M processor features enabled if desired.

Industrial flow sensor

Let’s take another use case as an example. Say you’re designing an industrial flow sensor that will be used to measure liquids and gases with great accuracy. It needs to be extremely reliable and have a small form factor. The primary requirement is that it will be low-power and work with this accuracy standalone for very long periods of time. A great central processing unit (CPU) choice for designing such an industrial sensor is the Arm Cortex-M0+, which combines low power consumption and processing-power capabilities. It is the most energy-efficient Cortex-M processor with an extremely small silicon area, making it the perfect fit for such constrained embedded applications.

IoT sensor

There are several use cases in the embedded market that require demanding DSP workloads to be executed with maximized efficiency. With the advancements in IoT, there has been an explosion in the number of connected smart devices. There are so many different sensors connected within these devices to collect data for measuring temperature, motion, health, and vision. The sensor data collected is often noisy and requires DSP computation tasks—for example, applying filters to extract the clean data. The Cortex-M4, Cortex-M7, Cortex-M33, and Cortex-M55 processors come with a DSP hardware extension addressing various performance requirements for different signal-processing workloads. They also have an optional FPU that provides high-performance generic code processing in addition to the DSP capabilities. If your workload requires the highest DSP performance, the Cortex-M7 is a great choice. The Cortex-M7 is widely available in microcontrollers and offers high performance due to its six-stage dual-issue instruction pipeline. It is also highly flexible with optional instruction and data caches and tightly coupled memory (TCM), making it easy to select a processor that has been manufactured to meet your specific application needs. Security has become a common requirement for sensors on connected devices to provide protection from physical attacks. If security is an essential requirement for your sensor application in addition to DSP performance, then Cortex-M33 could be a great fit with its TrustZone hardware security features.

With some of the newer sensing and control use cases, we see a common need for not only signal processing but also ML inference on endpoint devices. ML workloads are typically very demanding in terms of computation and memory bandwidth requirements. The significant advancements made in ML via optimization techniques have now made it possible for ML solutions to be deployed on edge devices.

ML

The primary use cases for ML on edge devices today are keyword spotting, speech recognition, object detection, and object recognition. The list of ML use cases is rapidly evolving even as we write this book, with autonomous driving, language translation, and industrial anomaly detection. These use cases can be broadly classified into three categories, as outlined here:

  • Vibration and motion: Vibration and motion are used to analyze signals, monitor health, and assist with several industrial applications such as predictive maintenance and anomaly detection. For these applications, the installed sensors (generally accelerometers) are used to gather large amounts of data at various vibration levels. Signal processing is used to preprocess the signal data before any decision-making can be done using ML techniques.
  • Voice and sound: Voice applications are in several markets, and we’ve become quite familiar with voice assistants through the deployment of smart speakers. Many other voice-enabled solutions are coming to the mass market. The voice-capture process consists of one or several microphones used for voice keyword detection. Keyword spotting and automatic speech recognition are the primary demanding computing operations of these voice-enabled devices. These tasks require significant DSP and ML computation.
  • Vision: Vision applications are used in several areas for recognizing objects, being able to both sort and spot defects, and detecting movement. There is an increasing number of vision-based ML applications ranging from video doorbells and biometrics for face-unlocking to industrial anomaly detection.

Cortex-M processors ranging from the Cortex-M0 to the latest Cortex-M85 can run a broad range of these ML use cases at different performance points. Mapping the different workload performance needs and latency requirements of these use cases to the CPU’s feature capabilities greatly simplifies the process of hardware selection. The following diagram illustrates the range of ML use cases run on the Cortex-M family of processors today:

Figure 1.1 – ML on Cortex-M processors

Figure 1.1 – ML on Cortex-M processors

For example, say you’re designing a smart speaker that is an always-on voice activation device—the Cortex-M55 is a great choice. The Cortex-M55 is a highly capable artificial intelligence (AI) processor in the Cortex-M series of processors. It’s the first in the Arm Cortex-M family of processors to feature the Helium technology, which provides a significant performance uplift for DSP and ML applications on small, embedded devices. Arm Helium technology is also known as the M-Profile Vector Extension (MVE), which adds over 150 new scalar and vector instructions and enables efficient computation of 8-bit, 16-bit, and 32-bit fixed-point data types. Signal processing-intensive applications such as audio processing widely use the 16-bit and 32-bit fixed-point formats. ML algorithms widely use 8-bit fixed-point data types for neural network (NN) computations. The Helium technology makes running ML workloads much faster and more energy-efficient in endpoint devices.

In Figure 1.1, there is also mention of Ethos-U55. This is not a CPU like the other Cortex-M processors but is instead a micro neural processing unit (NPU). It was developed to add significant acceleration to ML workloads while being small enough to be implemented in constrained embedded/IoT environments. When combined with the Cortex-M55, the Ethos-U55 provides a 480x uplift in ML performance compared to Cortex-M-based systems without the Ethos-U55! Keep an eye out for microcontrollers and boards that utilize the Ethos-U55, and learn more about it from a high level here: https://www.arm.com/products/silicon-ip-cpu/ethos/ethos-u55.

To summarize this section, one way to select processors is by understanding the use case, clearly defining requirements, ranking them, and identifying project constraints. This is a great place to start the processor selection process.

Next, we will look at using performance and power as metrics to analyze processor selection choices.

 

Processor selection based on performance and power

Another way to choose and understand Cortex-M processors is by ranking, based on how well they match performance and power requirements. Without structure, this can be a daunting task, with a wide range of possibilities (from the number of interrupts to the overall price, and everything in between). In this section, we will define six categories to evaluate and go over a few examples of how to use this in practice to select the right processor for your project. Again, this is also a helpful framework for understanding what Cortex-M processors’ capabilities are.

We will select the right processor using an approach we will call requirement heuristics. This means translating your key project requirements into predefined areas and following simple steps to get to the right Cortex-M processor. The six areas are listed here:

  • Power
  • DSP performance
  • ML performance
  • Security
  • Safety
  • Cost

In each area, we rank the processors that best meet the project requirement. You can then select the areas that matter most to your project and find the processor that meets these needs. Let’s discuss each area before showing some examples.

Power

Minimizing power consumption is crucial in highly constrained power environments. A common use case is in distributed sensors that require long periods of continuous operation without being serviced.

When looking at power metrics, there are a few things that will help in understanding technical jargon. There are often two types of power measurements: static (or leakage) power consumption and dynamic power consumption. Static power consumption measures the amount of power used by the processor when not actively processing anything, such as being in a “sleep” mode but with the power still on. Dynamic power consumption measures the power consumed when the processor is actively working on a task. Often, dynamic power is measured using an industry-standard software workload called Dhrystone, to enable consistent comparisons. Power is measured in microwatts (uW)/megahertz (MHz). It is defined as power per MHz to enable consistent comparisons between processors running at different frequencies.

The following table shows the dynamic power of the different Cortex-M processors on the same node size:

Table 1.1 – Dynamic power across different Cortex-M processors on 40 LP node size

Table 1.1 – Dynamic power across different Cortex-M processors on 40 LP node size

Another factor that affects the power consumption of the core is the technology node size used to manufacture the silicon. This can be referred to as “technology," "process node," or just "node," depending on the context. The node size refers generally to the physical size of the transistors; as the node size decreases, more transistors can be packed onto the same-size silicon wafer. Smaller node sizes also generally lead to reduced power consumption, both static and dynamic. Understanding the node size is helpful for accurately comparing different chips or boards.

Using a consistent node size of 40 nm and publicly available benchmarking data, we can rank the Cortex-M processors on the low-power axis, like so:

Figure 1.2 – Ranking power consumption for Cortex-M

Figure 1.2 – Ranking power consumption for Cortex-M

Note that the processors in the preceding screenshot are ordered from best, starting from the top. In this case, the processors requiring lower power for operation are ranked visually higher. We are also not displaying all the Cortex-M processors in this (and subsequent) screenshots—we’re only displaying processors that perform well in the category. The spacing between processors is not intended to communicate precise quantitative differences, only a general ranking based on power consumption. The dotted line is also intended as a qualitative distinction, indicating a notable separation between the processor capabilities on this axis.

The Cortex-M0+ comes in first, as one of the lowest-power 32-bit processors on the market. It can get as low as 4 uW/MHz in dynamic power consumption when manufactured at 40 nm. This processor is being used at the forefront of low-power technologies. It can even be used in applications without a battery, relying on energy harvesting from the environment to power the device. Now that is low power! We talk about energy harvesting and ultra-low-power applications in Chapter 10, Looking Ahead.

The Cortex-M23 is essentially tied with the Cortex-M0+ in terms of minimizing power. It can achieve similar power figures as the Cortex-M0+ when configured minimally. The security features increase power consumption when included. Overall, given how new the Cortex-M23 is and that it is being used more often at lower node sizes such as 28 nm and below, the Cortex-M23 is equally viable for minimizing power consumption.

The Cortex-M0 also minimizes power draw and is only slightly behind the Cortex-M0+ and Cortex-M23. The Cortex-M0+ is typically a better option than the Cortex-M0, being so closely related.

The Cortex-M33, Cortex-M3, and Cortex-M4 all have about triple the power draw as the Cortex-M0+. If the lower-power-consumption processors do not have enough processing power or features for your use case, these processors are likely a good fit.

DSP performance

DSP is needed when taking real-world signals and digitizing them to perform some computations. This is exceedingly common in movement, image, or audio processing applications when data is coming in real time. Devices with sensors and motors to detect and act on real-time data rely heavily on DSP.

The computational nature of these types of DSP applications is really centered on what we call scalar processing. You may be familiar with the word scalar from math or physics classes. A scalar is a quantity that has only one characteristic. For example, measuring gas pressure 10 times a second for 1 second will produce 10 data points. Each point has one characteristic: the magnitude of the gas pressure at that instant. These types of DSP applications, which include audio processing as well, lend themselves well to scalar processing.

To measure how good Cortex-M processors are at scalar processing, there are two common benchmarks: CoreMark and Dhrystone. Using these imperfect but generally helpful benchmarks, you can compare how well different processors run scalar workloads such as the DSP use cases discussed previously. You can download and view the Dhrystone (Dhrystone Million Instructions per Second (DMIPS)/MHz) and CoreMark scores for all Cortex-M series processors here: https://developer.arm.com/documentation/102787/.

Using these publicly available CoreMark benchmark scores compiled with the Arm Compiler for Embedded, we can rank the Cortex-M processors in terms of DSP performance, as follows:

Figure 1.3 – Ranking DSP performance for Cortex-M

Figure 1.3 – Ranking DSP performance for Cortex-M

The benchmark numbers quoted next are valid at the time of this book’s publication. Due to subtle changes in firmware, benchmarks, and compilers, the numbers may change slightly over time. These changes will be small, and the rankings listed are still directionally accurate.

As the newest Arm Cortex-M processor, the Cortex-M85 provides the highest scalar and signal-processing performance to date in the Cortex-M family. It boasts a CoreMark score of 6.28 CoreMark/MHz, is suitable for the most demanding DSP applications, and also includes TrustZone security features.

The Cortex-M7, while being superseded by Cortex-M85, is still a good choice for less demanding DSP applications or where functional safety is critical. The Cortex-M7 has a CoreMark score of 5.29.

The Cortex-M55 and Cortex-M33 are similar in scalar performance, with a CoreMark score of 4.4 and 4.1 respectively.

The Cortex-M4 and Cortex-M3 are the next steps down in performance, with CoreMark scores of 3.54 and 3.44 respectively. The Cortex-M4 is better with DSP use cases due to its optional FPU (which the Cortex-M3 does not have). The Cortex-M4 is commonly used in sensor fusion, motor control, and wearables. The Cortex-M3 is used for more balanced applications with lower area and power requirements.

Applications involving video processing are more demanding than traditional DSP software and benefit from simultaneous processing, called vector processing. Vector processing accelerates the most popular workload today—ML.

ML performance

Because of its increased popularity and potential in edge devices, we will devote an entire chapter to ML in Chapter 6, Leveraging Machine Learning. In this section, we will give an overview of how ML workloads are executed in hardware to identify the right Cortex-M processor for the job.

ML, at a computational level, is matrix math. NNs are represented by layers of neurons, with each neuron in one layer being connected to each neuron in the next layer. When an input is given (such as a picture of a cat to an image recognition network), it gets separated into distinct features and sent through each layer, one at a time. In practice, this means at each layer, there is x number of inputs going into n number of nodes. This leads to x*n computations at each layer, of which there could be dozens, with potentially hundreds of nodes in each layer.

In scalar computing, this could result in tens of thousands of calculations performed one after the other. In vector computing, you instead store each node’s value in a row (or lane) and make x*n calculations all at once. This is the benefit of vector processing, which has existed in larger Arm cores for years via NEON technology. The Helium extension brings this technology to Cortex-M processors without significantly increasing area and power.

Using matrix multiplication performance as a benchmark, we can rank the Cortex-M processors in terms of ML performance, like so:

Figure 1.4 – Ranking ML performance for Cortex-M

Figure 1.4 – Ranking ML performance for Cortex-M

The Cortex-M85 processor boasts the most recent implementation of the Helium vector processing technology. It brings more ML functionality to edge devices and enhances applications such as robotics, drones, and smart home control.

The Cortex-M55 processor was the first Cortex-M processor with Helium vector processing technology. It brings anomaly and object detection use cases to the edge when implemented standalone. When paired with an NPU (such as the Ethos-U55 discussed earlier in this chapter), gesture detection and speech recognition use cases can be unlocked while still controlling power consumption and cost. Even by itself, the Cortex-M55 has about an order of magnitude (OOM) better ML performance than the next closest, the Cortex-M7.

The Cortex-M7 processor is a superscalar processor, meaning it enables the parallelization of scalar workloads. This effectively allows it to run DSP applications faster, but the more computationally intensive ML use cases are more of a challenge. This processor is suitable for basic ML use cases such as vibration and keyword detection.

The Cortex-M4 processor is often stretched to its computational limits when applied to ML use cases. In most cases, it should only be considered if the ML use case is around vibration/keyword detection or sensor fusion, and there is a strict power or cost constraint.

Security

As the importance and ubiquity of IoT devices have increased in people’s lives, security has become a strong requirement. The basics of security such as cryptographic password storage are no longer acceptable. As the value and volume of what is stored on edge devices increases, malicious actors get proportionally more incentivized for hacks.

We will also devote Chapter 7, Enforcing Security, to the topic of security and dive into more specifics there. This section will give you an overview of the key considerations to remember when selecting a processor with security in mind. To successfully secure your software and project, the underlying hardware needs to enable some essential features such as software isolation, memory protection, secure boot, and more. Arm has implemented a security extension to the newer Cortex-M processors called TrustZone that enhances these security basics, adds more functionality in hardware, and makes security implementations easier. TrustZone enables you to physically isolate sections of memory or peripherals at the hardware level, making hacks more difficult and more contained if they do occur. The full details, benefits, and a quick-start guide for this extension will be provided in a later chapter.

Note that this is an optional extension, so make sure to verify it is enabled for the processor in any development board you are considering.

Using TrustZone and additional security features as a guide, we can rank the Cortex-M processors in terms of security features, as follows:

Figure 1.5 – Ranking security for Cortex-M processors

Figure 1.5 – Ranking security for Cortex-M processors

In practice, these processors all contain the TrustZone security extension and are all excellent options for developing a secure project. They are all based on the Armv8-M instruction architecture, with the other Cortex-M processors being based on Armv7-M or Armv6-M. They are ordered in terms of most recently released, but other requirements such as low power, ML, or DSP performance should decide which of these processors to select. Note that Arm also has a Platform Security Architecture (PSA) certification that validates the security implementations at the development-board level.

The PSA and TrustZone implementations in software are all discussed more in Chapter 7, Enforcing Security. Resources to learn more about the different Arm instruction sets (outside the scope of this book) are listed under the Further reading section at the end of this chapter.

Important note

The Cortex-M35P processor is a specialized processor that is intended for the highest level of security. It features built-in tamper resistance and physical protection from invasive and non-invasive attack vectors. Basically, it is ideal for devices that protect valuable resources but are accessible by the public, such as a smart door lock. The core is similar to the Cortex-M33, adding that physical layer of protection. If your product needs physical, tamper-proof security as the primary requirement, this is definitely a Cortex-M processor to consider.

Safety

In the embedded space, safety requirements typically come when in a regulated, safety-critical environment. These safety requirements can be categorized as either diagnostic requirements or systematic requirements. Diagnostic requirements relate to the management of random faults on the device and are addressed by the addition of hardware features for fault detection (FD) and control. Systematic requirements relate to demonstrating the avoidance of systematic failures and are addressed typically through the design process and verification.

Products sold to high-safety environments must prove a level of risk reduction as defined by international standards. The International Electrotechnical Commission (IEC) 61508 standard defines general Safety Integrity Levels (SILs), with SIL 4 being the most strict and SIL 1 being the least strict. The automotive industry has a dedicated level system, the Automotive Safety Integration Level (ASIL), with ASIL D being the strictest and ASIL A being the least strict.

Some common safety features include the following:

  • Exception handling, which prevents software crashes in the case of system faults.
  • MPUs that ensure data integrity from invalid behavior.
  • Software test libraries (STLs) test for faults at startup and runtime. Note that this is not a feature of the processor, but instead, a suite of software tests provided to run on a specific processor.
  • Dual-Redundant Core Lockstep (DCLS), where two processors redundantly run the same code to uncover and correct system errors.
  • Error Correction Code (ECC), which automatically detects and corrects memory errors.
  • Memory Built-In Self-Test (MBIST) interfaces that enable memory integrity validation while the processor is running.

We can rank the Cortex-M processors in terms of safety features, showing the cutoff for which processors are capable of reaching certain safety levels, as follows:

Figure 1.6 – Ranking safety features of Cortex-M processors

Figure 1.6 – Ranking safety features of Cortex-M processors

The Cortex-M7 is alone in the Cortex-M family in offering ECC, MBIST, and DCLS features alongside the more common MPU and exception handling. The Cortex-M55, Cortex-M33, and Cortex-M23 contain almost all of those features, but are still capable of meeting the strict SIL 3 and ASIL D safety levels.

The Cortex-M4, Cortex-M3, and Cortex-M0+ all offer enough safety features to achieve the least strict SIL 2 and ASIL B safety levels with STLs, MPUs, and exception handling.

The Cortex-M35P processor is highly effective for safety applications as well as security applications. It contains most of the already listed safety features, adding in heightened observability to ensure expected behavior and more.

Now that we have looked at some key features that can drive your processor selection, let us look at how cost can impact this decision-making process.

Cost

Minimizing cost is a common requirement in deeply embedded and IoT spaces. When looking at microcontrollers or boards to purchase, the cost should be obvious and does not require much explanation.

We can, however, provide some context for what contributes to the cost of a microcontroller, with the largest factor here being the silicon area. As the area of a microcontroller increases, it requires more materials to make and thus intuitively raises costs. Production volume will also impact the cost. The higher the production volume, the lower the cost will be. Typically, the smaller the Cortex-M processor is, the less expensive it will be to manufacture, and thus the lower the price to purchase. We will review the Cortex-M processors with the lowest area so that you have a starting point to look for boards with these processors to have the best chance of minimizing your overall cost.

Important note

These Cortex-M processors are highly configurable, and the implementation of more features will increase the area and likely increase cost. In looking for a microcontroller or board while minimizing cost, make sure to select a product with only the minimum set of features you need to hold down the cost as much as possible.

Here are the Cortex-M processors ranked in terms of lowest possible area:

Figure 1.7 – Ranking area of Cortex-M processors

Figure 1.7 – Ranking area of Cortex-M processors

The Cortex-M0 and Cortex-M0+ are tied at the lowest area and are commonly found at the lowest price points. These are excellent choices for low-cost applications if they have enough functionality.

The Cortex-M23 is just behind the Cortex-M0 and Cortex-M0+ in terms of area. The Cortex-M23 has the benefit of enhanced security features, making it a great choice for low-cost connected use cases.

The Cortex-M3, Cortex-M4, and Cortex-M33 all follow, being notably larger than the previous Cortex-M processors. These are the next best options to look at when you need more functionality while keeping costs low.

With this background about selecting Cortex-M processors, let’s look at how to find development boards that include Cortex-M processors.

 

Microcontroller development boards

Now that we have introduced Cortex-M use cases and guidance on making processor selections based on use cases and other factors such as performance and power, let’s find some development boards and get started learning.

Numerous development boards are available with Cortex-M microcontrollers. While it’s impossible to provide a simple flow chart for how to select a Cortex-M microcontroller, we can provide an overview of the options and trade-offs as a starting point for narrowing the selection.

At the end of this chapter, we will pick two development boards and use those to demonstrate the concepts in the remainder of the book.

Suppliers

There are multiple suppliers for Cortex-M microcontrollers, and each supplier typically offers a wide range of options to optimize for specific markets and use cases. It’s common for a microcontroller supplier to offer hundreds of Cortex-M devices. Each supplier also offers a range of development boards to try out the devices and get started on projects quickly. Here is our recommended list of suppliers to get familiar with:

  • NXP
  • Infineon
  • STMicroelectronics
  • Nordic Semiconductor
  • Raspberry Pi
  • Nuvoton
  • Renesas
  • Silicon Labs
  • Analog Devices
  • Dialog Semiconductor

Microcontrollers and development boards are normally sold by distributors around the world. Some of the common distributors include the following:

  • Arrow
  • DigiKey
  • Arduino
  • CanaKit
  • Mouser
  • Adafruit

Popular boards may also be available online at places such as Amazon and Newegg.

Now that we know the microcontroller suppliers and where to find development boards, let’s review the primary factors to consider when selecting a microcontroller and a board.

 

Selecting development boards

In the previous sections, we reviewed several criteria for selecting a processor, as follows:

  • Use cases
  • Power
  • DSP performance
  • ML performance
  • Security
  • Safety
  • Cost

Selecting microcontrollers and development boards introduces a few new factors that impact performance and functionality. These include memory characteristics, power supplies, and peripherals.

Performance

Performance is driven by the compute requirements of software applications. Selecting hardware is always easier when the software is well understood, but it’s not always possible. When software is not available, similar applications can be used to estimate performance. There are a variety of industry benchmarks that may provide performance guidance.

As we have seen in previous sections, microcontroller performance is primarily determined by the Cortex-M processor microarchitecture. The next most important factor is memory.

Important CPU factors include the frequency, instruction pipeline, cache, TCM, floating-point hardware, and any special instructions for DSP or vector processing of larger units of data.

Different types of memory are also available in microcontrollers. Most microcontrollers use a mix of static random-access memory (SRAM) and flash memory. Flash memory can be reprogrammed numerous times and holds data when the power is removed. Flash is ideal for storing software instructions.

SRAM provides faster access compared to flash, but the contents are lost when power is removed.

Dynamic RAM (DRAM) may also be used in embedded systems when larger amounts of memory are required, and SRAM would be too expensive.

A common software strategy is to move important code and data from flash to SRAM after analyzing to improve performance.

Cortex-M microcontrollers are easy to use because they have a standard memory map that places read-only memory (ROM) or flash memory and SRAM at standard locations in the memory map. This makes it easy to set up regardless of the Cortex-M processor being used.

Looking at the memory access times is key to analyzing performance. Microcontrollers may contain caching systems to feed data from flash memory into a CPU much faster than making a single read access to flash and incurring waits. Instruction and data caches also improve access time to memory.

Memory size is also a key parameter for selecting a device. Most Cortex-M systems are memory-constrained. Running out of memory can be a challenge, so keep an eye on the size of each memory type.

Power

Power is driven by the operating environment of a product. Requirements to run on a battery, use a specific type of power supply, or maximum current and voltage values to work in each environment should be considered. Certainly, battery versus always plugged in makes a difference, but power consumption has become more complex than just leaving products plugged in and forgetting about power. Products and consumers are starting to focus on using less energy, even in IoT products that are always plugged in, because saving energy across a trillion IoT devices makes a significant difference. Consumers are starting to ask whether every IoT device needs to continuously monitor and report data even while they are sleeping.

Arm processors have a long history of being efficient and using a reasonable amount of power for the performance they provide. Cortex-M processors emphasize simplicity and low-power sleep modes when processing is not needed.

Development boards will provide technical specifications with power details. Using the board specifications in combination with what we have learned about individual Cortex-M processors will help with making good decisions about power.

Peripherals

One key distinction between the thousands of Cortex-M microcontrollers is the peripherals of each device. In fact, this is a common starting point when narrowing down options to make sure desired functionality is supported. The cost-sensitive nature of microcontrollers leads each vendor to develop families of products, selection guides, and tables of products that mix and match various factors such as processor features, peripherals, memory sizes, and temperature ranges. The tables of options can be overwhelming.

One way to understand peripherals is to break them down into a few categories. Today’s IoT devices perform data collection, processing, and data communication. Historically, embedded systems focused on input/output (I/O) pins to connect many types of hardware for data and control.

You can segment peripherals into categories through the following:

  • Input from the environment (collecting data from sensors)
  • Communication interfaces (storing data)
  • Digital and analog I/O signals to interface with additional hardware

A useful exercise to get an understanding of peripherals is to scan through a variety of microcontroller technical summary descriptions and see what is highlighted. These are the key factors the device vendor decided to highlight. This includes a combination of unique features and common features that many devices may have.

Here are some key highlights we found when looking across a variety of devices.

Cortex-M0 and Cortex-M0+ development boards

Some of the common features advertised for Cortex-M0 and Cortex-M0+ boards include general-purpose I/O (GPIO) pins and analog input pins. These allow projects to connect other digital and analog hardware to the board. A Universal Serial Bus (USB) is also common on most development boards for easy connection to software development tools. Some basic sensors may be included for things such as temperature or other climate sensors. Because of the focus on cost and simplicity, another key feature is the types of expansion connectors that are available. This allows users to expand in a generic way to add more interfaces for both data collection and communication to store data. Standardization of connectors brings better compatibility and a wider selection of add-on hardware.

Cortex-M3, Cortex-M4, and Cortex-M7 development boards

Development boards with these Cortex-M processors highlight IoT. Communication features to store data remotely are highlighted, so the boards can immediately be used for IoT applications. Common technologies are Bluetooth Low Energy (BLE), near-field communication (NFC), radio frequency (RF), and Wi-Fi. This class of boards also highlights more advanced sensors such as accelerometers and gyroscopes, as well as pulse width modulation (PWM) to control lights and motors. Analog-to-digital converters (ADCs) and digital-to-analog converters (DACs) are also common to interface with a variety of digital and analog hardware.

Many applications will be battery-powered, so battery types and means to power the boards are important.

Cortex-M23 and Cortex-M33 development boards

Cortex-M23 and Cortex-M33 development boards emphasize TrustZone features and support for Trusted Firmware-M (TF-M) to provide a trusted environment for secure storage and cryptography.

Interfaces for these development boards will be similar to the previous group but can be more advanced as the processors are newer and security features enable new applications. Communication interfaces include BLE, Wi-Fi, and Long-Term Evolution (LTE) modems. Specialized antennas may be available for advanced communication protocols such as a NarrowBand-IoT (NB-IoT) antenna. More complex features such as a stereo audio codec are common. Additional storage is possible using a microSD card slot.

Some development boards in all categories include a connector to measure the power of a running system. This helps to make it easy to measure actual power during system development.

Other factors

In addition to analyzing the Cortex-M processors, memory types, and peripherals, there are several secondary factors to consider when selecting microcontrollers and development boards.

Software

The most important factor is software, which is why we are writing this book. There are numerous software considerations, and these will be covered specifically in the next chapter. Topics are real-time operating system (RTOS) support, connectivity standards, software development kit (SDK) options and programming languages, and software libraries.

Development boards can also be certified by cloud service providers (CSPs) or serve as primary reference boards, for example, software to make it easier to get going right away with a particular RTOS, connectivity standard, or IoT platform for data collection and visualization.

When possible, it’s also good to use benchmark or representative software that is similar to the application to guide performance and code size in selecting the right development board.

Support community

An important secondary factor when selecting development boards is the ability to find answers to questions. Because there are so many microcontrollers and development boards, some of them may not have a large or active community of users reporting problems and helping each other find answers. This often makes a significant difference in how fast a new development board can be adopted. If you believe having an active community around a board is helpful, try to search for a representative problem and see whether there are answers available. Some development boards just die out, while others seem to have active developer forums. Raspberry Pi has a large following, and there is so much content it feels like somebody has already tried almost every possible thing to be done with the boards. This makes Raspberry Pi boards easy to learn.

Size

Most microcontrollers themselves are physically very small, but the size of the development board could be very small or somewhat larger. If you want to use a development board to prototype an idea for a new product, it is good to know whether a prototype can be created that is close enough to demonstrate the product concept. Even if a custom board will be created later, having a prototype of useful size may accelerate product development.

Temperature range

Microcontroller products may have temperature ranges assigned to them. Historically, devices that operate over a range of 0°C to 70°C or 85°C are considered consumer-grade. A temperature range of -40°C to 85°C is considered industrial-grade. There may also be special characteristics for automotive microcontrollers. It’s worth checking into these extended temperature ranges if needed, but extending the temperature range comes at a higher price. Industrial IoT is popular and a common place to find extended temperature microcontrollers.

Availability

As we write in 2022, the global electronics industry has been suffering from a chip shortage. This has made it harder to find development boards at the various distributors. Having a good handle on availability helps us to know whether more development boards are needed for additional engineers or to build a test lab. Make sure to spend a little time understanding the availability of microcontrollers and development boards before getting too deep into a project. We hope that in the months and years to come, availability will be much less of a factor.

Development board selections

For the upcoming chapters, we selected two boards to demonstrate the concepts and provide detailed steps for you to try things yourself. Trying out the concepts presented in the book is the best way to learn and have the most fun. We selected two boards to cover small Cortex-M devices, security features of Cortex-M, devices with peripherals, and connectivity, as follows:

  • Board 1: Raspberry Pi Pico using the Cortex-M0+
  • Board 2: NXP LPC55S69-EVK using the Cortex-M33

We will also use a virtual board to demonstrate the concepts of the Cortex-M55.

We tried to avoid boards that are very new or may be difficult to obtain. We also tried to select boards with reasonable prices that can demonstrate newer concepts such as security and network connectivity.

 

Summary

Thankfully, microcontroller development boards are inexpensive, and it’s easy to try a variety of them. If you end up with the wrong CPU performance, not enough memory, or need another peripheral, it’s not difficult to do some more research and try another board.

In this chapter, we provided a survey of important factors to consider when selecting Cortex-M processors, microcontrollers, and development boards. We discussed several criteria for selecting a processor, ranging from use cases to power, performance, security, safety, and cost.

Finally, we proposed two development boards to use in future chapters for hands-on activities. Let us move into Chapter 2, Selecting the Right Software, where we will learn about the broad range of software available for Cortex-M microcontroller projects.

 

Further reading

For more information, refer to the following resources:

About the Authors
  • Zachary Lasiuk

    Zachary Lasiuk is a solutions designer at Arm. He specializes in being a systems-oriented thinker, with a broad understanding of and experience with the full IoT product life cycle in terms of both hardware and software. He is a designer at heart, crafting products that are easy and enjoyable to use. Graduating summa cum laude from Boston University with a degree in electrical engineering, Zach holds several certifications in fields ranging from UX Design to Design Thinking to Humane Technology. He graduated from the UN Young SDG Innovators Programme and has been an XTC judge for AI Ethics. He enjoys playing jazz saxophone and piano in his spare time and has toured with bands and DJ groups across the world. He lives in Austin, Texas with his fiancée, Isabella, who he loves very much.

    Browse publications by this author
  • Pareena Verma

    Pareena Verma is a principal solutions architect at Arm. She works with Arm partners around the world to design system-level virtual prototyping solutions for early IP evaluation, performance analysis, and software bring-up. She has helped software developers and SoC architects on numerous Arm-based projects involving the usage of modeling, compilers, debuggers, and simulation tools. Prior to working at Arm, Pareena worked at a couple of other Electronic Design Automation start-ups, primarily focused on embedded software development and FPGA design. Pareena holds a Master of Science degree in Electrical and Computer Engineering from the University of Florida. She lives in the Greater Boston area with her husband, Birju, and their two amazing children, Leah and Liam.

    Browse publications by this author
  • Jason Andrews

    Jason Andrews is a solutions director and distinguished engineer at Arm. He helps Arm partners in the areas of IP selection, system architecture, software development, and performance analysis. Jason has written hundreds of articles about Arm technology. As a member of the AWS Community Builders program, he promotes the Arm architecture in cloud and IoT applications. Prior to working at Arm, Jason worked in various Electronic Design Automation companies, including Cadence Design Systems. He lives in the Minneapolis area with his wife, Deborah, where they spend time with their six children and three grandchildren.

    Browse publications by this author
The Insider's Guide to Arm Cortex-M Development
Unlock this book and the full library FREE for 7 days
Start now