Browse Source

fixed a bug in efm32 miniblink example

actually, it wasn't a bug; the compiler just optimized a statement away
until it was declared volatile. inserting a no-op assembler instruction
to make it more obvious what's going on
pull/47/head
chrysn 13 years ago
parent
commit
8e90ffa2ab
  1. 5
      examples/efm32/tinygecko/efm32-tg-stk3300/miniblink/miniblink.c

5
examples/efm32/tinygecko/efm32-tg-stk3300/miniblink/miniblink.c

@ -35,13 +35,12 @@ void led_toggle(void);
int main(void) int main(void)
{ {
// FIXME: As of now, this doesn't work without x being volatile; an issue with linking? int x;
volatile int x;
led_setup(); led_setup();
while(1) { while(1) {
for(x = 0; x < 200000; ++x); for(x = 0; x < 200000; ++x) asm("mov r0,r0"); /* no-op, prevent compiler from optimizing this away */
led_toggle(); led_toggle();
}; };
} }

Loading…
Cancel
Save