Build fail in Cygwin with arv-gcc 7.3.0
Opened this issue · 1 comments
Hello.
I tried to compile Katiana bootloader with LUFA 170418 and avr-gcc 7.3.0 in Cygwin, but it fails with these errors:
In file included from Katiana.c:106:0:
Katiana.h:239:37: error: expected ')' before 'naked'
static void __attribute__((noreturn naked noinline)) StartSketch( void );
^~~~~
Katiana.h:239:52: error: expected identifier or '(' before ')' token
static void __attribute__((noreturn naked noinline)) StartSketch( void );
^
Katiana.c:111:16: error: variable 'avrSignature' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
static uint8_t avrSignature[3] PROGMEM = { AVR_SIGNATURE_3, AVR_SIGNATURE_2, AVR_SIGNATURE_1 };
^~~~~~~~~~~~
Katiana.c:117:16: error: variable 'softwareIdentifier' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
static uint8_t softwareIdentifier[7] PROGMEM = SOFTWARE_IDENTIFIER;
^~~~~~~~~~~~~~~~~~
make: *** [../../LUFA/Build/DMBS/DMBS/gcc.mk:214: obj/Katiana.o] Chyba 1
Error in Katiana.h I resolved by comma separating the attributes.
static void __attribute__((noreturn, naked, noinline)) StartSketch( void );
The error in Katiana.c I simply tried to solve by adding const.
Then I got this error:
[GCC] : Compiling C file "Descriptors.c"
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega32u4 -fshort-enums -fno-inline-small-functions -fpack-struct -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=8000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=0x7000 -I. -I../../LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_USER -DF_USB=8000000UL -MMD -MP -MF obj/Descriptors.d Descriptors.c -o obj/Descriptors.o
Descriptors.c:264:16: error: variably modified 'SramSerialString' at file scope
static uint8_t SramSerialString[ sizeof( USB_StdDescriptor_Header_t ) + (strlen(USB_HDWR_SERIAL) << 1) + 2 ];
^~~~~~~~~~~~~~~~
make: *** [../../LUFA/Build/DMBS/DMBS/gcc.mk:214: obj/Descriptors.o] Chyba 1
This I didn't know how to resolve so I tried to make array with static size of 50 just for test...
And then I got this, which I really don't know how to fix :D
[LNK] : Linking object files into "Katiana.elf"
avr-gcc obj/Katiana.o obj/Descriptors.o obj/SignatureTable.o obj/HIDParser.o obj/Device_AVR8.o obj/EndpointStream_AVR8.o obj/Endpoint_AVR8.o obj/Host_AVR8.o obj/PipeStream_AVR8.o obj/Pipe_AVR8.o obj/USBController_AVR8.o obj/USBInterrupt_AVR8.o obj/ConfigDescriptors.o obj/DeviceStandardReq.o obj/Events.o obj/HostStandardReq.o obj/USBTask.o -o Katiana.elf -lm -Wl,-Map=Katiana.map,--cref -Wl,--gc-sections -Wl,--relax -mmcu=atmega32u4 -Wl,--section-start=.text=0x7000 -Wl,--section-start=.apitable_signatures=0x7FF8 -Wl,--undefined=BootloaderAPI_Signatures
obj/Katiana.o: In function `StartSketch':
Katiana.c:(.text.StartSketch+0xa): undefined reference to `LEDs_Disable'
obj/Katiana.o: In function `main':
Katiana.c:(.init9+0x7e): undefined reference to `LEDs_Init'
Katiana.c:(.init9+0x110): undefined reference to `LEDs_RX_Off'
Katiana.c:(.init9+0x114): undefined reference to `LEDs_TX_Off'
obj/Katiana.o: In function `__vector_17':
Katiana.c:(.text.__vector_17+0x3e): undefined reference to `LEDs_RX_Off'
Katiana.c:(.text.__vector_17+0x48): undefined reference to `LEDs_TX_Off'
Katiana.c:(.text.__vector_17+0x76): undefined reference to `LEDs_RX_On'
Katiana.c:(.text.__vector_17+0x88): undefined reference to `LEDs_TX_On'
collect2.exe: error: ld returned 1 exit status
make: *** [../../LUFA/Build/DMBS/DMBS/gcc.mk:239: Katiana.elf] Chyba 1
Thanks for any help :)
@Benik3
I got the entire thing to compile using a tip from here:
https://shintakezou.blogspot.com/2017/03/length-at-compile-time.html
static uint8_t SramSerialString[ sizeof( USB_StdDescriptor_Header_t ) + (STRLENUSB_HDWR_SERIAL << 1) + 2 ];
becomes
static uint8_t SramSerialString[ sizeof( USB_StdDescriptor_Header_t ) + (__builtin_constant_p(strlen(USB_HDWR_SERIAL)) << 1) + 2 ];