Hi, I found a message regarding this issue:
In file included from StdDefs.c:8:0: /usr/lib/gcc/avr/4.5.3/../../../avr/include/util/delay.h: In function ‘msleep’: /usr/lib/gcc/avr/4.5.3/../../../avr/include/util/delay.h:153:43: error: __builtin_avr_delay_cycles expects an integer constant. make: *** [StdDefs.o] Error 1 but I did not found any solution. So please have a look at the provided patch. Since I don't know much about the internals of simulavr I'm not sure if this fix is correct. But at least it's a compiling and working (IMHO) solution for possibly broken avr-libc. Best Regards, - Foka
>From 7b565d6a6c149f9aa66326fc7ccc0f93b4f0f05e Mon Sep 17 00:00:00 2001 From: foka <fokamo...@gmail.com> Date: Sun, 18 Mar 2012 22:42:58 +0100 Subject: [PATCH] Possible compile fix for avr-gcc 4.5.3. This fix however may introduce an old bug where optimizations != 0 led to broken msleep(...). It seems even a #define __DELAY_BACKWARD_COMPATIBLE__ doesn't help here. --- examples/atmel_key/StdDefs.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/examples/atmel_key/StdDefs.c b/examples/atmel_key/StdDefs.c index 8735b52..f5eb606 100644 --- a/examples/atmel_key/StdDefs.c +++ b/examples/atmel_key/StdDefs.c @@ -61,7 +61,12 @@ void msleep(INT16U ms) INT16S i,j; for (i = 1; i < ms; i++) for (j = 1; j < ONETENTH_MS; j++); / * to give 1/10 ms*/ - _delay_ms(ms); // Changed K. Schwichtenberg + //_delay_ms(ms); // Changed K. Schwichtenberg + + // Well, Kays fix seems not to work with avr-gcc (GCC) 4.5.3 on + // ubuntu 11.10 (at least) + for (;ms; --ms) + _delay_ms(1); } //------------------------------------------------------------ -- 1.7.5.4
_______________________________________________ Simulavr-devel mailing list Simulavr-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/simulavr-devel