[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] How to force GCC to not to remove "nop" statements ?
From: |
Vincent Trouilliez |
Subject: |
[avr-gcc-list] How to force GCC to not to remove "nop" statements ? |
Date: |
Thu, 19 Feb 2009 19:01:34 +0100 |
Hi list,
Like many people I guess, I am using in-lined "nop" asm statements to
respect the timing of external devices, when toggling their control
lines.
In the case at hand I am driving a text LCD module, and the
"Enable" line must be pulsed low for 250ns.
void lcd_send_nibble(uint8_t data)
{
...
//pulse Enable line
LCD_PORT |= LCD_E;
__asm__ volatile("nop");
__asm__ volatile("nop");
__asm__ volatile("nop");
__asm__ volatile("nop");
LCD_PORT &= ~LCD_E;
}
My AVR was running at 8MHz, so an instruction cycle of 125ns, so two nop
in-lined were spot on, just perfect, and it ran fine.
Today I pushed the AVR (ATmega32) up to its maximum of 16MHz.
So I now need 4 nops not two. So I did that.. and the LCD doesn't work
reliably. Suspecting the problem, I went straight to the generated
assembly, and horror, my 4 nop statements have disappeared !
I made a few trials. It appears that up to and including 3 nop
statements, GCC leaves them alone. But if I put 4 of them, it removes
them all !
Any way to instruct GCC to leave my 4 nops ?
Am using avr-gcc 4.3.2
Regards,
--
Vince
- [avr-gcc-list] How to force GCC to not to remove "nop" statements ?,
Vincent Trouilliez <=
- RE: [avr-gcc-list] How to force GCC to not to remove "nop" statements ?, Weddington, Eric, 2009/02/19
- Re: [avr-gcc-list] How to force GCC to not to remove "nop" statements ?, Vincent Trouilliez, 2009/02/19
- Re: [avr-gcc-list] How to force GCC to not to remove "nop" statements ?, David Kelly, 2009/02/19
- RE: [avr-gcc-list] How to force GCC to not to remove "nop" statements?, Weddington, Eric, 2009/02/19
- Re: [avr-gcc-list] How to force GCC to not to remove "nop" statements?, David Kelly, 2009/02/19
- Re: [avr-gcc-list] How to force GCC to not to remove "nop" statements?, Jim Brain, 2009/02/19
- Re: [avr-gcc-list] How to force GCC to not to remove "nop" statements?, David Kelly, 2009/02/19
- [avr-gcc-list] Preferred ICE (was: How to force GCC to not to remove "nop" statements?), Graham Davies, 2009/02/19
- Re: [avr-gcc-list] Preferred ICE (was: How to force GCC to not to remove "nop" statements?), David Kelly, 2009/02/20