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

inserting one line assembly code in c

hi ..i am new to embedded systems ...
i am using uvision from keil ..
i just wanna include one line assembly
code .. into my c-code ..
example -- nop (no operation ) assembly
instuction into my c code .. how do we do
it ???
thanks ..
pruthvi

Parents
  • "There is a big difference between fiddling with registers in a C program and inserting a nop."

    True - but he only cited the nop thing as an example.

    Using inline assembler just for a nop is, in itself, a very silly thing to do: as Erik said, it destroys all your source debug info - and for no reason at all because Keil provide the _nop_() intrinsic fubction for this very purpose!

    Arguments about portability seem pointless here, as the issues concerned are inherently target and/or tool specific!

    Using inline assembler also overrides uVision's dependency checking, so that such module are always rebuilt - whether they need it or not (and it's a double translation - as Erik also said)

Reply
  • "There is a big difference between fiddling with registers in a C program and inserting a nop."

    True - but he only cited the nop thing as an example.

    Using inline assembler just for a nop is, in itself, a very silly thing to do: as Erik said, it destroys all your source debug info - and for no reason at all because Keil provide the _nop_() intrinsic fubction for this very purpose!

    Arguments about portability seem pointless here, as the issues concerned are inherently target and/or tool specific!

    Using inline assembler also overrides uVision's dependency checking, so that such module are always rebuilt - whether they need it or not (and it's a double translation - as Erik also said)

Children
  • Andy,

    I think we are in complete agreement. When you said "Don't do it", I thought you meant not to use the intrinsic functions either (which is what both Erik and I recommended). I never use inline assembly, I toyed around with it once and decided it was too much of a headache.