Keil Logo

GENERAL: How to Create Assembly Files from C Files


Information in this article applies to:

  • C166 Version 3.12
  • C166 Version 4.03
  • C251 Version 2.14
  • C51 Version 5.50
  • C51 Version 6.00 Beta
  • C51 Version 6.00

QUESTION

How do I create an assembler file from my C source file?

ANSWER

Use the SRC directive to create assembler output from the C compiler. The SRC directive causes the compiler to generate an .SRC file with the same name as your C file. You may then assemble the .SRC file with the assembler. Note that if you make changes to the .SRC file, you should rename it to .A51 or .A66 since re-compiling the C file may overwrite the .SRC file.

You may use the SRC directive as the first line in the file. For example:

#pragma src
.
.
.

Or, you may use it on the command line:

c51 myfile.c src

c166 newfile.c src

MORE INFORMATION

  • Refer to SRC in the Cx51 User's Guide.
  • Refer to SRC in the C166 User's Guide.

SEE ALSO


Last Reviewed: Thursday, February 25, 2021


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.