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 Adding "Example Project" code to Arduino sketches (Read 4274 times)
DominicG
Newbies
*
Offline


Posts: 1
Joined: Sep 12th, 2013
Adding "Example Project" code to Arduino sketches
Sep 13th, 2013 at 12:57am
Print Post  
Hello,
I have an Arduino Due sketch and I would like to add code from one of the Atmel Studio 6.1 Example Projects.

When creating a new Example Project within Atmel Studio, there are lots of .c and .h files in a "src" folder as well as listed under the "Dependencies" tab.

I can take the main() code and move it over to the Arduino setup() and loop() functions, but how can I make all extra required files accessible during the compile process within an Arduino sketch project?  When I try to compile I get lots of errors about .h files that can't be found.

Thank you in advance for any suggestions or advice,

Dominic

PS - I also noticed that the Arduino sketch projects show the device type as AVR, even when the board is set for Due, which uses a SAM3X processor.  Any way to change that device setting so that ARM examples could be added from the ASF Wizard?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Adding "Example Project" code to Arduino sketches
Reply #1 - Sep 13th, 2013 at 12:14pm
Print Post  
Hi there,

We do plan to extend to created the correct project type for sam projects. It currently defaults to avr8 however Visual Micro will work with the sam format project.

To create an arduino project you do not have to use the standard "Sketch" menus. You can create an empty sam in a folder of the same name, then add an .ino file of the same name. This is all that is required for VM to kick in and do it's stuff. If you then renamed the .ino to something else VM would go silent and allow the normal Atmel stuff to work.

There is a huge difference between ASF and Visual Micro. When Visual Micro is active only the intellisense features of Atmel are used, the entire build process is overridden to be Arduino compatible which does not work the way Atmel normally works, Atmel scripts, libs, project settings all become irrelevant.

An Arduino project must not include a main however the best way to use examples might be to call whatever the main called from the setup() or loop() or the master arduino sketch.

Libraries can only be included as real arduino libraries, you might need to read up on that. 

For Arduino compile, project source files must only exist in the sketch folder, sub folders are not compiled (these are all arduino rules). Sources in other folders will be ignored.

We are considering supporting an Arduino/Atmel hybrid in future versions which would allow some ASF stuff combined with Arduino but right now we are only Arduino compatible with a few variations.

If you create an Atmel project manually you can delete all the scripts that are created within the project by Atmel and would need to move the src files into the main folder.

I hope this helps, I haven't had much time to play with this so hopefully the above rules will give some pointers. Feel free to re-clarify or ask other stuff. Sorry
« Last Edit: Sep 13th, 2013 at 12:33pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint