In fact, there are a lot of posts on the Internet, but when I learned this thing, I still found that my compiling environment is somewhat different from what I said on the Internet. A friend recently asked this question, so posting it by the way may be helpful to some people.
The source code example of uC/OS runs on the x86 series, so we do not need to manually port the source code. Here we will focus on compilation and debugging.
In
Compile uC/OS on x86. This article introduces Borland C/C ++ 3.1 and Borland C/C ++ on the Internet.
4.5 for compilation, where the author uses 3.1, and added an example of using 4.5 for compilation in the source code released later. I have never used bc3.1, but only bc4.5 and
Tc3.0 and can be compiled successfully. Some people also want to use vc6.0 or a more advanced BC version for compilation. Because these advanced compilation environments are based on the protection mode, they are based on the actual model with uC/OS.
The Code does not match, so we need to make some improvements:
First, according to what netizens have said (there are articles and source code about VC transplantation on the Internet), the acquisition of clock beats is no longer obtained by directly controlling the underlying hardware, but by using multithreading to simulate clock interruptions. This method is actually just a simulation, and it is definitely not pure, but it does not affect learning uC/OS.
Second, according to the uC/OS official website (http://www.micrium.com/) provided on the example, the above said some "program into the boot disk, before the computer is started into windows, it will take control of the entire CPU. "cloud, don't worry about it, it's quite troublesome.
Its
Actually, to learn embedded OS, you can't always think about using VC to do this. Who never used TC in school?
At least the computer examination should be performed on the computer, and the computer system should use tc2.0. (this may not be the same today)
I will talk about compiling uC/OS with tc3.0. The reason for not introducing BCX. X is that the integrated environment debugging of bc4.5 can only be performed on Windows programs, but not on Windows programs.
For the uC/ossprogram, td.exe (Turbo
Debugger. We all know that the turbo series is actually produced by Borland ). In this case, it would be better for me to use TC. Although it is a DOS interface, it should at least be integrated.
Debugger.
Tool preparation:
Tcpp3.0
Tasm5.0
Of course, the source code of uC/OS-II is also available.
1. Install tcpp3.0 and tasm5.0. Assume that you have installed it to D:/TC and D:/tasm.
2. Release programs in the UC/os-II.exe package to the root directory of a disk.
3.
Set environment variables: My computer-> properties-> advanced-> environment variables-> User variables, double-click the path item, add a semicolon after the existing PATH variable value, and then
Add the path of the TC toolset and the path of the tasm toolset, that is, D:/TC/bin and D:/TC/tasm. Both paths must be set. If the first item is missing, the system will prompt tasm2msg
The file cannot be found, but you can check that it is already under Bin (I don't know why it cannot be found, maybe the working directory of the Program Calling It is not in TC/bin )! If the second item is missing, it is obvious that TC
When you call tasm to compile the Assembly file, you will be prompted that the tasm file cannot be found. However, this tool can be copied directly from tasm/bin to TC/bin without setting environment variables.
4. Enter D:/TC/bin, double-click the MS-DOS Shortcut of TC to start TC.
5. Set the directory of the compiling environment. Option-> directory, set the first item to D:/TC/include, set the second item to D:/TC/lib, and click OK to exit.
6. Set the compilation mode to the big mode. Option-> compiler-> code generation, select large in the Mode Selection item.
6. Open the project. Project-> open project, select the example project under the uC/OS directory, such as D:/software/UCOS-II/ex1_x86l/ex1l. prj.
7. Compile-> build all.
8. If there is no compilation error (it should be correct by step), run.
9. TC integrates the debugging environment. debugging can be carried out in TC.
In addition, because the directory structure of uC/OS-II released in different periods is not the same, I will attach the source code of the version I used so that the above steps can be followed. The package contains the TC and tasm files installed and can be used directly.
Http://pickup.mofile.com/7520268061262011