[SOLVED] AS7 + Arduino + Libraries: How?!

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi there,

I'm just coming from the Arduino IDE to Atmel Studio 7.

 

Looks great, with great capabilities (inkl. debugging via atmel ice)... But I'm a bit lost. Hopefully someone can give me a hint or a link to a tutorial. Here's my problem:

 

I have a working arduino sketch that makes use of default Arduino libs (like EEPROM.h) as well as an own Arduino Lib.

 

The sketch compiles and runs fine with Arduino IDE. I installed Atmel Studio 7.0.790, created a new Arduino project, set the path to my sketch + to my Arduino IDE 1.6.9, clicked OK and AS imported the project.

Looks good so far, but if I hit F7 to compile, the IDE complains about missing libraries (like EEPROM.h).

If I have a look at the "Solution Explorer", I can only see my sketch + the arduino core stuff. But no arduino default libs, and no other libs the sketch uses.

 

Question #1:

Is this an expected behavior? What sense does it make to import an sketch if nothing dependant is added/linked?!

 

Question #2:

If this is NOT an expected behavior: What am I doing wrong?

 

Question #3:

If this behavior is really expected: How can I add the required libs? I searched the net, but did not find any explanation on how to add arduino libs to such an imported arduino project. Would be great if you can give me a hint or a link about this.

 

Sidenote:

I thought "mybe an update of AS will impriove the situation"... Nope... it did not. I upgraded to AS7.0.1006 with the result, that my sketch cannot be imported anymore. AS is giving me an error "not enough arguments for format string" without any further detail which format string... So I deinstalled the version and went back to 7.0.790

 

best regards,

Alex

 

Last Edited: Tue. Jul 26, 2016 - 05:41 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I use Arduino v1.6.6.    AS7.0.790 will only import from Arduino v1.7.x (at least on my Win7-64 PC)

I have AS7.0.943 which will not even import from my v1.7.8

 

v1.6.x IDEs from Arduino.cc are superior in every way to the v1.7.x from Arduino.org

 

There is nothing very clever or difficult with how an IDE parses and converts an INO file into regular C++ source code for the Compiler.    It also searches and finds the libraries and headers.   However v1.7.x does not do it very well.   And AS7 seems to be even less capable.

 

Incidentally,  if AS7 requires a particular v1.6.x or v1.7.x version it could easily tell you instead of just crashing.   After all,  this would be about one line of Java code (or however it parses).

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So, did you finally found a combination of AS and Arduino IDE that a) imports the sketch and b) imports the libs as well?

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No.  I just gave up.

 

I can debug existing projects that I had imported with AS7.0.790

Both Zero (SAMD21) and Due (SAM3X) work fine with ATMEL-ICE.

 

I seldom use debugWIRE (UNO) or JTAG (Mega2560) but the existing projects debug ok too.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hmm, okay. Maybe someone else can give a hint?!

 

Regarding your debugging of existing projects:

 

All I wanted to do is to debug my project. Not the sketch, but my library. 

 

If I use the .elf file the Arduino IDE creates with AS -> File Open -> Open Object file for debugging, I can debug, but I don't have the sources correctly linked with the debug session. Maybe you can give a hint on this?!

 

Alex.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Found an interesting context menu item:

 

Solution Explorer... Right-click on "ArduinoCore". You will find an menu item "Add Arduini Library". there you can select/add libraries by just selecting them.

I have to try this. Will report back on the result.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you have AS7.0.790 then you can probably import from v1.7.x just fine.

 

Does your Arduino project build with v1.7.x ?

 

One day everything will work seamlessly in AS7.

One day the warring Italians will pick up all the toys that they have thrown out of their respective prams.

 

One day pigs will fly.

 

Incidentally,  if you point your Arduino "build" to a real directory,   AS7 or even AS6 will debug the ObjectFile pretty well on AVR targets.   i.e. you build with the proven Arduino IDE.   Step / Trace with read-only source code in Atmel Studio.

 

Unfortunately,  this trick does not work properly with ARM targets.   It gets nested structs wrong.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can you attach the sketch file that fails to import in Atmel Studio 7.0.1006?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I didn't continue with AS7.0.1006 ... I don't want to comment-out different line to be able to import the sketch. It seems that not only the sketch is affected, but also some files of some libraries... 

 

So, back to 7.0.790 ..

 

As I already wrote: import of sketch is possible, but sketch does not compile due to missing libs. 

 

Now I finally found the solution to my problem:

 

As I wrote above, you can right-click on "ArduinoCore" in solution explorer and select "Add Arduino Library". 

 

That will add the library. But this also does not solve the issue. Of course... adding the lib die ArduinoCore will not help. You have to add it to your sketch. Below "ArduinoCore" in solution explorer, you will find the node for your sketch. Right click on this, and add the required libs there. Hit F7 and ... tadaaa... it simply works.

 

Now I'm able to

 

a) import any sketch to AS7

b) compile and debug it with AS7. 

 

And I finally found the root-cause for the issue I had with my library, thanks to AS7 and it's debugging-feature. 

I wish AS7 would run on linux, so that I don't have to use my Win10-VirtualBox-VM.... But that's another story.

 

regards,

Alex