Teach you how to use DOSBOX to get started with UCOS-II operating system with practical examples

Teach you how to get started with the UCOS-II operating system on the DOSBOX emulator with practical examples (including the use of various DOS command operations, makefiles and BAT batch files)

Table of contents

foreword

1. Description

2. Place the BC31 and SOFTWARE folders in the root directory of the E drive

 3. Modify the application folder name

4. Change the original working directory WORK to MYWORK

5. Modify the name of the C file TEST.C

6. Create a batch file in the root directory of disk E

1. Method 1 (two files need to be changed)

2. Method 2 (only one file needs to be changed)

7. Makefile rules and their role in C program compilation

8. References or materials

Summarize


foreword

        An operating system (English: Operating System, abbreviation: OS) is a group of interrelated system software programs that manage and control computer operations, use and run hardware and software resources, and provide public services to organize user interactions. According to the operating environment, the operating system can be divided into desktop operating system, mobile operating system, server operating system, embedded operating system and so on. This article introduces the entry-level use of UCOS-II and DOSBOX in detail based on examples, hoping to be helpful to everyone.


Tip: The following is the main text of this article. It is not easy to write an article. I hope it can help you. Please attach a link when reprinting.

1. Description

        As shown in the figure below, it is the first homework assigned by the teacher when I was learning the embedded real-time operating system ucos-ii. The homework requires us to have a preliminary understanding of the files involved in DOSBOX, BC31 and SOFTWARE. I am also just learning embedded, and I feel that there is still a certain degree of difficulty. Before doing it, I was also in a daze. After finishing it, I probably have a little understanding of embedded. It took about ten hours before and after to get it done. Here, I will record all the detailed steps to complete the assignment (except 6), hoping to help everyone who is just starting to learn the ucos-ii operating system. By the way, before the operation, it is best to carefully read the three sections 2.1, 2.2, and 2.3 of the fourth edition of "Embedded Real-Time Operating System ucos-ii Principles and Applications" written by Ren Zhe, otherwise you will not know the principle after the operation.

2. Place the BC31 and SOFTWARE folders in the root directory of the E drive

        Place BC31 and SOFTWARE in the root directory of the E disk as shown in the figure below.

         1. Copy the OVL file under the DOSBOX path to the BIN path of BC31. If you don’t copy it, an error will be reported in the following operations, and normal operation cannot be performed. Partners who do not have the OVL file can refer to the link in the blog [2] at the end of the article.

        2 Since the installation path of BC31 and SOFTWARE is not in the C disk, so modify the parameters in some files next. Enter E:/SOFTWARE/uCOS-II/EX1_x86L/BC45/SOURCE/, open the test.lnk file with WordPad or Notepad,

 change into:

 Save and close after modification.

        3 Enter E:/SOFTWARE/uCOS-II/EX1_x86L/BC45/TEST/, open the TEST.MAK file with software, anything that can open it is fine, I use Notepad++ code editor here. Open and modify the BORLAND variable to the E drive you installed yourself, as shown in the figure below, save and close.

         4 Finally, open the MAKETEST.BAT batch file in the same directory and edit it as shown in the figure below. Save and close when finished editing.

 3. Modify the application folder name

        Modify EX1_X86L to myproj20203659.

4. Change the original working directory WORK to MYWORK

        1. Then enter E:/SOFTWARE/uCOS-II/EX1_x86L/BC45/TEST/, open the MAKETEST.BAT file with the software, and replace WORK with MYWORK. Among them, the MD command means to create a folder, the CD command means to enter a folder, and the COPY means to copy a file.

         2. Open the installed DOSBOX0.74 software, enter the following command on the command line, and enter the E disk.

         Among them, mount is named as a virtual drive letter.

        Enter the following commands in sequence. Among them, cd is the command to switch directories, and del is the command to delete files. Since the DOSBOX name is not case-sensitive, lowercase letters are also acceptable when entering commands. Every time you finish typing a command, press the Enter key to execute the command.

         Here you need to pay attention to enter myproj~1 when entering myproj20203659, because the naming characters recognized by DOSBOX cannot exceed 8. (It’s okay here. If you make a mistake, it will give you a prompt. When modifying the name in TEST.C, you should also pay attention to this rule. At least three hours were wasted when I didn’t find it. I kept reporting that myc20203659.c could not be found. I couldn't find a solution. Later, I found out that my modified myc20203659.c existed through the dir/w command, but DOSBOX judged myc20203659.c as myc202~1.c, because the naming characters recognized by DOSBOX cannot exceed 8, So everyone remember this rule, it’s disgusting, it’s the first time I’ve seen such a short maximum named character).

         Finally, after entering the maketest.bat command and pressing Enter, DOSBOX will start compiling and linking. After completion, a TEST.C file will be regenerated, and there will be three more folders as shown in the figure below. Among them, LST is useless in this example, OBJ is used to store the .OBJ files generated by compilation, and MYWORK is a temporary working directory, providing a place for compilation and linking.

5.  Modify the name of the C file TEST.C

        Change TEST.C to the name shown in the figure below.

          Enter E:/SOFTWARE/uCOS-II/EX1_x86L/BC45/TEST/, open the TEST.MAK file with the software, and modify it as shown in the figure below.

         Enter E:/SOFTWARE/uCOS-II/EX1_x86L/BC45/SOURCE/, open the test.lnk file with WordPad or Notepad, and modify it to:

        Save and close after modification

        Re-open DOXBOX and enter the following commands. After entering the last command and pressing Enter, the link will be compiled.

         After the compilation is completed, the .obj file shown in the figure below will be generated. This is the .obj file formed after compiling myc20203659.c.

6. Create a batch file in the root directory of disk E

1. Method 1 (two files need to be changed)

        Copy the following file to the root directory of E disk and rename it.

         And open the mybat20203659.BAT batch file and modify it to the content shown in the figure below.

         Enter E:/SOFTWARE/uCOS-II/EX1_x86L/BC45/TEST/, open the TEST.MAK file with software, add a line of code as shown in the figure below, save and close after adding.

         Delete TEST.EXE as shown in the figure below.

         Re-open DOSBOX and enter the following command. After entering the last mybat2~1.bat and pressing Enter, the link will be compiled. After completion, TEST.EXE can be found in the root directory of the E drive.

2. Method 2 (only one file needs to be changed)

            Copy the following file to the root directory of E disk and rename it.

        And open the mybat20203659.BAT batch file and modify it to the content shown in the figure below.

         Delete TEST.EXE as shown in the figure below.

        Re-open DOSBOX and enter the following command. After entering the last mybat2~1.bat and pressing Enter, the link will be compiled. After completion, TEST.EXE can be found in the root directory of the E drive.

7. Makefile rules and their role in C program compilation

        Regarding this issue, my understanding is shown in the figure below.

8. References or materials

[1] t_larry.Use BC3.1 to compile, connect and debug uC/OS-II source files in PC environment [DB/OL].http://t.csdn.cn/4fy29,2006.

[2] DDMiao~. Using BC3.1[DB/OL] on WIN10. http://t.csdn.cn/SUjBa, 2018.

[3] Destiny is beyond words. (with pictures) Steps for automatic mount and virtual directory switching under assembly tool dosbox [DB/OL]. http://t.csdn.cn/CWwav,2020.

[4] https://www.bilibili.com/video/BV1Dx411W7KB/?spm_id_from=333.337.search-card.all.click&vd_source=f18c75fb1f08fcaa24a9e5409179aa1d This video is about how to use the mount command.


Summarize

        The above is what I want to talk about today. This article introduces some entry-level operation methods of DOSBOX in detail from the specific operation, and also introduces some knowledge related to BC31 and SOFTWARE. It took me 4 hours to write this blog, and I hope it will be helpful to everyone.

Guess you like

Origin blog.csdn.net/m0_66360845/article/details/129340871