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
Hot Topic (More than 8 Replies) Adding User Library and Arduino Due (Read 15375 times)
SpcCode
Newbies
*
Offline


Posts: 6
Joined: May 29th, 2014
Adding User Library and Arduino Due
Jun 1st, 2014 at 6:53pm
Print Post  
I am not able to compile any sketch that uses an external library such as Wire. Not even using the existing examples. I use Visual Studio 2010 - Atmel Studio 6.2, Windows 8.1.
« Last Edit: Jun 1st, 2014 at 6:54pm by SpcCode »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Adding User Library and Arduino Due
Reply #1 - Jun 1st, 2014 at 7:13pm
Print Post  
Hi,

I think the first thing to do is to close the Vs intellisense reporting list because it can be confusing. Please see the little X to the right of the "Error List" caption so that the Errors, Warnings and Messages disappears.

You are concerned with compiler errors not intellisense reporting so you do not need that window.

You can then try to compile and upload so that we can see if there is an error and if so what the error is. However the <wire.h> include in your picture does not have a red squiggle below it so it looks like Visual Micro will happily compile okay.

Please click F5 or the blue arrow on the tool bar, then post the compiler/upload output that appears. 

Or please notice the tab at the bottom beside "Error List" called "Output". The build information on the £Output" tab is important and useful.

Thanks
« Last Edit: Jun 1st, 2014 at 7:19pm by Tim@Visual Micro »  
Back to top
IP Logged
 
SpcCode
Newbies
*
Offline


Posts: 6
Joined: May 29th, 2014
Re: Adding User Library and Arduino Due
Reply #2 - Jun 1st, 2014 at 8:00pm
Print Post  
Thanks for the quick response. But what I am trying to really compile is the following code and gave me the same output in IntelliSense. So according to you I shall ignore those.
Now the following '.ino' compiles just fine using the Arduino IDE but using the Atmel Studio + Visual Micro gave me the following :

