Use __asm__("nop") in the loop-based delays.

Since we recently switched from -O0 to -Os, an increase in the loop count
as well as the addition of __asm__("nop") is required (so that the loop
doesn't get optimized/removed).
The real fix is to add a proper timer-based delay function, of course.

Also, fix a bunch of cosmetic issues and typos.
This commit is contained in:
Uwe Hermann
2011-01-03 01:12:07 +01:00
parent 05f66cde4c
commit ca53311bfc
11 changed files with 82 additions and 61 deletions

View File

@@ -35,9 +35,11 @@ int main(void)
while (1) {
/* Manually: */
GPIO3_DATA |= (1 << 0); /* LED off */
for (i = 0; i < 80000; i++); /* Wait (needs -O0 CFLAGS). */
for (i = 0; i < 800000; i++) /* Wait a bit. */
__asm__("nop");
GPIO3_DATA &= ~(1 << 0); /* LED on */
for (i = 0; i < 80000; i++); /* Wait (needs -O0 CFLAGS). */
for (i = 0; i < 800000; i++) /* Wait a bit. */
__asm__("nop");
}
return 0;