Hey Guys, long time no see! I've recently started development using a custom (non-Arduino) Atmega32u4 design and custom boards.txt file.
-- boards.txt snippet
smart7688.build.usb_product="LinkIt Smart 7688 Duo"
smart7688.build.usb_manufacturer="MediaTek Labs"
The problem is in the quoting. When I try to build, visual micro adds its own quotes to the gcc line, which double up on the existing quotes:
"C:\Arduino\arduino-1.6.8\hardware\tools\avr/bin/avr-gcc" -c -g -x assembler-with-cpp -mmcu=atmega32u4 -DF_CPU=8000000L -DARDUINO=10608 -DARDUINO_AVR_LINKITSMART7688 -DARDUINO_ARCH_AVR -DUSB_VID=0x0E8D -DUSB_PID=0xAB01 "-DUSB_MANUFACTURER="MediaTek Labs"" "-DUSB_PRODUCT="LinkIt Smart 7688 Duo"" -I"C:\Arduino\arduino-1.6.8\hardware\arduino\avr\cores\arduino" variants\smart7688" "C:\Arduino\arduino-1.6.8\hardware\arduino\avr\cores\arduino\wiring_pulse.S" -o core\wiring_pulse.S.o"
error*: Labs: No such file or directory
error*: Smart: No such file or directory
error*:7688: No such file or directory
error*: Duo: No such file or directory
Error compiling core
If I remove the quotes from the boards.txt, then the define works properly, however when the macro is inserted into USBCore.cpp by the preprocessor, it needs the quotes to be a valid string:
"C:\Arduino\arduino-1.6.8\hardware\tools\avr/bin/avr-g++" -c -g -Os -Wall -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega32u4 -DF_CPU=8000000L -DARDUINO=10608 -DARDUINO_AVR_LINKITSMART7688 -DARDUINO_ARCH_AVR -DUSB_VID=0x0E8D -DUSB_PID=0xAB01 "-DUSB_MANUFACTURER=MediaTekLabs" "-DUSB_PRODUCT=LinkItSmart7688Duo" -I"C:\Arduino\arduino-1.6.8\hardware\arduino\avr\cores\arduino" variants\smart7688" "C:\Arduino\arduino-1.6.8\hardware\arduino\avr\cores\arduino\USBCore.cpp" -o core\USBCore.cpp.o"
LinkItSmart7688Duo was not declared in this scope
USBCore.cpp:49: note in expansion of macro USB_PRODUCT
const u8 STRING_PRODUCT[] PROGMEM = USB_PRODUCT
MediaTekLabs was not declared in this scope
USBCore.cpp:66: note in expansion of macro USB_MANUFACTURER
const u8 STRING_MANUFACTURER[] PROGMEM = USB_MANUFACTURER
USBCore.cpp: In function bool SendDescriptor(USBSetup&)
LinkItSmart7688Duo was not declared in this scope
USBCore.cpp:511: note in expansion of macro USB_PRODUCT
return USB_SendStringDescriptor(STRING_PRODUCT, strlen(USB_PRODUCT), TRANSFER_PGM)
MediaTekLabs was not declared in this scope
USBCore.cpp:514: note in expansion of macro USB_MANUFACTURER
return USB_SendStringDescriptor(STRING_MANUFACTURER, strlen(USB_MANUFACTURER), TRANSFER_PGM)
Error compiling core
Strangely enough, this works just fine with the Arduino Yun target which gets escaped quotes instead of outer quoting:
-- boards.txt
yun.build.usb_product="Arduino Yun"
"C:\Arduino\arduino-1.6.8\hardware\tools\avr/bin/avr-g++" -c -g -Os -Wall -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10608 -DARDUINO_AVR_YUN -DARDUINO_ARCH_AVR -DUSB_VID=0x2341 -DUSB_PID=0x8041 -DUSB_MANUFACTURER="\"Unknown\"" -DUSB_PRODUCT="\"Arduino Yun\"" -I"C:\Users\bmayland\Documents\Arduino\libraries\DigitalWriteFast" -I"C:\Users\bmayland\Documents\Arduino\libraries\rf12_itplus" -I"C:\Users\bmayland\Documents\Arduino\libraries\ShiftRegLCD" -I"C:\Arduino\arduino-1.6.8\libraries" -I"C:\Arduino\arduino-1.6.8\hardware\arduino\avr\libraries" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\cg4p4uav.arp\Micro Platforms\default\debuggers" -I"C:\Users\bmayland\Documents\Arduino\libraries" -I"C:\Arduino\arduino-1.6.8\hardware\arduino\avr\cores\arduino" -I"C:\Arduino\arduino-1.6.8\hardware\arduino\avr\variants\yun" -o o"
It seems like the custom boards.txt is being handled differently than the stock Arduino boards.txt? I can work around it by escaping the quotes in the custom boards.txt with \" but it would be nice to have this work out of the box. VMicro 1611.5.1