[code abi-ar" rcs core.a" HID.cpp.o"
ar" rcs core.a" USBCore.cpp.o"
ar" rcs core.a" variant.cpp.o"
g++" -Os -Wl,--gc-sections -mcpu=cortex-m3 r_scripts/gcc/flash.ld" ue_x_dbg/MPU6050_DMP6.map" -o MPU6050_DMP6.elf" g" -lm -lgcc -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group syscalls_sam3.c.o" MPU6050_DMP6.cpp.o" I2Cdev\I2Cdev.cpp.o" Wire\Wire.cpp.o" MPU6050\MPU6050.cpp.o" sam3x8e_gcc_rel.a" core.a" -Wl,--end-group
objcopy" -O binary MPU6050_DMP6.elf" MPU6050_DMP6.bin"
Binary sketch size: 40,656 bytes (used 8% of a 524,288 byte maximum) (10.47 secs) [/code]

I never saw it generating the '.hex', only these '.o', '.elf', '.map', '.bin'
« Last Edit: Jun 1st, 2014 at 8:28pm by SpcCode »  
Back to top
 
IP Logged
 
SpcCode
Newbies
*
Offline


Posts: 6
Joined: May 29th, 2014
Re: Adding User Library and Arduino Due
Reply #3 - Jun 1st, 2014 at 8:45pm
Print Post  
The other error that I am having is; lets say I want to put the default '..DMP6.ino' example into a separate class (.h and .cpp) and use a default (main) '.ino' to call the update routines. Then Atmel get confuse because cannot find the headers files?!

Code (C++)
Select All
Compiling 'MyIMU' for 'Arduino Due (Programming Port)'
Build folder: file:///C:/Users/Me/AppData/Local/VMicro/Arduino/Builds/MyIMU/arduino_due_x_dbg
Summary: Header=1 Prototypes=4 Imports=1
Additional Defines: VISUALMICRO_COMPILER_VER=1;
Architecture Tools: C:\arduino-1.5.6-r2-windows/hardware/tools/g++_arm_none_eabi/bin/
Sketchbook: file:///C:/Users/Me/Documents/Arduino
All import libraries will be re-compiled
Include Path 'C:\arduino-1.5.6-r2-windows\hardware\arduino\sam\cores\arduino'
Include Path 'C:\arduino-1.5.6-r2-windows\hardware\arduino\sam\variants\arduino_due_x'
Include Path 'C:\arduino-1.5.6-r2-windows\libraries\IMU'
Include Path 'C:\arduino-1.5.6-r2-windows\libraries'
Include Path 'C:\arduino-1.5.6-r2-windows\hardware\arduino\sam\libraries'
Include Path 'C:\Users\Me\Documents\Arduino\libraries'
g++" -c -g -Os -Wall -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -Dprintf=iprintf -mcpu=cortex-m3 -DF_CPU=84000000L -DARDUINO=156 -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM -D__SAM3X8E__ -mthumb -DUSB_VID=0x2341 -DUSB_PID=0x003e -DUSBCON -DUSB_MANUFACTURER="\"Unknown\"" -DUSB_PRODUCT="\"Arduino Due\"" "-IC:\arduino-1.5.6-r2-windows\hardware\arduino\sam\system/libsam"  "-IC:\arduino-1.5.6-r2-windows\hardware\arduino\sam\system/CMSIS/Device/ATMEL/" -I"C:\arduino-1.5.6-r2-windows\hardware\arduino\sam\cores\arduino" -I"C:\arduino-1.5.6-r2-windows\hardware\arduino\sam\variants\arduino_due_x" -I"C:\arduino-1.5.6-r2-windows\libraries\IMU" -I"C:\arduino-1.5.6-r2-windows\libraries" -I"C:\arduino-1.5.6-r2-windows\hardware\arduino\sam\libraries" -I"C:\Program Files (x86)\Visual Micro\Visual Micro for Arduino\Micro Platforms\default\debuggers" -I"C:\Users\Me\Documents\Arduino\libraries" pp" -o pp.o" -DVISUALMICRO_COMPILER_VER=1
MyIMU.ino:In file included from
IMU.h:51: fatal error: I2Cdev.h: No such file or directory
:compilation terminated.
Error compiling 

  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Adding User Library and Arduino Due
Reply #4 - Jun 1st, 2014 at 9:22pm
Print Post  
Thanks for the info. Yes the error list does often include compiler output a whole load of other stuff that can be ignored which is why I said it caused confusion. 

Further more your report and screen shot do not give much detail but the compiler output you have posted shows the specific errors, which user libraries and where they are located. The direct error resulting in failed compile as  "redefinition" error. 

Once a compile has failed other errors will appear because of the missing compiled files. It isn't possible or easy to distinguish the main cause of the errors from the "Error List", especially from a screen grab. 

Therefore, providing support using the output is much easier.

Please switch on "tools>options>visual micro>compiler>verbose" then run the build. 

Email the resulting output to info[at]visualmicro.com


This will save me asking a bunch of questions. 

I suspect it's a path config issue/bug that we can workaround but just in case and to save time please also zip your sketch and email it. I can also look at your second report above which suggests some confusion somewhere. Header includes are very standard so should work.
« Last Edit: Jun 1st, 2014 at 9:24pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Adding User Library and Arduino Due
Reply #5 - Jun 1st, 2014 at 9:28pm
Print Post  
forgot to say. before emailing the verbose output click "Build>Clean Solution" then click build. This will give a full output from a clean compile, thanks
« Last Edit: Jun 1st, 2014 at 9:29pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Adding User Library and Arduino Due
Reply #6 - Jun 2nd, 2014 at 12:38am
Print Post  
Got the email thanks. I'll take look at the 6050 compile issue asap

Some immediate pointers

1) In the Visual Micro Ide config manager it is the folder name where the arduino.exe exists and NOT the name of the exe that is required however I think visual micro auto truncates?

