Manually compile the link to generate the Hex file of the C51.

Source: Internet
Author: User

This is purely a personal hobby. Now the system UI is getting better and better, but I still like the command line inexplicably. It is a nostalgia.

Statement again: this action is only for personal hobbies.

Although it is compiled manually, A Keil installation environment is still required.

Detailed steps:


1. Use notepad or notepad ++ to write ultra-simpleCode

For example:

# Include <reg52.h>

Sbit L1 = p1 ^ 2;

Void main ()

{

L1 = 0;

While (1 );

}

Save as test. c

It is best to create the source code in the directory Keil \ C51 \ bin to avoid too many paths.

2. Go to the Keil installation directory in cmd.

Run the following command:

C51x test. c

Lx51 test. OBJ to test. Abs

Ohx51 test. Abs

Note that "ohx51" is the letter "O ". Then, check whether there are any hex files in the current directory.

I successfully tested the fl lamp with my. I don't know how it works.


There are also operations for multiple files.

Source code is required. Suppose there are two source code files: example. c sexample. C. Generate OBJ files with c51x

Operation:

C51x example. c

C51x sexample. c

Then use lx51. here is the key, because there are two files. It is also inconvenient to edit the code of Keil on the Internet. In vs2010, we wrote the C51 Code. However, after configuration, we found that only one file can be compiled, you cannot compile multiple files. This is the key. The configuration method I found on the Internet is written in this way for the lx51 parameter:

$ (Itemdir) $ (itemfilename). OBJ to $ (itemdir) $ (itemfilename). Abs

It looks okay, but it is estimated that all OBJ file names are not passed when passing parameters, so there is a problem. You can try it manually. The procedure is as follows:

Lx51 example. OBJ sexample. OBJ to hello. Abs

The last step is to generate a HEX file.

Ohx51 hello. Abs

Please try it out :)


Reference post:

How to edit the Keil code in vs2010

Http://bbs.csdn.net/topics/380233788? Page = 1

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.