Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Can't use custom board.txt USB_PRODUCT / USB_MANUFACTURER (Read 5156 times)
CapnBry
Junior Member
**
Offline


Posts: 32
Joined: Nov 4th, 2011
Can't use custom board.txt USB_PRODUCT / USB_MANUFACTURER
Nov 6th, 2016 at 12:48pm
Print Post  
Hey Guys, long time no see! I've recently started development using a custom (non-Arduino) Atmega32u4 design and custom boards.txt file. 
Code
Select All
-- 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:
Code
Select All
"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:
Code
Select All
"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:
Code
Select All
-- 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
« Last Edit: Nov 6th, 2016 at 12:48pm by CapnBry »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Can't use custom board.txt USB_PRODUCT / USB_MANUFACTURER
Reply #1 - Nov 6th, 2016 at 3:06pm
Print Post  
Good to hear from you.

All the board properties are processed the same way without consideration of where they originated.

I suspect that you need to surround your -D with single quotes.

If you look in the arduino avr platform.txt the usb flags have single quotes around the items that need to be strings

# USB Flags
# ---------
build.usb_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} -DUSBCON '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}'

and as you say the boards.txt def can then contain double quotes

arduino_due_x_dbg.build.usb_manufacturer="Arduino LLC"
arduino_due_x_dbg.build.usb_product="Arduino Due"
« Last Edit: Nov 6th, 2016 at 3:07pm by Tim@Visual Micro »  
Back to top
IP Logged
 
CapnBry
Junior Member
**
Offline


Posts: 32
Joined: Nov 4th, 2011
Re: Can't use custom board.txt USB_PRODUCT / USB_MANUFACTURER
Reply #2 - Nov 7th, 2016 at 1:30am
Print Post  
Well shut my mouth, I didn't even think to check the platform.txt for the expansion. Updated the custom platform.txt, works like a charm both in the Arduino IDE and Visual Micro. Sorry about wasting your time, I will report this upstream to the MediaTek people.

On a side note, I am pleased to see Visual Micro continuing to be improved. Every time there is a new release I say "My my, that is helpful." If I need to switch over the the Arduino IDE, I wonder how people use that thing. It is constantly getting better, but golly it has a long way to go to be as helpful as Visual Studio for working with 10,000 lines of code across 20 files. When I built my new computer this year I bought a new Visual Micro license just to show you how much I care. Keep it up!
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Can't use custom board.txt USB_PRODUCT / USB_MANUFACTURER
Reply #3 - Nov 7th, 2016 at 1:39am
Print Post  
Thanks! 

Quoted strings are not an easy subject, I had to refresh my memory and go hunting so it was a very understandable post.

It's great to hear the product is useful and thanks for all the past support, never forgotten.

edit: I used a local project board.txt to test quoted strings. It saves having to reload tool chains each time the platform or boards.txt change. Handy for testing/experiments.

« Last Edit: Nov 7th, 2016 at 1:41am by Tim@Visual Micro »  
Back to top
IP Logged
 
Kabron
Full Member
***
Offline


Posts: 170
Joined: Nov 1st, 2015
Re: Can't use custom board.txt USB_PRODUCT / USB_MANUFACTURER
Reply #4 - Oct 27th, 2018 at 1:40pm
Print Post  
Hello, I have similar issue, but do not realize the details yet.
The below code compiled and works fine under Arduino IDE and platformio, so I guess that something wrong is in the visualmicro.
Code (C++)
Select All
#define BLYNK_PRINT Serial
#define BLYNK_DEBUG

#include <BlynkSimpleYun.h>

char auth[] = "65dc98d70cd2419982e7f47b3cf";
// we need no ssid and password because Linkit connected wifi itself
char a;
int LED = 13 ;

void setup() {
  Serial.begin(115200);
  delay(2000);
  Blynk.begin(auth);
  Serial.println("Blynk.begin");
  pinMode(LED, OUTPUT);
  digitalWrite(LED, LOW);
}

void loop() {

  Blynk.run();

} 



