Linking Errors External Library
I am developing for a Olimex SAM7-EX256. I would like to use the USB libraries provided by ATMEL. To do this I created two projects in within my solution. The primary project contains the main.c and the secondary (USB) project points to the USB library. To set up the USB project I used a dynamic folder. I then pointed to the appropriate folders within the USB folders by updating the Solution's "User Include Directories" property. I also set the Project Dependencies so that my primary project was dependent on the USB project.
This all appears to work. The project locates the header and source files. Even the Source Navigator displays the functions I want to implement from the library. However, when I Build the project each of the functions I call cause the linking step to error with "undefined reference" errors.
I am not actually trying to do anything complicated. The USB library has an "led.c" file and I am only trying to reference the functions that initiate and toggle the LED. Even if this was going to fail for the board I am using, the project should still build properly.
Thank you in advance,
Cutaway
-
Jon,
Excellent. Actually, I noticed that but since I am new to Crossworks I wasn't sure I was right. Good. Most likely I will just delete that project and re-add it. But, for future reference, is there a way to convert projects? Move it from a "staging" project to a "library" project, without deleting what I already have?
Thank you,
Cutaway
-
Well, I guess my problems go deeper than what we have covered. Here is what I did.
1. Removed dependency from the primary project.
2. Removed the old USB project.
3. Created a static library project and used a dynamic folder to point it to the directory with the usb files.
4. Cleaned and recompiled both projects.
Now I am getting assembly errors with the AT91SAM7X256.h file in the USB project. Here is a snippit:
--------------------
Building "USB" in configuration "ARM Flash Debug"
ARM Flash Debug/board_cstartup.o does not exist.
Assembling board_cstartup.S
/home/cutaway/Documents/CrossWorks Projects/SAM7-EX256_USB-ext/../usb/.//ARM Flash Debug/at91lib/boards/sam7-ex256/at91sam7x256/AT91SAM7X256.h: Assembler messages:
/home/cutaway/Documents/CrossWorks Projects/SAM7-EX256_USB-ext/../usb/.//ARM Flash Debug/at91lib/boards/sam7-ex256/at91sam7x256/AT91SAM7X256.h:65: Error: bad instruction `typedef volatile unsigned int AT91_REG'
/home/cutaway/Documents/CrossWorks Projects/SAM7-EX256_USB-ext/../usb/.//ARM Flash Debug/at91lib/boards/sam7-ex256/at91sam7x256/AT91SAM7X256.h:75: Error: bad instruction `typedef struct _AT91S_SYS{'
/home/cutaway/Documents/CrossWorks Projects/SAM7-EX256_USB-ext/../usb/.//ARM Flash Debug/at91lib/boards/sam7-ex256/at91sam7x256/AT91SAM7X256.h:76: Error: bad instruction `at91_reg AIC_SMR[32]'[snip]
---------------------------
I guess it wasn't going through this step before, so I wasn't seeing these errors. I have included the directories in my User Include Directories. I could try updating some of the "Additional C Compiler Only Options" but I really don't think I should have to. And I don't want to muck up the project too much.
Cutaway
-
From the build log it looks like a C/C++ typedef is being used in assembly code - check the correct header file is being included or if any preprocessor definitions are required to disable the C code in the header file.
Also, board_cstartup.S sounds like startup code and you are already using our startup code in the main executable project (AT91SAM7_Startup.s").
-
Jon,
Excellent. It appears that I was not deleting the "ARM Flash Debug" folder when I recreated my USB project.
Unfortunately it appears that I have reached an impasse with the ATMEL USB code. I am now receiving an error with their included version of <stdio.c> as the "variable 'r' has initializer but incomplete type" error. Tracking this down I found this thread http://www.at91.com/forum/viewtopic.php/f,8/t,5352/ which lead me to the following information from ATMEL's support site
----------
Linux vs. Software Package Cross Toolchains Question Linux vs. Software Package Cross Toolchains
Answer The cross toolchain used to compile Linux under Linux4SAM.org web site does NOT allow to compile the GNU Software Package Examples provided on the ATMEL web site.
Go to the Code Sourcery web site, section Download Sourcery G++ Lite Edition for ARM: http://www.codesourcery.com/sgpp/lite/arm/portal/subscription?@template=lite
Target OS must be selected to dowload the correct Cross Toolchain version:
- EABI to compile the GNU Software package examples
- GNU/Linux to compile the Linux4SAM source files.
----------
So, I guess, since I am using Linux, that I will be chopping up their USB code to try and get it to function properly using Crossworks. Maybe a different version will work. *shrug*
Sign. It never just works.
Thanks again, Jon. You were a big help.
Cutaway
Please sign in to leave a comment.
Comments
8 comments