Keil Logo


Information in this article applies to:

  • C166 Version 4 and Later
  • C51 Version 6 and Later
  • C251 Version 3 and Later


I have several C files that must be compiled with the SRC directive. How do I include these files and their .SRC files in a project in µVision?


The following list of steps shows you how to add a C file to your project, compile it with the SRC directive, assemble the .SRC file, and include it in the program linkage:

  1. Add the C file to your project. If you are adding a .C66 or a .C51 file (as is necessary for some Real-Time Kernels), you must specify that the file is a C Source File.
    Adding the C File
  2. Right-click on the file in the project window and select Options for File... This displays the options dialog box.
    Right-click on the Source File
  3. From the Properties tab, make sure that Generate Assembler SRC File and Assemble SRC File are both checked. Note that by default these checkboxes are greyed out but checked. There must be a black check on a white background to be checked.
    Set the Options
  4. Build your project as normal and µVision compiles the C file with the SRC directive specified on the command line. An .SRC file is generated and µVision assembles that file and includes it in your program's linkage.

Alternatively, you may add a file group to your project, add the C files to the group, and set the Generate Assembler SRC File and Assemble SRC File options once for the whole group.


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



The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Monday, May 5, 2008

Did this article provide the answer you needed?
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.