Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
Lawrence188
PostPosted: Jun 03, 2012 - 10:35 PM
Newbie


Joined: Jun 03, 2012
Posts: 5


Hey,

I try to include a CAN library in my project but it just doesnt work. I tried the following:

1. Configure config-file and makefile
2. compile makefile
3. put libcan.a in linker of avr 5
4. include can.h and config.h files

Now I think that I have to put the right LDFLAGS into the makefile. Can anyone tell me if I´m on the right way? Or is this method complety false?

Thank you!

Lawrence
 
 View user's profile Send private message  
Reply with quote Back to top
tsgd84
PostPosted: Jun 04, 2012 - 07:49 AM
Hangaround


Joined: Oct 16, 2010
Posts: 138
Location: India

Can you post the error message you get while compiling your project? This will give us better understanding of the problem.

Quote:
Now I think that I have to put the right LDFLAGS into the makefile. Can anyone tell me if I´m on the right way? Or is this method complety false?


It should be noted that makefile is generated everytime when "Build -> Build Solution" is done.
Hence don't edit the makefile, rather give LDFLAGS your option through project properties "Project -> Properties -> Toolchain -> Linker"

If you still would like to make use of the static "MakeFile" for your project, select the "Use External MakeFile" option in the "Project -> Properties -> Build" and provide the makefile with its directory.
Note: You can also use the auto generated makefile that is available at "<Project_Folder>/<Configuration_Name>/Makefile"
<Configuration_Name> by default would be Debug

_________________
Regards,
Deena
 
 View user's profile Send private message  
Reply with quote Back to top
Lawrence188
PostPosted: Jun 04, 2012 - 12:52 PM
Newbie


Joined: Jun 03, 2012
Posts: 5


The error code is: undefined reference to... And then the method name. I just didnt find any solution.
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Jun 04, 2012 - 01:31 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62281
Location: (using avr-gcc in) Finchingfield, Essex, England

Quote:

The error code is: undefined reference to...

Well that's a linker error saying the named function cannot be resolved in the link by any .o or .a presented to the build - so you probably are not succeeding in linking the right libxxxx.a file

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
Lawrence188
PostPosted: Jun 04, 2012 - 02:09 PM
Newbie


Joined: Jun 03, 2012
Posts: 5


But i linked it in project properties->toolchain and then linker. Do i have to put the path also in the directions field? Or do i have to use the external makefile from which i have have my Libcan.a?
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Jun 04, 2012 - 02:12 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62281
Location: (using avr-gcc in) Finchingfield, Essex, England

Are you using AS5 or AS6. AS5 was a bug ridden version of what went on to become AS6. One of the things fixed was a problem with paths to library files. I suspect you are falling foul of this if still using AS5.

(you can check the .map file to see what actually got linked).

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
Lawrence188
PostPosted: Jun 04, 2012 - 02:49 PM
Newbie


Joined: Jun 03, 2012
Posts: 5


I use as5. is it easier with as6? do you maybe have a tutorial for that?
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Jun 05, 2012 - 11:33 AM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62281
Location: (using avr-gcc in) Finchingfield, Essex, England

AS6 is nothing more than AS5 with a lot of the bugs fixed. You'd be mad to still use AS5.

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
Lawrence188
PostPosted: Jun 06, 2012 - 07:40 PM
Newbie


Joined: Jun 03, 2012
Posts: 5


Could it be that as5 had problems with including libraries trough the toolchain menue? Because I downloaded as6 and exactly did the same like in as5 and now it works!

This might be a dumb question now: If I use a method from the library and the compiler doesnt give any errors like "no such file" or "missing reference" I can be sure that as6 now finds the library and is usable?

Lawrence188
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Jun 08, 2012 - 09:45 AM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62281
Location: (using avr-gcc in) Finchingfield, Essex, England

Quote:

Could it be that as5 had problems with including libraries trough the toolchain menue? Because I downloaded as6 and exactly did the same like in as5 and now it works!

Perhaps you missed:
Quote:

AS5 was a bug ridden version of what went on to become AS6. One of the things fixed was a problem with paths to library files. I suspect you are falling foul of this if still using AS5.

Quote:

I can be sure that as6 now finds the library and is usable?

If in doubt check the .map file which shows what's in the binary and where it came from.

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits