casanovg / timonel

ATtiny85/45/25 I2C bootloader
MIT License
111 stars 18 forks source link

error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode #7

Open MoHorst opened 6 years ago

MoHorst commented 6 years ago

Should i add -std=c99?

root@bananapim2zero:~/timonel/timonel-bootloader# make tml-bootloader.c: In function ‘main’: tml-bootloader.c:200:25: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode for (int i = 0; i < PAGE_SIZE - 2; i += 2) { ^ tml-bootloader.c:200:25: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code tml-bootloader.c: In function ‘ReceiveEvent’: tml-bootloader.c:247:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode for (byte i = 0; i < commandBytes; i++) { ^ tml-bootloader.c: In function ‘RequestEvent’: tml-bootloader.c:293:13: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode for (byte i = 0; i < GETTMNLV_RPLYLN; i++) { ^ tml-bootloader.c:347:17: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode for (byte i = 3; i < (RXDATASIZE + 1); i += 2) { ^ tml-bootloader.c:354:17: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode for (byte i = 1; i < (RXDATASIZE + 1); i += 2) { ^ tml-bootloader.c:364:13: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode for (byte i = 0; i < WRITPAGE_RPLYLN; i++) { ^ Makefile:55: recipe for target 'tml-bootloader.o' failed make: *** [tml-bootloader.o] Error 1

casanovg commented 6 years ago

Hi! It is not necessary, I never had that issue with updated versions of the toolchain. I'm compiling it with avr-gcc v8.2.0 downloaded from Zak Kemble's site.

$ avr-gcc --version

avr-gcc.exe (GCC) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

In addition, if you have Git Bash installed, it is better to compile it with this script ./MAKE_TML.sh to get smaller images and being able to locate it in upper memory positions.

Please let me know if this solves the issue, thank you ...

Regards!