Click “Ke Yan Achievements” to follow, and select “Set as Star” to avoid getting lost
Introduction
Before we start the article, let me ask you a question: If you want to become an embedded engineer, after learning C language, what do you think you should learn next?
Think about it, leave a comment at the end of the article, and then come back to read the article.
This article will continue to share with you what skills an embedded engineer should have.
The previous article on the embedded learning path, “Embedded Learning Path: Basics of C Language,” answered two questions: how to learn C language without getting bored, and what level of proficiency is considered a milestone to move on to the next stage.
The programs mentioned in it are all written based on Windows’ Visual Studio.
You might have an illusion that C language is just about variables, loops, expressions, arrays, pointers, structures, and so on, and that you just run these in an IDE. Is that all there is to it?
In fact, we are just getting acquainted with C language; it has much more depth and breadth than what a beginner typically encounters in an IDE. From the core of the operating system to small utility software, and to complex network servers, C language is ubiquitous in the world of low-level programming.
In a Linux environment, you will discover another side of C language. Therefore, after learning the basics of C language on Windows, we need to shift to the Linux platform starting from the second stage.
Linux Environment and Development Tools
Why Linux? Why did history choose it over other operating systems?
To understand this question, you must first know what Unix is.
And what the GNU and open-source movements are about.
Next, you can start learning how to use Linux. The book I recommend is the classic “The Linux Programming Interface” by Michael Kerrisk.
You might ask, isn’t this book too thick? In fact, you don’t need to read the entire book to feel like you have learned it. Just being able to set up a Linux system environment and learn the most commonly used commands is enough. These commands have been summarized in the previous Linux learning path, refer to “From Beginner to Expert in Embedded Linux.”
For example, directories and files:
Users and groups:
Processes, memory, networks, etc., mastering these key elements is essential.
Then you should learn to set up several common services, such as Telnet, FTP, SSH, and Samba. These services will be very useful for your upcoming C language development work.
Next, learn development tools, at least including gcc, gdb, and makefile basics.
Learn the steps for compiling programs, debugging methods, and managing multiple code files.
When you first learn makefile, you might be a bit confused and unsure about how much you should learn. I suggest starting with the simplest examples:
Gradually write several versions from simple to complex.
The final part of learning Linux basics is to learn some text manipulation, such as searching, counting, and sorting:
And also redirection and piping, which are essential tools in Linux. A genuine, professional Linux engineer should master these.
I also recommend learning regular expressions.
In actual projects, we rarely, if ever, use regular expressions. However, during product development, there are many other tasks involved, such as handling logs, parsing text, or even finding a file on your computer, where using regular expressions can simplify things. This can save development time from another perspective.
I always advocate that before becoming an embedded software engineer, one should first become a software engineer. Regular expressions are a fundamental skill that a professional software engineer must master. They represent a programming mindset of “pattern matching,” which can easily solve problems that traditional, procedural programming cannot.
Next, learn about sed and awk, which are two more complex and powerful text processing tools.
Among them, awk is also a programming language that can conveniently analyze text, and it’s worth spending a few hours familiarizing yourself with its basic syntax and advanced features.
I recommend this book, “The AWK Programming Language,” written by the three authors of awk:
Throughout your learning process in Linux, you should also do some practical exercises. Don’t learn just for the sake of learning; learn to solve real problems.
Scripting Programming Techniques
Next, you should take advantage of the momentum and learn scripting programming techniques. My suggestion is to learn two scripting languages: shell and Perl.
You probably already know that shell is a must-learn because it is tightly bound to Linux, and you cannot bypass this scripting language while working in Linux.
But what about Perl? Where did it come from?
Perl is also a scripting language. While shell can directly invoke commands, it struggles with complex data structures, and although C language can do anything, it focuses too much on details. We need a language that is in between.
Other languages you can learn include heavyweight contenders like Python, PHP, and JavaScript, but in embedded Linux, especially older versions of the system, environments for Python, PHP, and others are not always installed by default. However, Perl is often installed because many tools for compiling kernels and building distributions in Linux are written in Perl. Without a Perl environment, the Linux system might not even run.
Moreover, Perl’s syntax borrows features from C, sed, awk, and shell. If you have learned these languages earlier, learning Perl will feel like a bonus, just a matter of spending a little time on it.
After learning Perl, you will be a genuine, professional Linux engineer. Shell, Perl, and C form a classic programming language combination, representing three levels of languages, with increasingly fine control granularity. They can call each other and each has its own strengths, basically covering different software needs.
Just to clarify, Perl is just a suggestion; if you prefer to learn Python or PHP, those are also excellent choices.
Like learning C language, you need to learn about variables, input/output, branches, functions, loops, etc., along with practice exercises.
I suggest rewriting the same exercise or requirement in different languages. If you have read the previous articles, you should know that I suggested writing a code line counting tool in C language:
This exercise tests knowledge of structures, arrays, pointer manipulation, string searching, file reading/writing, function calls, recursion, and more.
When learning different programming languages, if you can rewrite the same requirement in different languages, you will gain a deeper understanding of the differences and connections between programming languages and how to work within different programming contexts.
Rewrite the line counting tool in shell language:
Then rewrite it in Perl:
For clarity, you can compare the syntax of different programming languages, which will also help you understand the essential characteristics of different programming languages.
Finally, I hope that after learning C language, shell language, and Perl language, you will no longer ask questions like: “Teacher, what language should I learn?”, “Teacher, which language has a better future?”, “Teacher, is Java better or PHP better?”
Because you will somewhat understand that programming languages are merely tools to achieve goals. All programming languages are fundamentally about variables, expressions, conditional judgments, and loops. What truly determines your technical proficiency is your understanding of problems, your analytical skills, and your ability to use programming thinking to solve problems.
Regarding books, for shell, I recommend “Linux Command Line and Shell Scripting Bible.”
For Perl, I recommend two books: “Learning Perl” and “Programming Perl.”
Coding Standards
After learning scripting languages, you can take a look at coding standards.
Always remember that “code is written for people to read, not for machines to read.” A person can casually learn C language and write code that a compiler can understand, but a professional programmer should follow certain coding styles to write code that humans can understand.
Be aware of the coding styles of well-known projects:
And the coding styles of well-known companies:
For example, indentation: whether to use spaces or tabs, how to name variables, how to write functions and comments.
It’s best if you also familiarize yourself with some tools for auto-formatting code, such as indent:
Astyle:
There’s also a tool that can automatically generate documentation based on specified comment formats, which you should learn as well.
Next Stage
Okay, that’s my suggestion for the second stage of learning for embedded software engineers, mainly covering the Linux environment and commands, shell scripting, Perl scripting, and coding standards.
This is also the content of version 0.2 of the Ke Yan Achievements base camp. The Ke Yan Achievements base camp is an online embedded learning community where there are some documents and videos that teach embedded knowledge.
There’s also a group where people can ask questions, discuss, and talk about embedded-related issues. Currently, there are more than 100 people in the group.
Currently, versions 0.1 and 0.2 have been released. The plan for version 0.3 is networking; version 0.4 is operating systems, and version 0.5 is data structures.
I will answer any questions regarding the course in the base camp. Since I still need to continue writing the content for version 0.3, I worry that I might get overwhelmed if too many people join. Therefore, the version 0.2 of the base camp is still limited to 100 slots. If you are interested, please join in the comments section!
Joining Process
After following the public account, click the menu below 【System Course】 to join.
—————END—————
Welcome to scan the QR code below to follow “Ke Yan Achievements”~~~O(∩_∩)O~
Hello, I am Ke Yan. I have been an embedded engineer for over 10 years, and every time I successfully debug a board, I feel a great sense of achievement.
I will continue to share my personal growth and help you improve your technical skills and cognitive vision. By the way, I’ve heard that everyone who follows me is talented, so let’s work hard together, talented people 🙂