Borland C ++ 4.5 compiling uC/OS-II

Source: Internet
Author: User

Preparations:
1. Install Borland C ++ 4.5 to c: \ bc45
2. Install Borland tasm5.0 to c: \ tasm
3. Right-click my computer ---> properties ---> advanced ---> environment variable ---> the "environment variable" dialog box is displayed.
4. Find the path in the "user variables" list and add "; C: \ tasm \ bin;" to the end of the variable value ;"
//--------------------------------------------------------------
// Use Borland C ++ 4.5 to compile UCOS/II
//--------------------------------------------------------------
1. Create a project folder, such as D: \ ex1. Copy all uCOS-II files to this folder. The file list is as follows:
// Program for CPU Transplantation
OS _cpu_a.asm
OS _cpu_c.c
OS _cpu.h
// UCOS-II core program
Ucos_ii.h
Ucos_ii.c
OS _core.c
OS _task.c
OS _time.c
OS _flag.c
OS _mbox.c
OS _mem.c
OS _mutex.c
OS _q.c
OS _sem.c
// PC related programs
PC. c
PC. h
Copy the experiment program to this folder:
Includes. h
OS _cfg.h
Test. c
2. Start Borland C ++ 4.5 and create a project.
Menu project ---> new project..., the "new target" dialog box is displayed.
(1) Specify the project path in "project path and name": D: \ ex1 \ ex1.ide
(2) Select “application[cmd.exe] Under "target typefaces".
(3) Select "dos [standard]" under "Platform"
(4) Select "large" under "target Modet"
(5) Click "OK ".
3. Add the following five files to the project:
(1) D: \ ex1 \ test. c
(2) D: \ ex1 \ OS _cpu_c.c
(3) D: \ ex1 \ OS _cpu_a.asm
(4) D: \ ex1 \ ucos_ii.c
(5) D: \ ex1 \ PC. c
4. Modify the file path contained in the file des. h and remove the previous "\ Software \ uCOS-II \ source \"
5. Compile
Menu project ---> compile/make all/build all, or click the button on the toolbar
There are a lot of warnings about the compilation results. I haven't figured out the cause yet, but there are no errors, so I can run the experiment program normally ~

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/DavidHoo1985/archive/2008/11/21/3344173.aspx

Using BorlandC ++ to compile uC/OS can be roughly divided into two steps:

 

Step 1: BorlandC ++ configure. So we need to install tasm 5. 0. if the program does not add "C: \ tasm \ bin" to the environment variable, you must find the path in the "user variable" list and add "at the end of the variable value. c: \ tasm \ bin; "the problem with this compiler has been solved. Otherwise, the compiler will report the error" cocould not locate tasm.exe "during compilation.

Step 2: Create a project in Borland C ++, delete the *. cpp file that comes with the project, and add five files. Five files are OS _cpu_a.asm, OS _cpu_c.c, and PC. c. Test. c. ucos_ii.c. the last file will contain all the operating system files. Of course, you can also replace each of them with * instead of ucos_ii.c *. the C file is included in the project, and only the ucos_ii.c file is included as an example.

Note the following before compiling the program des. h:

I. Des. H is a public header file that contains each file. Note that the path is based on the folder where the current project is located as the current working folder. If the relative path is used, pay attention to this point, if it is an absolute path, there is no problem. In ucos_ii.c, it has already included des. H. Due to the effect of Conditional compilation, each *. c file contained in ucos_ii.c will no longer contain some files.

Ii. Des. the H file also contains many other header files. At this time, you should also pay attention to the path problem, because the relative path is generally used, in this way, the program can be run after it is copied to other computers. If the absolute path is used, the source file must be modified to compile the program on other computers. If the compiler reports "unable to open include file 'stdio. you can view the project in the tool menu bar and modify source directories according to your installation directory in the directories option under topics.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.