Many people often ask this question, so here is a summary for everyone’s reference. It must be stated that the following steps are targeted at Linux systems and do not focus on WinCE. You may notice that among those engaged in embedded systems, there are far more people researching Linux than those working with WinCE. Much of the documentation provided by manufacturers is also primarily based on Linux. I have always found it hard to understand, as the interface of WinCE is much more visually appealing than that of Linux, and it is much more convenient to use. More importantly, the development under WinCE is fundamentally similar to development under Windows, making it much easier to learn. However, many more people are learning Linux or using Linux for embedded systems than those using WinCE. In conversations with many working professionals, I learned that their companies have never considered using WinCE due to high costs, and they all develop using Linux. In my graduate lab, we do not use WinCE; most research focuses on Linux, with a few projects using VxWorks, but I have never heard of anyone using WinCE, primarily due to its open-source nature! Of course, it is said that WinCE 6.0 is now also open-source, but in terms of cost and resources, Linux has an unbeatable advantage. Correspondingly, more and more electronic manufacturers have begun to develop products using Linux. For example, the smartphone operating system Android recently developed by Google is actually an improved version based on the Linux 2.6.23 kernel. First, learning basic bare-metal programming is essential for hardware learners to have an intuitive understanding of the basic usage of hardware, and they must deeply understand the control methods of that hardware. If one starts by learning the Linux system and porting it, they will quickly fall into a deep vortex. When I first started learning ARM, I chose ARM7 (the idea was that ARM9 was still very expensive at that time). While learning ARM7, I still maintained the mindset of learning the 51 microcontroller and used ADS for programming; the first experiment was controlling an LED. Anyone who has learned ARM for a while would laugh at how foolish this is, but I actually think this process is much better because no matter how complex the system is, it ultimately comes down to the lowest level of hardware control. Therefore, having an intuitive understanding of this hardware control makes it much easier to learn. While learning bare-metal programming, it is important to understand the architecture and control principles of this hardware, which I refer to as understanding hardware. Understanding hardware means understanding how this hardware organizes so many resources and how these resources are controlled by the CPU and programming. For example, in the S3C2410, there are AD converters, GPIOs (general-purpose IO ports), and NAND flash controllers. Each of these has some registers to control them, and these registers have an address. What do these addresses mean? How do we control these peripheral devices through registers? Also, each unit inside the NOR flash has a corresponding address unit in the memory of this chip. What is the relationship between these addresses and the previously mentioned register addresses? Are they the same? Moreover, the storage units inside NAND flash are not linearly arranged, so how does the S3C2410 map the NAND flash addresses in memory space for use? Or simply put, how should we use NAND flash? Furthermore, when programming ARM9 using ADS, an initialization assembly file is required. What is the purpose of this file? What does the code inside mean? Can we do without it? Such questions are all part of understanding hardware. Understanding these aspects will lead to a deep understanding of hardware, which will greatly help in further learning. If you skip this step, I believe you will find it increasingly confusing as you progress, feeling that these concepts are unfathomable because your foundation is not solid. However, I must clarify that I have not programmed ARM9 using ADS; I went from learning ARM7 directly to using ARM9 to learn the Linux system, so I find it difficult to answer questions related to programming ARM9 with ADS ^_^. Please do your own research on this. A tutorial will be provided for this part soon. The examples in this tutorial are not written for the board we represent but are taken from our college laboratory, written by Yingpeite for their own experimental box. However, they are quite valuable as a reference. Second, perform some basic experiments using the Linux system. When purchasing a board, it usually comes with some Linux experimental examples. Spend some time doing this; this process is also very meaningful and builds intuitive knowledge for further learning. Can you imagine someone who has never used a Linux system learning Linux programming well? Follow the examples in the manual and conduct the experiments inside; although it may feel like a child learning to walk and somewhat silly, I believe many experts have gone through this process. In this regard, Deep Blue Technology currently has no plans to provide corresponding examples since the development board providers will offer a wealth of examples. We do not want to duplicate work; we only provide the most valuable resources that they do not offer. Third, research the complete process of running a Linux system. What does a complete Linux system include? Three parts: the bootloader, the Linux kernel, and the root filesystem. How do these three parts collaborate to form the system? What is their function? What is the relationship among them? How are they connected? What is the execution flow of the system? Once you clarify this, you will understand the entire system’s operation clearly, laying another important foundation for the next step of creating this Linux system. There are tons of resources available online for this topic, so please research thoroughly. Fourth, start system porting. As mentioned, a complete Linux system has three parts, and you know their relationships and functions. Now, what you need to do is to learn to create these components yourself. Of course, I cannot ask you to write this code; that is unrealistic. In fact, you can find the corresponding source code for all three parts online, but this source code cannot simply be downloaded and compiled to run on your system; it requires significant modifications until it can run on your board. This modification process is called porting. During the porting process, you will need to learn a lot, and you will need to understand a wide range of related knowledge. Once you complete this process, you will find yourself a budding expert. If you have a strong research spirit during this process, you will inevitably think about looking at the source code. Many books introduce how to read the Linux source code, but I do not advocate aimlessly looking at Linux source code; as Xu Sanduo said, it is meaningless. Only when you feel the need to look at the source code during porting should you seek out good books on the basics. I recommend a good book by Ni Jili, titled “Analysis and Programming of the Linux Kernel,” which is a deep dive into the Linux 2.6.11 kernel. It is advisable to improve your C programming skills before reading it. As for porting each part, you can find plenty of resources online, so please research. However, I must remind you that many accounts of personal experience may hold back some information; if you follow their advice, you will inevitably encounter issues that they do not explain how to resolve. At this point, you will need to rely on yourself. If you cannot depend on yourself, feel free to reach out to me for research assistance. I cannot guarantee that I can solve your problem, as I may not have encountered it before, but I believe I can offer some advice that may help you resolve it. The ultimate goal of this step is to download the standard source code package from the official source code homepage (which is all foreign, sadly), modify it, and ultimately run it on your board. To borrow a phrase from Archimedes: “Give me a network cable, and I can get Linux working.” Fifth, study the writing of Linux drivers. Porting the system is not the final goal; the ultimate goal is to develop products and projects, all of which require driver development. Linux drivers can be quite diverse. There is a significant difference between writing for Linux 2.4 and Linux 2.6, and even among different versions of Linux 2.6, there are differences in driver programming. Thus, writing Linux drivers is not an easy task, and for the latest versions of driver programming, there is often insufficient reference material. My suggestion is to use and port a not-so-new kernel version so that you will have enough materials to learn driver programming later. Sixth, study application programming. In addition to writing driver programs, you must also write application programs for your projects. The current trend is to develop graphical application programs, and the most commonly used library for graphical applications is still the Qt/E function library. I have always used this library to develop my applications, but I hope you can use the domestic MiniGUI function library. To borrow a phrase from Jay Chou’s advertisement: “Support domestic, support MiniGUI.” MiniGUI programming is quite similar to VC programming under Windows, making it relatively easy to get started, and the results are quite good. I have used it to develop programs for ARM7. However, the biggest downside of MiniGUI is that it does not have a graphical operating platform like Qtopia, which greatly limits its promotion. I once fantasized about collaborating with Beijing Feiman Company (the copyright holder of MiniGUI) to develop a graphical operating platform like Qtopia using the MiniGUI function library, but due to my limited capabilities, this remains a fantasy. Haha. Once you complete this step, you will have essentially learned all about embedded Linux. I also want to share a small experience with everyone. During my learning process of embedded Linux, I rarely asked others for help. The objective reason was that there were no experts in this field among my teachers, classmates, or senior students, and the subjective reason was that I do not like asking others; I prefer to research and solve problems on my own. This approach has the benefit of enhancing my problem-solving skills because you will inevitably encounter many issues that are difficult to understand, and others may not have experience in this area. Not all problems will have someone providing answers, so at this point, you must solve the problems yourself, making your personal problem-solving ability extremely crucial. Therefore, my suggestion is to search online for general issues; if you truly cannot find an answer, then ask an expert. If that still does not work, conduct your own research. Do not simply wait for others to solve your problems for you. Remember, problems are the best opportunities for learning.
Please help by clicking on the advertisement below!
Long press the following QR code to follow!
On the road of electronics, let’s walk together!