Resulting errors are:
Code
Select All
Building core ...
1.43\pic32mx\include\packages\LinkIt\tools\avr-gcc\4.8.1-arduino5/bin/avr-gcc" -c -g -x assembler-with-cpp -mmcu=atmega32u4 -DF_CPU=8000000L -DARDUINO=10805 -DARDUINO_AVR_LINKITSMART7688 -DARDUINO_ARCH_AVR -DUSB_VID=0x0E8D -DUSB_PID=0xAB01 "-DUSB_MANUFACTURER="MediaTek Labs"" "-DUSB_PRODUCT="LinkIt Smart 7688 Duo"" -I"d:\Arduino-ESP32-IDE\hardware\arduino\avr\cores\arduino" 2-1.43\pic32mx\include\packages\LinkIt\hardware\avr\0.1.8\variants\smart7688" "d:\Arduino-ESP32-IDE\hardware\arduino\avr\cores\arduino\wiring_pulse.S" -o a65e24\core\wiring_pulse.S.o"
1.43\pic32mx\include\packages\LinkIt\tools\avr-gcc\4.8.1-arduino5/bin/avr-gcc" -c -g -Os -Wall -std=gnu11 -ffunction-sections -fdata-sections -MMD -mmcu=atmega32u4 -DF_CPU=8000000L -DARDUINO=10805 -DARDUINO_AVR_LINKITSMART7688 -DARDUINO_ARCH_AVR -DUSB_VID=0x0E8D -DUSB_PID=0xAB01 "-DUSB_MANUFACTURER="MediaTek Labs"" "-DUSB_PRODUCT="LinkIt Smart 7688 Duo"" -I"d:\Arduino-ESP32-IDE\hardware\arduino\avr\cores\arduino" 2-1.43\pic32mx\include\packages\LinkIt\hardware\avr\0.1.8\variants\smart7688" "d:\Arduino-ESP32-IDE\hardware\arduino\avr\cores\arduino\hooks.c" -o a65e24\core\hooks.c.o"
Error compiling core

error*: Labs: No such file or directory
1.43\pic32mx\include\packages\LinkIt\tools\avr-gcc\4.8.1-arduino5/bin/avr-gcc" -c -g -Os -Wall -std=gnu11 -ffunction-sections -fdata-sections -MMD -mmcu=atmega32u4 -DF_CPU=8000000L -DARDUINO=10805 -DARDUINO_AVR_LINKITSMART7688 -DARDUINO_ARCH_AVR -DUSB_VID=0x0E8D -DUSB_PID=0xAB01 "-DUSB_MANUFACTURER="MediaTek Labs"" "-DUSB_PRODUCT="LinkIt Smart 7688 Duo"" -I"d:\Arduino-ESP32-IDE\hardware\arduino\avr\cores\arduino" 2-1.43\pic32mx\include\packages\LinkIt\hardware\avr\0.1.8\variants\smart7688" "d:\Arduino-ESP32-IDE\hardware\arduino\avr\cores\arduino\WInterrupts.c" -o a65e24\core\WInterrupts.c.o"
1.43\pic32mx\include\packages\LinkIt\tools\avr-gcc\4.8.1-arduino5/bin/avr-gcc" -c -g -Os -Wall -std=gnu11 -ffunction-sections -fdata-sections -MMD -mmcu=atmega32u4 -DF_CPU=8000000L -DARDUINO=10805 -DARDUINO_AVR_LINKITSMART7688 -DARDUINO_ARCH_AVR -DUSB_VID=0x0E8D -DUSB_PID=0xAB01 "-DUSB_MANUFACTURER="MediaTek Labs"" "-DUSB_PRODUCT="LinkIt Smart 7688 Duo"" -I"d:\Arduino-ESP32-IDE\hardware\arduino\avr\cores\arduino" 2-1.43\pic32mx\include\packages\LinkIt\hardware\avr\0.1.8\variants\smart7688" "d:\Arduino-ESP32-IDE\hardware\arduino\avr\cores\arduino\wiring.c" -o a65e24\core\wiring.c.o"

error*: Smart: No such file or directory
Build failed for project 'Blynk'


error*:7688: No such file or directory
error*: Labs: No such file or directory


error*: Duo: No such file or directory
error*: Smart: No such file or directory

error*:7688: No such file or directory 



As could bee seen in first lines, compiler refers to wrong core folder Digilent. I see no resonable explanation to that. 

Also, IDE periodically lost include references, marking red #include <BlynkSimpleYun.h>
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Can't use custom board.txt USB_PRODUCT / USB_MANUFACTURER
Reply #5 - Oct 27th, 2018 at 1:49pm
Print Post  
Please open a new thread with your question and also provide the verbose build output so that we can see what board you have selected, which ide and cores are installed etc.
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint