Keil Logo

Source (SRC) File

The compiler can generate an assembler source file (.SRC) from a valid C source file. Refer to the SRC directive for information on how this directive is used.

There are several reasons to create an assembly source file:

  • You have used the ASM and ENDASM directives to add inline assembly to a C function.
  • You need to hand optimize the assembler output from the compiler.
  • You are writing a routine in assembly code and want to prototype the function and arguments in C.

No matter what your reason for creating a source file, the steps required are always the same:

  1. Create a C source file.
  2. Add any required inline assembly instructions.
  3. Compile using the SRC directive.
  4. Rename the .SRC file so that it is not overwritten by subsequent compilations of the original C source (if required).
  5. Make changes to the created assembler source file.
  6. Assemble using the assembler.


  • When the SRC directive is used, the compiler outputs an assembler source (.SRC) file. No object (.OBJ) file is output.
  • C symbolic and source-level debugging is not available once a C source file is converted to an assembler source file.
  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.