Embedded systems are all around us, yet the topic of programming for such systems is not often covered as much as other fields of software development. However, engineers with a skill set needed for the development of embedded systems continue to be widely sought as more devices are created with built in electronics.
This is a beginner friendly introduction to embedded systems that will set you up with the basic understanding of what you need to know to get started as an embedded programmer.
We can define a system as a set of components which are put together in a way that makes the entire assembly perform a particular task or set of tasks. We can also define embedded as a term used to describe something contained within or attached to an entity.
An embedded system describes an assembly of dependent components driven by hardware running software to enable that system to perform specific functions. Embedded devices contained within a system is made up of physical hardware and running software which enables the system to function. We can therefore describe an embedded device as a combination of hardware and software that drives a system.
Understanding hardware and software
You will often hear the words hardware and software mentioned in various contexts when talking about embedded systems. For example, someone can refer to themselves as an embedded software programmer or embedded hardware design engineer. What exactly does hardware and software refer to?
Hardware is the physical board containing one or several programmable chips and an arrangement of electronic components designed to achieve a defined behaviour. This involves first designing the board using simulation tools provided by software applications known as electronic design automation (EDA).
These applications provide tools where simulations of the electronic design are drawn in what is called circuit schematic diagrams. A layout of where each component is placed on the board is also simulated through Printed Circuit Board (PCB) layouts. These tools generate files that are sent to a PCB manufacturer to produce the board in its physical form.
Software will refer to code running on programmable components placed on the hardware such as processors or microcontrollers. Software drives the ability of the hardware to perform a set of instructions according to the written program and is limited by what is physically possible by its hardware design.
Where can we find embedded systems?
To understand what classifies something as embedded, it may be useful to make a comparison here to what we will refer to as ‘dumb’ hardware. Dumb hardware is when a PCB of an electronic design does not contain a programmable component such as a processor or microcontroller.
A plain mobile phone charger is an example of dumb hardware.
It consists of an electronic board that converts power from your mains supply and converts it to a voltage that is used to charge your mobile phone. However, it does not contain a programmable component and therefore there is no software running that enables it to function in a specific manner. Its function is driven entirely by the hardware design which is to charge your mobile phone.
Compare this for example to a smart switch, which we will ironically call ‘smart’ hardware.
A smart switch does more than acting as a power socket as it can be switched on and off remotely such as controlling it through a mobile app. It becomes smart because it contains a programmable processor running software that will enable it to receive remote commands to switch on and off. A smart switch is therefore an embedded device.
Using these examples, we can say a product is an embedded device when the electronics embedded in the product is driven by a programmable component running any form of software.
Embedded systems can be standalone and contained within a product such as found in consumer electronics. They can also be part of an even larger system such as an industrial product, which may contain several embedded components that control other electronic or mechanical parts of the system.
Embedded systems are everywhere
By the above definition of what classifies a product as embedded, if you look around you and think of items you use everyday, you’ll soon realise a surprisingly large amount of products and equipment you use count as embedded systems.
If we look at household items, a digital alarm clock, microwave, washing machine, smoke alarms, TV, video game console, smart bulbs, house heating system and control thermostats are just a sample of items that are controlled by software and thus are embedded devices.
Looking outside the house, embedded devices also drive several equipment and machinery. A car is a great example of a piece of machinery we rely on. It consists of several embedded devices that control different parts. There’s a processor controlling the braking system, another controlling the headlights, another controlling the stereo system, another controlling the windscreen wiper, indicators, air conditioning and so on.
It doesn’t stop there. Embedded devices also drive many large and complex systems that act as the backbone for several industries. From safety critical systems found in aircraft control to life-saving medical equipment, embedded devices are a core component to the realisation of such systems.
Software or Firmware - What’s the difference?
You’re likely familiar with the term software which is used to describe the result of code written that runs as an application on a computer or even a mobile phone.
You may hear firmware used regularly when referring to code running on embedded devices. Firmware is also commonly referred to as embedded software.
Firmware is used more specifically to describe code written to run at a level close to the device’s hardware. You can also think of firmware as being the program performing the most basic operations necessary for the device to be functional.
In comparison, higher level software usually refers to what a user can see and interact with. Such software is not tied to the hardware and can be removed without any impact on the system.
The term firmware helps distinguish low level running programs that are tied to the hardware of a device.
Example: Web browser = software, Smart plug program = firmware
The web browser you’re using to read this will be called a software application. If we want to be literal we can say the browser is technically running on hardware, however it’s not tied to it. It’s merely an application built on top of other more fundamental layers of programs running on a computer, hence the term a higher level software application. It can be removed with no impact to the system.
Compare this to the code running on a smart plug. The program runs directly on the processor in the plug and without it the plug is no longer smart. The program runs at a low level and is tied to the hardware. So in this case we can call it firmware.
In reality, the terms firmware and software are often used interchangeably when we talk about programs running on embedded hardware. So we can refer to the program running on a smart plug as embedded software or firmware. However, we shouldn’t refer to a web browser application as firmware.
The usage of firmware is now more for discussion purposes when someone wants to make an extra distinction that the program is written for a targeted embedded device and runs at a fairly low level. Embedded software engineers can also be referred to as embedded firmware engineers, they are both likely to carry out the same job of writing software/firmware that runs on hardware designed for a dedicated function.
In summary, there is no right or wrong way to refer to a program running on embedded devices, firmware or software can be used. But it’s good to know that when you do hear the term firmware, you understand the meaning behind it, and know what distinguishes it from high level running software applications.
Challenges of embedded design
Think of embedded devices as a computer system designed to perform a particular set of functions. This is different from a PC or Laptop as they are general purpose computer systems designed to perform many tasks. Manufacturers of such computers don’t know what we’re going to use them for, hence the term general purpose.
We are used to general purpose computers having many choices for the hardware specifications. For example, we have choices to get computers with large amounts RAM, storage and high processing capabilities.
In contrast, embedded devices are designed for dedicated functions. These devices have hardware constraints and therefore software must be written with this in mind.
As part of an introduction to embedded systems topic it’s important to understand some of the main challenges associated in their design. Some of these challenges include the following.
This is the available memory onboard the device and usually includes at least two types of memory. These are storage for temporary data that will be lost when the device is switched off (RAM – Random Access Memory) and storage for data that remains when the device is switched off (FLASH or ROM – Read Only Memory).
Embedded designs often have limited memory when compared to general purpose machines. Sticking with the smart plug example, take a look at this design guide for a smart plug using a Texas Instruments microcontroller: https://www.ti.com/lit/ug/tidu983/tidu983.pdf
The design features a microcontroller with 256KB RAM and 8MB of FLASH storage. This specification is quite typical for low cost and lower complex applications.
Compare this to laptops, nowadays it’s not uncommon to see specs with 8GB to 16GB of RAM and storage in the TB range.
Understanding byte scales
- 1KB = ~1000 bytes
- 1MB = ~1,000,000 bytes
- 1GB = ~1,000,000,000 bytes
- 1TB = ~1,000,000,000,000 bytes
With this limited memory available, software must be designed in a way that the requirements of the device can be met while being efficient enough to fit into the available space in the processors program memory.
Also keep in mind the available memory on embedded devices vary greatly depending on the application. While a smart plug might have low memory to work with, this is still sufficient to meet the requirements given its purpose. The same hardware specification will not be suitable for a video games console for example, which will clearly need much larger memory and processing capabilities.
However, the same still applies, the design for the video game console will be done in a way that makes full use of the available hardware resources.
We know technology continues to see rapid growth as more and more devices become smart enabled, connected and seem to somehow grow in functionality every year. However, the cost of such products has not escalated in proportion to the growth in complexity. Why is that?
Well, part of this is down to Moore’s law, which describes how the number of transistors on a computer chip approximately doubles every two years. As a general rule, the more of those transistors you can squeeze into a chip, the more processing power it will have.
The other reason we can still continue to afford technology products of increasing complexity is due to the management of costs associated with developing the devices. This is partly due to contract manufacturing where companies outsource the production of electronics to manufacturers who can produce them at a lower cost.
The ability to source electronic components that keep the overall cost of the hardware low also plays a factor. This includes selection of the processor or microcontroller and ensuring it is cost efficient yet is able to meet the demands required by the system.
Cost also ties in with the factor we discussed previously of memory constraints. Why select a microcontroller with a mere 256KB RAM and put more effort to fit the application code when you can get microcontrollers with double the RAM for just 1 euro more? Well, 1 euro might not make a difference if you’re buying just a few. But when you’re planning to produce 100,000 of that device that’s 100,000 euro more to pay.
The challenge here is selecting components that just about meets the functional requirements of the product to keep costs to the minimum necessary.
Managing the cost of embedded devices of varying complexity is a constant challenge for organisations that must ensure the device is profitable when sold to the end customer.
This is the power consumed by the device measured in Watts. It’s good practice to design embedded products so the power consumption is the minimum possible to avoid wasting energy.
Depending on where a product is sold, it may have to comply to power consumption targets set by regulatory bodies. For example, the European Union Ecodesign Directive is constantly setting new guidelines for the efficiency of products to meet energy consumption reduction targets. If anyone wants to sell products that consume power within the European Union, they must comply with these requirements.
This means there is a constant design challenge of having to meet stricter requirements placed on embedded products.
Safety and Security Standards
These are safety and security standards that embedded devices must adhere to according to guidelines supplied by regulatory bodies.
These standards are of course necessary to ensure the system can be used by the end user and for its purpose in a safe manner. Depending on the safety-critical level of the system, strict regulations can also apply to the manner in which code is written for the application. An example of this is a set of rules for writing safe and secure C/C++ code called MISRA (Motor Industry Software Reliability Association).
Failure to meet these standards in safety-critical systems can result in huge consequences if a fault happens to make its way to the field. That’s why we hear of car manufacturers having to recall thousands of vehicles due to suspecting faults.
Ensuring the safety of the system no matter how big or small the application, is an important challenge faced by embedded engineers.
Embedded systems are a main driving force behind the growth of all sorts of industries powered by electronics. Embedded systems consist of a hardware and software component. To become familiar with embedded programming you must get comfortable working close to the hardware layer.
Embedded engineers face many challenges when it comes to meeting requirements of a system yet ensuring its power efficiency, cost efficiency and safety.
This post has given you a basic introduction to embedded systems and what they are all about. You should now be ready to take things a step further in your knowledge of embedded systems!
If you’re interested in embedded systems, we’ll be covering the field a lot more on this blog so stay tuned! You can also suggest specific topics you would like covered in the comments below.
Did you find this article useful? Checkout other related articles: