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
This commit is contained in:
chrysn 2012-02-27 19:20:19 +01:00
parent 805119786c
commit 8e90ffa2ab

View File

@ -35,13 +35,12 @@ void led_toggle(void);
int main(void)
{
// FIXME: As of now, this doesn't work without x being volatile; an issue with linking?
volatile int x;
int x;
led_setup();
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();
};
}