Companies across the manufacturing sector need to integrate new types of circuits and create proprietary devices. In most cases, using off the shelf drivers might not be enough to fully support needed functionality – especially for companies that provide single board computers with a set of drivers, as a client might order something that requires specific support for something out of the ordinary.
Imagine a major silicone manufacturer has just released an interesting integrated circuit (IC) that could solve a bunch of problems for your hardware department. Unfortunately, as it is a cutting-edge chip, your system does not have an appropriate driver for this IC. This is a very common issue especially for board manufacturers such as Toradex.
What is embedded Linux, its advantages and disadvantages?
Embedded Linux derives its name from leveraging the Linux operating system in embedded systems. Since embedded systems are custom designed for specific use cases, engineers need to factor in issues related to processing power, memory, and storage. Given that its open-sourced and adaptable to wide-ranging networking opportunities, Embedded Linux is becoming an increasingly selected option for engineers. Indeed, research shows that 2024’s global embedded Linux market, valued at $.45 billion USD will reach $.79 billion USD by 2033. As with all technology, there are pros and cons.
Advantages of embedded Linux
- Powerful hardware abstraction known and used commonly by the industry
- Applications portability
- Massive community of developers implementing and maintaining the kernel
- Established means to interface with various subsystem of the operating system
Disadvantages of embedded Linux:
- Larger resources required to run the simplest of kernels
- Requires more pricier microcontrollers to run, in comparison to simpler RTOS counterparts
- A longer boot time compared to some real-time operating systems (RTOS) means it might not be ideal for applications that require swift startup times
- Maintenance – keeping an embedded Linux system current with security patches and updates can be difficult, particularly with long-term deployments
Steps for integrating an IC into an embedded Linux system
1. Check if the newer kernel has a device driver already merged in. An obvious solution in this case would be to just update the kernel version used by your platform’s software.
2. Research if there is an implementation approach besides mainline kernel. Often, it is possible to find a device driver shared on one of many open-source platforms and load it as an external kernel module.
3. Check if there are drivers already available for similar devices. It is possible that a similar chip already has full support – even in the mainline kernel repository. In this situation, the existing driver should be modified,
- If the functionality is almost identical, adding the new device to be compatible with the existing driver is the easiest approach.
- Modifying the existing driver to match the operation of the new IC is a good alternative, although the operation functionality should have a major overlap.
4. Create a new driver. If all else fails, the only solution left would be to create a new device driver for the new circuit. Of course, the vast number of devices already supported can act as a baseline for your module.
Overcoming pitfalls when creating new drivers
Creating a new driver can be difficult, especially since possible tools for troubleshooting kernel related problems can be daunting. As well, preparing a setup that allows for in kernel debugging requires vast knowledge and understanding of the entire operating system and debugging tools. Although, there are easier solution approaches that still can provide a lot of insight on what happened wrong with our driver:
Kernel log
An obvious alternative is to use kernel debugging that one can access using ‘dmesg’ utility. During development you can print much more information than needed to trace the execution of your driver. However, this is limited when your driver encounters any form of crash.
Post-mortem analysis
When your driver generates a kernel fault, ‘dmesg’ utility should provide you with an extensive message regarding the problem – usually a brief description of the problem and a backtrace. Analyzing this message comes in very handy, even though initially the message might seem unintuitive.
Isolating problems
A generally good approach when development does not go as smoothly as initially anticipated is trying to isolate each aspect of your driver into smaller issues. In this way, the final driver is a combination of many smaller working and tested parts.
How to measure embedded Linux success?
The initial way to verify if driver development has been successful is to check if the written and loaded driver works correctly with the connected IC. Additionally, the driver should follow established Linux coding standards, especially if you are interested in open sourcing your driver. As a result, it should operate similarly to other drivers that are already present in the Linux kernel and support the same group of devices (ADCs, LCD drivers, NVME drives).
Questions to ask yourself:
1. Does the driver work with the IC?
2. Does the code meet Linux coding standards?
3. Does the new driver operate similarly to the existing ones?
4. Is the driver’s performance sufficient?
Partnering with cross-functional embedded experts
Whether integrating AI solutions, developing proprietary hardware and software, designing and deploying firmware and accelerating cloud-driven data management, the challenges, and opportunities, the manufacturing industry is facing are significant. The needs to optimize resource management through real-time operating systems (RTOS), leverage 5G connectivity and increase predictive maintenance capabilities are ever-increasing. That’s why organizations turn to Software Mind. Our embedded systems experts have a proven track record of supporting companies in the industrial manufacturing, apparel manufacturing, food industry and automotive sectors. If you’d like to discuss your embedded goals and learn how we can help you achieve the, get in touch by filling out this form.
About the authorRafał Jasiński
Senior Embedded Software Engineer
A senior embedded software engineer with over five years' experience, Rafał has supported global organizations across sectors. An avid follower of embedded-related trends, he's keen to integrate emerging solutions into software development life cycles. A passion for innovation is matched by a commitment to quality and attention to detail, which has made Rafał a dependable technology partner for his fellow embedded specialists and clients.