You may have noticed that there are now more people doing Linux research in embedded systems than those working with WinCE. Many manufacturers also provide documentation primarily focused on Linux. I have always found it hard to understand this, as the interface of WinCE is much more visually appealing and user-friendly than that of Linux. More importantly, developing with WinCE is quite similar to development under Windows, making it much easier to learn. However, the number of people learning Linux or using Linux for embedded systems far exceeds those using WinCE. In conversations with many professionals, I learned that their companies have never considered using WinCE due to its high cost, opting instead for Linux development. In my graduate lab, we also do not use WinCE; most research is focused 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, I have heard that WinCE 6.0 is now open-source, but in terms of cost and resources, Linux has an unbeatable advantage. Correspondingly, more and more electronics manufacturers have begun to develop products using Linux. For example, the Android operating system developed by Google is actually based on an improved version of the Linux 2.6.23 kernel.1. Learn Basic Bare-Metal Programming For those studying hardware, it is essential to first have a tangible understanding of the basic usage of the hardware and a deep understanding of its control methods. If you start by learning the Linux system or porting it, you will quickly find yourself in a deep whirlpool. When I first started learning ARM, I chose ARM7 (mainly because ARM9 was still quite expensive at the time). While learning ARM7, I maintained the mindset of learning the 51 microcontroller, using ADS for programming. My first experiment was controlling an LED. Anyone who has studied ARM for a while would laugh at how naive this approach is. Related recommendation: Is learning STM32 really that simple? In reality, it is not; I believe this process is very beneficial because no matter how complex the system is, it ultimately boils down to the control of these low-level hardware components. Therefore, having a tangible understanding of hardware control makes it much easier to learn bare-metal programming while also grasping the architecture and control principles of the hardware, which I refer to as understanding hardware. Understanding hardware means comprehending 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 ADCs, GPIOs (General Purpose I/O), and NAND flash controllers, all of which have registers for control. Each of these registers has an address; what do these addresses mean? How do we control these peripheral devices through registers? Furthermore, each unit within the NOR flash has a corresponding address in the chip’s memory; how do these addresses relate to the previously mentioned register addresses? Are they the same? Additionally, the storage units within NAND flash are not linearly arranged; how does the S3C2410 map the NAND flash addresses into memory space for use? Or simply put, how should we use NAND flash? Moreover, when programming ARM9 using ADS, an initialization assembly file is required; what is its purpose? What does the code inside it mean? Can we do without it? These are all aspects of understanding hardware. Once you grasp these concepts, you will have a profound understanding of hardware, which will greatly aid your further studies. If you skip this step, I believe you will find it increasingly confusing as you progress, feeling that these topics are unfathomable because your foundation is not solid. However, I must clarify that I have not programmed ARM9 using ADS; after completing ARM7, I directly moved on to learning the Linux system on ARM9. Therefore, I find it difficult to answer questions related to programming ARM9 with ADS; you will have to research that yourself. I will soon provide a tutorial for this section. The examples in this tutorial are not written for the boards we represent; they are taken from our college’s lab, written by Yingpeite for their own experimental box, but they are quite valuable as a reference.2. Conduct Basic Experiments Using the Linux System When purchasing a board, it generally comes with some Linux experiment examples. Spend some time working through these; this process is also very meaningful and helps accumulate practical knowledge for further learning. Can you imagine someone who has never used a Linux system being able to learn Linux programming effectively?Follow the examples in the manual and perform the experiments inside; although it may feel a bit like a child learning to walk and somewhat simplistic, I believe many experts have gone through this process. Currently, Deep Blue Technology does not plan to provide corresponding examples, as the development board providers will offer a wealth of examples. We do not want to duplicate efforts; we only provide the most valuable resources that they do not offer.3. Study the Complete Operation Process of the Linux System What does a complete Linux system consist of? Three parts:
- Bootloader
- Linux Kernel
- Root File System
How do these three parts work together to form the system? What are their respective functions? What is the relationship between them? How do they connect? What is the execution flow of the system? Understanding this will give you a clear picture of the entire system’s operation and lay another important foundation for the next step of creating this Linux system. There are tons of resources available online regarding this topic; do your own research.4. Start System Porting As mentioned earlier, a complete Linux system has three parts, and now that you understand their relationships and functions, what you need to do is learn to create these components yourself. Of course, I cannot ask you to write this code; that is not feasible. 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 many 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 understand many related concepts. Once you complete this process, you will find that you have become a novice expert. If you have a strong research spirit, you will inevitably want to look at the source code. Many books introduce how to read Linux source code, but I do not advocate aimlessly reading Linux source code. As Xu Sanduo said, this is meaningless. Only when you feel the need to look at the source code during the porting process should you seek out good books. I recommend a great book by Ni Jili, “Analysis and Programming of the Linux Kernel,” which is focused on the Linux 2.6.11 kernel and provides in-depth insights. I suggest improving your C programming skills before diving into it. As for the porting of each part, there is a wealth of information available online; do your own research. However, I must remind you that many personal experience accounts may have some reservations. If you follow their instructions, you will inevitably encounter some issues, but they may not tell you how to resolve them. At this point, you will have to rely on yourself. If you cannot rely on yourself, feel free to reach out to me for 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 find a solution. The ultimate goal of this step is to download the standard source code package from the official homepage (which is mostly foreign, unfortunately), 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 running.”5. Study the Development of Linux Device Drivers Porting the system is not the final goal; the ultimate aim is to develop products and projects, all of which require driver development. Linux device drivers can be quite diverse. There are significant differences between writing for Linux 2.4 and Linux 2.6, and even among different versions of Linux 2.6, there are variations in driver development. Therefore, writing Linux device drivers is not an easy task, and there is often insufficient reference material for the latest versions. My suggestion is to use and port a not-so-new kernel version, as this will provide ample resources for learning driver programming.6. Study Application Development In addition to writing drivers for projects, you will also need to develop applications.The current trend is towards graphical application development, with the Qt/E library being the most commonly used. I have always used this library to develop my applications, but I hope you can use the domestic MiniGUI library. To borrow a phrase from Jay Chou’s advertisement: “Support domestic products, support MiniGUI.” MiniGUI programming is quite similar to VC programming under Windows, making it relatively easy to learn, and the results are quite impressive. I have used it to develop programs for ARM7. However, the biggest drawback 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 library, but due to my limited skills, that remains a fantasy, haha. Related recommendations: Once you complete this step, you will have essentially learned all the content related to embedded and Linux development. I also want to share a small piece of advice. During my learning process of embedded Linux, I rarely asked others for help. The objective reason is that there were no experts in this field among my teachers, classmates, or seniors, and the subjective reason is that I do not like asking others; I prefer to research and solve problems myself. This approach has the benefit of enhancing my problem-solving skills, as there are always many issues that are difficult to understand, and not everyone has experience in this area. Not all problems have someone to provide answers, so you must solve them yourself. Therefore, my advice is to search online for general questions; if you truly cannot find an answer, then ask an expert. If that still does not work, go back to your research. Do not simply wait for others to solve your problems.