Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

RE: [lpc2000] Re: NOP Question

2004-04-29 by Paul Blackburn

If you do decide to use the MOV R0, R0 option instead of the NOP please check whether you are compiling your code in ARM or Thumb mode.

MOV R0, R0 is a NOP in ARM mode but in Thumb mode this affects the condition code flags in the CPSR. (for more details check the Instruction Set Reference Document).

So if you are using Thumb mode use MOV R8, R8 (or any of the high registers) instead.

If you just use NOP then the compiler will use MOV R0, R0 or MOV R8, R8 accordingly..

Paul.

-----Original Message-----
From: lpc2100 [mailto:lpc2100@...]
Sent: Thursday, April 29, 2004 2:19 AM
To: lpc2000@yahoogroups.com
Subject: [lpc2000] Re: NOP Question

You can use the following in your C function. This should work for
ADS 1.2 C compiler. Please post if it works or not.

Does gcc support __asm ?

__asm
{
NOP
}

OR

__asm
{
MOV r0, r0
}


ADS 1.2 assembler supports the NOP pseudo instruction.

Relevant text from the assembler guide
http://www.arm.com/pdfs/DUI0068B_ADS1_2_Assembler.pdf

NOP ARM pseudo-instruction
NOP generates the preferred ARM no-operation code.

The following instruction might be used, but this is not guaranteed:
MOV r0, r0
Syntax
NOP

Usage
NOP cannot be used conditionally. Not executing a no-operation is the
same as executing
it, so conditional execution is not required.
ALU status flags are unaltered by NOP.

--- In lpc2000@yahoogroups.com, "Beeno Rabbit"
wrote:
> I am using ADS2.1 compiler (Code Warrior). I don't know how to
code "NOP" in the C code.
> Any example for this?
>
> Beeno
>
>
>
> ----- Original Message -----
> From: Robert Adsett
> To: lpc2000@yahoogroups.com
> Sent: Wednesday, April 28, 2004 1:52 AM
> Subject: Re: [lpc2000] NOP Question
>
>
> At 01:28 AM 4/28/04 +0800, you wrote:
> >I am a new user of lpc2000 series. I don't know
> >how to write "NOP" in the C code. I have tried
> >_asm("NOP") and #asm("nop") but failed.
> Two questions:
> Which compiler?
> What do you mean by failed?
>
> Robert
>
> " 'Freedom' has no meaning of itself. There are always
restrictions,
> be they legal, genetic, or physical. If you don't believe me,
try to
> ; chew a radio signal. "
>
> Kelvin Throop, III
>
>
>
> --------------------------------------------------------------------
----------
> Yahoo! Groups Links
>
> ; a.. To visit your group on the web, go to:
> http://groups.yahoo.com/group/lpc2000/
>
> b.. To unsubscribe from this group, send an email to:
> lpc2000-unsubscribe@yahoogroups.com
> ;
> c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.


Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.