Building Embedded Systems – A programmer’s perspective

The Embedded Systems domain is poised for a huge growth as more and more embedded devices are flocking into the market. These Embedded devices range from small consumer electronic devices (like mobile phones) to enterprise devices (like telecom switches). Even though the size of these devices varies, the programming fundamentals remain almost the same. In this article we will discuss about building blocks of embedded systems from a programmer’s perspective.

Before getting into these blocks, we need to understand that programming embedded systems is very much different from application programming. Also embedded systems programming has a set of challenges because of the following reasons:

1. Embedded systems have very limited resources (in terms of memory, storage, processing power) compared to a general purpose computing device like PC.

2. Because of the less memory availability and requirement of faster response, embedded systems have Real Time Operating Systems (RTOS). These RTOS have flat memory model where all processes in the system run under the same memory space. This will lead to lot of memory corruption and inter process communication errors. Debugging these errors are really challenging.

3. Embedded systems have a pre-defined performance requirements and response time.

From a programmer’s perspective there are four building blocks for any system namely boot-loader, operating system, device drivers, networking subsystem apart from the device’s main functionality. When the system gets powered up the boot-loader is the first program that gets activated from the non-volatile memory. This boot loader will vary from one system to another, because it mainly depends on the way system is configured. This boot loader will in turn revoke the operating system by calling its entry point, which in-turn initializes various operating system services (memory, tasks, scheduler etc...).

Once the operating system services are initialized, all the low level device drivers followed by other subsystems (like networking) are brought up. At this point we can say that the platform is built for the system. After this initialization is complete, the system would be in a position to perform its expected functionality. This functionality will vary from device to device as each system is built for a different purpose. Say for example a router’s main functionality would be to route the packets but a microcontroller’s functionality may be measuring the temperature using a sensor. Finally functionality programming is the main core of embedded system which requires a powerful programming language.

In spite of so many new programming languages, 85% of embedded systems are built using C language. This is mainly because it produces the most optimal machine code. Here is where Data Structure programming plays the critical role. If the above mentioned blocks can be equated to various organs of human body, data structure programming is the life-blood of that body. Without sound data structure programming no embedded systems can be built. Sounds different? Read on.

As mentioned in the beginning of this article, embedded systems have a very limited amount of memory. So using the memory optimally and freeing them plays a very vital role. Since data structures (especially in C) provide this power to the programmers, it becomes the life-blood of the system. If you get a chance to look into the code base of any embedded system, you will come across Abstract Data Types (ADTs) liked lists, stacks, queues and graphs very frequently. Also other subsystems (say for example networking) provide certain interface or framework for programmers. It is up to the programmers to make use of them and build the expected functionality. The networking subsystem provides the ‘socket’ interface and learning it is comparatively easy. But what exactly the programmer wants to do with sockets? How is he going to program the network protocol using sockets? The answer is once again data structures. That’s why through understanding and programming knowledge of data structures is the key building any embedded system.

To conclude understanding the various frameworks and data structure programming are the fundamental building blocks of any embedded system.

Comments

Popular posts from this blog

BOOK REVIEW : Games Indians Play (Guest post by Sai Madhav)

Mohammed Yusuf - Noble price speech

My first post