2) The arduino rules are that non library #includes must reside in the same folder as the sketch. We adhere to this rule to avoid support issues. Your IMU project does not have an imu.h in the folder so the #include will fail.

3) With a project open, please confirm if the libraries show on the "Project>Add/Import sketch library>core" menu

Thanks

« Last Edit: Jun 2nd, 2014 at 12:39am by Tim@Visual Micro »  
Back to top
IP Logged
 
SpcCode
Newbies
*
Offline


Posts: 6
Joined: May 29th, 2014
Re: Adding User Library and Arduino Due
Reply #7 - Jun 2nd, 2014 at 1:04am
Print Post  
1. Checked that is = to C:\arduino-1.5.6-r2-windows\
2. Maybe I am confuse. But if I add the directory to the list it shall try to look for those libraries?
3. I noticed that if the external class (not the .ino) is the one that calls the library is then when, the application cannot find it. But if I add the library to the .ino it finds it. Is that how suppose to work?
« Last Edit: Jun 2nd, 2014 at 1:08am by SpcCode »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Adding User Library and Arduino Due
Reply #8 - Jun 2nd, 2014 at 12:37pm
Print Post  
Yes that all looks good. Yes it is an Arduino rule that libraries must be included into the main sketch.ino. Library includes in .cpp files will only be discovered that way,

Can I assume that when you tested in the arduino ide you had the correct source code but when you tested in visual micro it was changed slightly? This would explain why it worked in arduino and not in vm?
  
Back to top
IP Logged
 
SpcCode
Newbies
*
Offline


Posts: 6
Joined: May 29th, 2014
Re: Adding User Library and Arduino Due
Reply #9 - Jun 2nd, 2014 at 11:11pm
Print Post  
But for me that does not make sense at all. Because then why the Arduino has a folder called Libraries? We supoose to put external libraries to avoid adding it to every arduino sketch.

So I did it anyway. Now I have to add every arduino core library to where the sketch is located?

See below

Code (C++)
Select All
Compiling 'IMU' for 'Arduino Due (Programming Port)'
Build folder: file:///C:/Users/Me/AppData/Local/VMicro/Arduino/Builds/IMU/arduino_due_x_dbg
Summary: Header=1 Prototypes=4 Imports=0
Additional Defines: VISUALMICRO_COMPILER_VER=1;
Architecture Tools: C:\arduino-1.5.6-r2-windows\/hardware/tools/g++_arm_none_eabi/bin/
Sketchbook: file:///C:/Users/Me/Documents/Arduino
Include Path 'C:\arduino-1.5.6-r2-windows\hardware\arduino\sam\cores\arduino'
Include Path 'C:\arduino-1.5.6-r2-windows\hardware\arduino\sam\variants\arduino_due_x'
Include Path 'C:\arduino-1.5.6-r2-windows\libraries'
Include Path 'C:\arduino-1.5.6-r2-windows\hardware\arduino\sam\libraries'
Include Path 'C:\Users\Me\Documents\Arduino\libraries'
-gcc" -c -g -Os -w -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -Dprintf=iprintf -mcpu=cortex-m3 -DF_CPU=84000000L -DARDUINO=156 -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM -D__SAM3X8E__ -mthumb -DUSB_VID=0x2341 -DUSB_PID=0x003e -DUSBCON -DUSB_MANUFACTURER="\"Unknown\"" -DUSB_PRODUCT="\"Arduino Due\"" "-IC:\arduino-1.5.6-r2-windows\hardware\arduino\sam\system/libsam"  "-IC:\arduino-1.5.6-r2-windows\hardware\arduino\sam\system/CMSIS/Device/ATMEL/" -I"C:\arduino-1.5.6-r2-windows\hardware\arduino\sam\cores\arduino" -I"C:\arduino-1.5.6-r2-windows\hardware\arduino\sam\variants\arduino_due_x" -I"C:\arduino-1.5.6-r2-windows\libraries" -I"C:\arduino-1.5.6-r2-windows\hardware\arduino\sam\libraries" -I"C:\Program Files (x86)\Visual Micro\Visual Micro for Arduino\Micro Platforms\default\debuggers" -I"C:\Users\Me\Documents\Arduino\libraries" "C:\Users\Me\AppData\Local\VMicro\Arduino\Builds\IMU\arduino_due_x_dbg\twi.c" -o "C:\Users\Me\AppData\Local\VMicro\Arduino\Builds\IMU\arduino_due_x_dbg\twi.c.o" -DVISUALMICRO_COMPILER_VER=1
twi.c:25: fatal error: avr\io.h: No such file or directory
:compilation terminated.
Error compiling 

  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
