Content Overview
-
What is Embedded?
-
What is Cross-Compilation?
-
Getting Started and Improving in Embedded
1. What is Embedded?
Embedded can be said to be one of the most widely covered and popular professions today. So, what is embedded?
This question cannot be easily answered in just a few words.
Embedded, in English, is “embedded,” meaning “inserted, embedded, or contained.”
Firstly, embedded has many compound terms, such as embedded systems, embedded software, Linux embedded, Android embedded, embedded web, etc.
Typically, the definition of embedded is actually the definition of “embedded systems.”
The online definitions of embedded systems in Chinese are quite difficult to understand, and the more official Chinese definition is:
An embedded system is: a dedicated computer system that is application-centered, based on computer technology, with customizable hardware and software, and meets the strict requirements of application systems for functionality, reliability, cost, size, power consumption, etc.
Personally, I feel that if someone has never been exposed to embedded systems, reading the above definition would leave them just as confused as before. When I first started learning embedded systems, I felt the same way upon reading this explanation.
Of course, this definition is correct, but it has a scholarly tone and is not very vivid or relatable.
So how can we give a more relatable definition of embedded systems?
I can first list the IT fields where embedded systems are currently used:
-
Internet of Things
-
Android Embedded Development
-
Linux Embedded Development
-
Smartphones, tablets, smartwatches
-
Wearable devices, such as Google Glass, Xiaomi Mi Band
-
Microsoft’s Xbox and Kinect
-
Drones
-
VR headsets
-
Wireless routers
-
And so on
I think it is clear without further examples: yes, embedded systems are permeating every aspect of our lives and will be used more and more.
However, pure app development for Android and iOS generally cannot be considered embedded; it can only be classified as software development.
In the future, perhaps we can have lightweight wearable devices that we can use in our daily lives. We might even be able to wear a lightweight “flying suit” that allows us to go anywhere.
Embedded programming, while having a higher entry barrier, can lead to a wealth of knowledge across various fields of programming. If you can tackle the “hard nut” of embedded systems, you may find it easier to master other programming areas. Just like if you are proficient in C and C++, you can generally handle other programming languages with ease.
I believe the original English definition would be easier to understand, so I have translated the definition of embedded systems from Wikipedia as follows (if there are any errors in translation, please feel free to correct me):
An embedded system is a computer system with a dedicated function within a larger mechanical or electrical system, often with real-time computing constraints. It is embedded as part of a complete device often including hardware and mechanical parts. Embedded systems control many devices in common use today. Ninety-eight percent of all microprocessors are manufactured as components of embedded systems.
Embedded systems are primarily computer systems with specific functions, embedded within larger mechanical or electronic systems, often with real-time computing constraints. They are embedded as part of a complete device (this is also the origin of the term “embedded”), which typically includes hardware and mechanical components. Today, embedded systems control many common devices. Ninety-eight percent of microprocessors are produced as components of embedded systems.
Examples of properties of typically embedded computers when compared with general-purpose counterparts are low power consumption, small size, rugged operating ranges, and low per-unit cost. This comes at the price of limited processing resources, which make them significantly more difficult to program and to interact with.
Embedded systems differ from general systems mainly in the following characteristics: low power consumption, small size, limited computing range, and lower unit cost. These characteristics come at the cost of limited processing resources, making embedded systems more challenging to program and interact with.
Modern embedded systems are often based on microcontrollers (i.e., CPUs with integrated memory or peripheral interfaces), but ordinary microprocessors (using external chips for memory and peripheral interface circuits) are also common, especially in more complex systems. In either case, the processor(s) used may be types ranging from general purpose to those specialized in certain classes of computations, or even custom designed for the application at hand. A common standard class of dedicated processors is the digital signal processor (DSP).
Modern embedded systems are typically based on microcontrollers (i.e., CPUs with integrated memory or peripheral interfaces), but ordinary microprocessors (using external chips for memory and peripheral interface circuits) are also common, especially in more complex systems. In either case, the processors used can range from general-purpose to those specialized for certain types of computations, or even custom-designed for the specific application. A common standard class of dedicated processors is the digital signal processor (DSP).
Since the embedded system is dedicated to specific tasks, design engineers can optimize it to reduce the size and cost of the product and increase the reliability and performance.
Because embedded systems are dedicated to specific tasks, design engineers can optimize them to reduce product size and cost while enhancing reliability and performance.
Embedded systems range from portable devices such as digital watches and MP3 players to large stationary installations like traffic lights, factory controllers, and complex systems like hybrid vehicles and avionics. Complexity varies from low, with a single microcontroller chip, to very high with multiple units, peripherals, and networks mounted inside a large chassis.
Embedded systems exist in many devices today, from digital watches and MP3 players to traffic lights, industrial controllers, hybrid vehicles, and avionics. The complexity of embedded systems varies widely, with simple embedded systems possibly containing only one microcontroller chip, while complex systems may have multiple computing units, peripherals, and networks integrated into a large chassis.
2. What is Cross-Compilation?
In embedded programming, there is also the concept of cross-compilation.
So, what is cross-compilation?
Cross-compilation, in English, is “cross-compiling.” Cross means “cross,” and compiling is the present participle of the verb compile (meaning “to compile”).
In simple terms, it means “generating executable code for another platform on one platform.”
In the typical software development process, if you are using a compiled programming language, such as C, C++, Java, etc., you need to use a compiler to compile the code into an executable program (of course, there are several steps in between, such as preprocessing, assembly, linking, which I will omit here).
However, embedded systems have limited computing power, memory, and storage space, making it impossible to complete the resource-intensive and time-consuming compilation process.
For example, in Android embedded development, you cannot directly compile your system or software on an Android phone (I can’t do that).
Therefore, we first compile the program on a regular computer (which has greater computing power, more memory, and more storage space than an Android phone) using a different compiler than the one used for regular software, known as a “cross-compiler/software” (a common one is the arm-linux-gcc family) to generate a specific executable file compatible with the Android phone (which is usually packaged into an image file), and then use specialized tools to “flash” it onto the Android phone.
After these explanations, I believe everyone has a preliminary understanding of embedded systems. However, just reading these explanations will not lead to a thorough understanding; you must learn. In practice, you will gain a deeper understanding of what embedded programming is.
3. Getting Started and Improving in Embedded
In this fast-paced modern era, if you do not take advantage of the many excellent resources available online (most of which are free) for self-study, you are missing out. Spending a lot of money on training classes may be even more of a waste (if you lack self-discipline, attending a training institution is basically a “waste”).
-
For embedded software, you do not necessarily need to learn a lot of hardware knowledge (though having some is certainly beneficial). Knowing how to use some flashing tools, compilers, and debugging tools (like JTAG) is sufficient, and you can learn as needed later. There are no fixed development tools; you do not necessarily need to use an IDE; you can write code using text editors (like Vim, Emacs, Nano, VS Code, etc.). Compilation is generally done using variants of GCC.
-
Embedded programming generally requires learning C (you can refer to my series of tutorials “Exploring C Language” and the books “The Deep Dive into C Language” and “The C Programming Language.” You can also delve deeper into “Expert C Programming,” etc.). C++ is also a commonly used language.
-
Learning Linux is essential. Cross-compilation often requires using a Linux system, and even on Windows, you will need to use something like Cygwin. You can check out my practical course on Linux core skills and applications on Mooc (https://coding.imooc.com/class/386.html) and my column “Linux Command Line and Shell Scripting Programming Guide” (https://www.imooc.com/read/39). You can also look at the book by the Taiwanese author, Bird’s Linux Cookbook. You can explore China Linux Community. Check out the book “Advanced Programming in the Unix Environment.” Pig’s Embedded Linux Cookbook is also decent; I haven’t finished it, but it feels a bit disorganized (though the author is much more skilled than I am) and lacks the fluidity and clarity of Bird’s writing.
-
It is best to spend some time learning assembly language, as it greatly helps in understanding computer principles, especially memory, pointers, binary, hexadecimal, and decimal conversions. I recommend the book “Assembly Language” by Professor Wang Shuang, which is an excellent introductory textbook.
-
The mainstream processor architecture for embedded systems is ARM (previously ARM7, ARM9, ARM11, now all in the Cortex series). Most smartphones, tablets, and development boards are dominated by ARM. Therefore, you need to learn about the ARM architecture and have some understanding of it. Initially, you do not need to go too deep into ARM; it depends on future needs. The integrated development environment for ARM is ADS (ARM Developer Suite), which is the main development tool for ARM processors.
-
You can buy a cheap development board to start learning (I think this is the only area where self-learning embedded systems can be somewhat costly. A few dozen or a few hundred yuan is sufficient). Raspberry Pi (https://www.raspberrypi.org; http://www.raspberrypi.com.tw), Arduino, etc., are all good options. You can also buy development boards from domestic manufacturers, just avoid the very low-quality ones.
-
If you buy a development board, you can visit the corresponding forums for that board. For example, when I was a student, I bought the TQ2440 from Tianqian (which has long been upgraded to who knows what now), and the Tianqian forum has a lot of good resources. The Embedded Linux forum, Huqing Yuanjian forum, and Electronic Engineering World forum are also good. Of course, the largest IT community in China, CSDN’s forum and blog are also great learning areas. 51CTO is also good, and ChinaUnix is another option. Experimentation platforms like Experiment Building have excellent online experimental environments, most of which use the Ubuntu Linux distribution.
-
Improving your English is very beneficial for programming, so do not neglect your English studies. Also, your math skills should be decent, as there are many bitwise operations, logical operations, hexadecimal, binary, and decimal conversions involved. You can refer to my article: For Programmers, Why is English More Important than Math? How to Learn.
-
There are many books to read; the key is to choose good ones and read them efficiently. “Computer Systems: A Programmer’s Perspective” is excellent and serves as a good introduction. There are many other embedded books as well. Take your time and build a solid foundation. The field of embedded systems is vast, and there is so much to learn; with technology evolving rapidly, having a solid foundation will help you learn new knowledge quickly. I highly recommend the book “Orange’s: An Operating System Implementation,” which guides you step by step in writing your own operating system, which is very exciting.
-
If you plan to study more complex embedded real-time systems (like VxWorks, ecos, ucos, etc., or driver development), you will need a strong foundation in C (and assembly) and should read more in-depth books. However, for now, just getting started with embedded systems is fine; you can explore these more advanced areas based on your interest.
-
If you need programming materials, you can follow my WeChat public account “Programmer Alliance” (WeChat ID: coderhub). The QQ group files of Programmer Alliance, as well as the Baidu Cloud Drive (2TB capacity), contain a wealth of programming materials.
-
Do not be afraid; I also started from knowing nothing about embedded systems and worked hard to self-learn until now, where I only know a little. Self-learning has never been easier than in this era. So, standing on the shoulders of so many giants (there are many excellent blogs from experts online), are you still afraid of not being able to get started? Young one, you are just a push away from success.
Some points may not have been covered, and I hope not to mislead anyone. If you have any questions, feel free to communicate in the comments section.
Disclaimer: The companies or products mentioned in this article are not intended as advertisements.
Author: Xie Enming Source: WeChat public account “Programmer Alliance” Original link: http://www.jianshu.com/p/d59378613d15 Please indicate the source when reprinting, thank you for your cooperation! For reprint authorization, please add my WeChat frogoscar
If you like this article, feel free to follow the public account Programmer Alliance for more exciting content.
Click [View] to show your greatest support!