Arduino vs ATMEL Studio library

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

Hello guys!

 

I have a library (C langue) for Atmel Studio, however, I cannot use Atmel studio on MAC, at least to my knowledge, please correct, if I am wrong that would save my life! Anyway, I am working in Arduino IDE and so far I have been moving. But, this time I got a library that I cannot compile on Arduino, namely I get a verbose/ problem like this:

 

Documents/Arduino/libraries/.../I2C_Functions.h:18:18: fatal error: asf.h: No such file or directory
  #include "asf.h"

                  ^
compilation terminated.
exit status 1
Error compiling for board Arduino/Genuino Uno.

Has any of you managed to compile a C library in Arduino?

 

Any suggestions, recommendations are more than welcome!

 

Best.

 

 

Bravo!!!

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

There's no fundamental reason why ASF code could not be build on a Mac. As long as you have a copy of avr-gcc (which Arduino provides) then you should be able to build any AVR code written for avr-gcc (as ASF is).

 

The error you are getting is simply saying it cannot find the header. So that's what you need to fix.

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

You probably want to use something like platformio on the mac if you want native tools. It will compile your Arduino projects and give you the flexibilty of AtmelStudio along with a half decent editor. Debugging is paid for though :(
Otherwise run a vm.

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

mu234 wrote:
.../I2C_Functions.h

For I2C, most freaks use Peter Fleury's library here: http://homepage.hispeed.ch/peter...

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274

 

 

 

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

Hi!

 

Thanks for your feedback, can you elaborate a bit more how to reach that asf.h,  I am not sure where I can find the asf.h...

 

Apparently, one of the files ( As Jim has pointed out, this is I2C_functions.h ) in the library want to look into the asf.h , but as you have pointed out it isn't there, do I understand this correctly?

 

Best.

Bravo!!!

Last Edited: Fri. Dec 7, 2018 - 05:52 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When the Arduino compile-process sees "#include stuff.h" in the .ino file, it looks for the two files: stuff.h and stuff.cpp, in the folder (and subfolders) of C:\ArduinoSketchbook\libraries.  Make sure that your library for stuff is located in the sketchbook directory.  Otherwise it returns this error while compiling.

Last Edited: Fri. Dec 7, 2018 - 05:59 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

mu234 wrote:
 I am not sure where I can find the asf.h...
Well where did the file that has the #include <asf.h> come from in the first place. I would suggest/hope that whoever created that file also kept a copy of all the asf.h (and the HUNDREDS of other .h that it includes) near by to the .c source file where it was included.

 

But like Jim says, if you just want to use I2C why don't you just use Fleury and forget the dreadful ASF thing anyway?

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

I use the also Arduino IDE. I found it better as I didn't need to spend large amounts of time learning the seemingly endless icons and menus of yet another IDE.
I use it on the current version of Linux Mint.
I had exactly the same problem with the Fleury header. I put the header file in the libraries folder inside the projects folder.
The path was correct but it just couldn't find it. I moved it to the libraries folder in the main Arduino file and altered the path, still couldn't find it.
Tried everything, even copied and pasted the header name and library path from the tut I was reading on how to use it, nothing worked.
Then when I moved it back again to the original libraries folder inside the projects folder it found it, even though I did not alter the path?
So I don't know why but I had to move it around a bit before it was found, as they say in The States "go figure".
Maybe try doing that?

Last Edited: Thu. Jan 17, 2019 - 09:02 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The Fleury header "problem" is due to the include statement using wedges.

The Compiler will search for System headers.

 

I suggest that you alter the includes to use quotes instead of wedges.

The Compiler will search for  User headers.

 

Fleury intended you to have one copy of his library in an "almost" System directory.

You would need to add the location of this "almost System" location to every Project.

And every user would need to have her own "almost System" location and Project search path.

 

Modern PCs have plenty of disk space.   It is reasonable to copy Fleury files to your Project directory.    (and use quotes)

It also means your Project can be self-contained in a ZIP that you can post to punters.

 

David.

Last Edited: Thu. Jan 17, 2019 - 10:28 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I never cease to be amazed by the number of (otherwise professional) C programmers who don't understand the significance of <foo.h> versus "foo.h" in #include.

 

People who write "libraries" typically think they've come up with something equal to <stdlib.h> or <string.h> or something so call their own one <uart.h> when it's supposed to be "uart.h" !!

 

(I see this all the time when reviewing professional code).

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

clawson wrote:

I never cease to be amazed by the number of (otherwise professional) C programmers who don't understand the significance of <foo.h> versus "foo.h" in #include.

 

People who write "libraries" typically think they've come up with something equal to <stdlib.h> or <string.h> or something so call their own one <uart.h> when it's supposed to be "uart.h" !!

 

(I see this all the time when reviewing professional code).

 

And the kicker to that is, every single C book covers that.

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

It is appropriate if you are providing a whole "suite" of libraries and support code e.g. Windows or Arduino

 

If it is a single library it is more trouble than it is worth.

 

Incidentally,   the Arduino "processes" the INO files and looks for header files and forward declarations.

This identifies which "libraries" to compile and link with.

 

The Arduino makes these tricky operations simple.    Which is why punters find it difficult to add search paths, include paths, library paths, declarations, ... to a regular C or C++ project.

 

You can develop Arduino libraries with C++ and H files in local project tabs.

When debugged,   the C++ and H can be moved to the global User llibraries.

Your test sketches can find "library.h" with quotes or wedges.

 

David.

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

david.prentice wrote:

   Which is why punters find it difficult to add search paths,

 

OK, I'll bite. What is a punter?

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

That is developing a bad habit. 

 

<> is only for "system" which basically means "the bit of the C library support that end users should never touch"!

 

Normal programmers should only ever be dealing with "" (unless they really are adding some new support to AVR-LibC or something).

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

I agree 100%.    Arduino "ease of use" creates bad habits.

 

I am happy with search and link assistance.   

Forward declaration assistance is unwise.

Distinguishing System and User headers should be strict.

 

Hey-ho.   Arduino has been a force for good in the microcontroller world.

 

David.

 

p.s. a "punter" is someone who bets money on horses (and other risky enterprises)

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

david.prentice wrote:

p.s. a "punter" is someone who bets money on horses (and other risky enterprises)

 

but can also be used as another word for a customer.

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

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

(and other risky enterprises)

"Punter" is one of Lord (Sir) Alan Sugar's favourite words in fact. It's the term he always used at Amstrad for "our customer" presumably in the sense that they are paying some of their money and taking a gamble on buying one of the things we designed and made :-)

 

So meetings were always about "how is the punter going to do X, Y or Z?" or "what will the punter think of having to do A then B?" 

 

(the term "lorry driver" always figured heavily too as this characterized our "average customer" ;-)