SpcCode
Newbies
*
Offline


Posts: 6
Joined: May 29th, 2014
Re: Adding User Library and Arduino Due
Reply #10 - Jun 3rd, 2014 at 1:51am
Print Post  
Hi

Good news. I finally got it working in Visual Micro. I got it as I was thinking of how is suppose to work, without adding any library to where the .ino is located. Compiles in Arduino IDE and Visual Micro. However, I still do not have the *.hex.
How can I do to get it?

[code eabi-ar" rcs "C:\Users\Me\AppData\Local\VMicro\Arduino\Builds\IMU\arduino_due_x_dbg/core.a" pp.o"
-ar" rcs "C:\Users\Me\AppData\Local\VMicro\Arduino\Builds\IMU\arduino_due_x_dbg/core.a" pp.o"
-g++" -Os -Wl,--gc-sections -mcpu=cortex-m3 r_scripts/gcc/flash.ld" IMU.map" -o "C:\Users\Me\AppData\Local\VMicro\Arduino\Builds\IMU\arduino_due_x_dbg/IMU.elf" "-LC:\Users\Me\AppData\Local\VMicro\Arduino\Builds\IMU\arduino_due_x_dbg" -lm -lgcc -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group sam3.c.o" " Cdev.cpp.o" .cpp.o" PU6050.cpp.o" pp.o" sam3x8e_gcc_rel.a" "C:\Users\Me\AppData\Local\VMicro\Arduino\Builds\IMU\arduino_due_x_dbg/core.a" -Wl,--end-group
-objcopy" -O binary "C:\Users\Me\AppData\Local\VMicro\Arduino\Builds\IMU\arduino_due_x_dbg/IMU.elf" "C:\Users\Me\AppData\Local\VMicro\Arduino\Builds\IMU\arduino_due_x_dbg/IMU.bin"
Binary sketch size: 41,472 bytes (used 8% of a 524,288 byte maximum) (11.67 secs) [/code]
« Last Edit: Jun 3rd, 2014 at 1:53am by SpcCode »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Adding User Library and Arduino Due
Reply #11 - Jun 3rd, 2014 at 10:17am
Print Post  
Hi,

I said include your libraries in your main sketch.ino not copy them anywhere different. I also explained the reason you NEED to include in the sketch.ino is because you were trying to use the libs from cpp/.c files and having a problem.

#include "mylib1.h"
#include "mylib2.h"

If you are new to arduino I suggest you add your libraries using the menu called Project>add sketch library" then you will see the #includes

It would also save us all some time if you used the documentation from visualmicro.com Smiley http://www.visualmicro.com/page/User-Guide.aspx?doc=Add-Libraries.html

As concerns library locations there are two. One below the Arduino Ide folder that you have used and one below the SketchBook folder normally mydocuments\arduino\libraries. The latter are called user libraries and will remain if you move your arduino ide location.

You will also find in the documentation that you can switch on "tools>options>compiler>show builder folder" which provides a hyperlink to the build files (elf,hex) in the compiler output

All of this, except showing the build folder is standard arduino and is covered in the arduino.cc documentation.

Thanks
« Last Edit: Jun 3rd, 2014 at 10:18am by Tim@Visual Micro »  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint