This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

INLINE ASSEMBLY

hi

i want to use the assembly code in my c file
how can i do this
i refered the link below
but did not the clear idea

http://www.keil.com/support/man/docs/c51/c51_cm_srcfile.htm i gone through following step's
upto step 3 it is ok
but after that i can't get any thing
i used #pragma src at 1st line of my c file
#pragma asm
some asm code
#pragma endasm
help me

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).

4.Make changes to the created assembler source file.

5.Assemble using the assembler.

Parents
  • "4->Rename the .SRC file so that it is not overwritten by subsequent compilations of the original C source (if required).
    what's this"

    Exactly what it says!

    The SRC directive causes the compiler to translate your file.c source file to a file.SRC output file.

    If you recompile file.c, the compiler will overwrite the previous file.SRC with its new output - so if you want to retain the original file.SRC, you will obviously have to rename it, or copy it to somewhere else, won't you?

    If you don't want to retain the original file.SRC, then you obviously don't need to bother - which is why it says, "if required"

    "5->Make changes to the created assembler source file.
    what kind of changes"

    Whatever changes you require!

    eg, if you are creating a C-callable assembler function, you would create the "skeleton" in 'C', use the SRC directive to convert this to a "skeleton" in assembler, and then insert the body of the assembler function at this point.

    "6->Assemble using the assembler.
    again i can't get how to assemble using asembler"

    Read the section in the Assembler Manual titled, "Assembling Programs"
    http://www.keil.com/support/man/docs/a51/a51_assembling.htm

    Or, if you're using a uVision Project, just add the assembler file to the Project - uVision will automatically recognise it as an assembler source file (based on its filename extension), and use the appropriate tool to translate it (ie, the assembler)

Reply
  • "4->Rename the .SRC file so that it is not overwritten by subsequent compilations of the original C source (if required).
    what's this"

    Exactly what it says!

    The SRC directive causes the compiler to translate your file.c source file to a file.SRC output file.

    If you recompile file.c, the compiler will overwrite the previous file.SRC with its new output - so if you want to retain the original file.SRC, you will obviously have to rename it, or copy it to somewhere else, won't you?

    If you don't want to retain the original file.SRC, then you obviously don't need to bother - which is why it says, "if required"

    "5->Make changes to the created assembler source file.
    what kind of changes"

    Whatever changes you require!

    eg, if you are creating a C-callable assembler function, you would create the "skeleton" in 'C', use the SRC directive to convert this to a "skeleton" in assembler, and then insert the body of the assembler function at this point.

    "6->Assemble using the assembler.
    again i can't get how to assemble using asembler"

    Read the section in the Assembler Manual titled, "Assembling Programs"
    http://www.keil.com/support/man/docs/a51/a51_assembling.htm

    Or, if you're using a uVision Project, just add the assembler file to the Project - uVision will automatically recognise it as an assembler source file (based on its filename extension), and use the appropriate tool to translate it (ie, the assembler)

Children
No data