Thread: Last few errors in making an USB protocol

  1. #1
    Registered User
    Join Date
    May 2012
    Location
    Netherlands
    Posts
    24

    Last few errors in making an USB protocol

    I'm having trouble with the last few errors for my USB protocol.
    In my main file I'm calling a few functions to initialize the USB and start checking if an USB is connected but for some reason he doesn't recognize the functions.
    While in other files the same function is needed but there no error is coming.

    I've attached the software. Its made with WinAVR2010

    Can someone help me out why I'm getting these errors?

    Regards,
    Elixz

    New Folder (3).zip

  2. #2
    Registered User ledow's Avatar
    Join Date
    Dec 2011
    Posts
    435
    Seriously, a whole project code dump with no indication of where the problems are that you see? What functions are you calling? Where? What header file are they in? Have you included that header into your main file? Just throwing a ZIP of your project at us isn't helping, it's hindering.

    You honestly expect someone to download, unzip, compile, test and debug 700k of C source code (not even for a standard device we're likely to have lying around), for you, just to locate a missing header include? Hell, I had to virus scan the ZIP just to download it to see its contents, let alone just let it and its complete Makefile and 700k of source code (that I'm NOT going to audit) just run rampant over my user account when I compile it.

    Publish the exact error you are getting and honestly, if they are simple errors that TELL you what's wrong, I will shout at you.

    - Compiler warnings are like "Bridge Out Ahead" warnings. DON'T just ignore them.
    - A compiler error is something SO stupid that the compiler genuinely can't carry on with its job. A compiler warning is the compiler saying "Well, that's bloody stupid but if you WANT to ignore me..." and carrying on.
    - The best debugging tool in the world is a bunch of printf()'s for everything important around the bits you think might be wrong.

  3. #3
    Registered User
    Join Date
    May 2012
    Location
    Netherlands
    Posts
    24
    Lol looks like someone fell down the wrong side of the bed. Just tried to help by posting the complete project.
    The errors are:
    main.o: In function `main':
    c:\documents and settings\*****\desktop\new folder (3)/main.c:16: undefined reference to `ccp_write_io'
    c:\documents and settings\*****\desktop\new folder (3)/main.c:19: undefined reference to `sysclk_init_opt'
    c:\documents and settings\*****\desktop\new folder (3)/main.c:23: undefined reference to `udc_start'
    main.o: In function `udc_attach':
    c:\documents and settings\*****\desktop\new folder (3)/udc.h:25: undefined reference to `udd_attach'
    make.exe: *** [main.elf] Error 1

    Include files are everywhere. I'm still trying to figure C out.

    Code:
    #include "compiler.h"
    #include "preprocessor.h"
    #include "sysclk.h"
    #include "conf_usb.h"
    #include "udd.h"
    #include "udc.h"
    #include "udi_dfu_atmel.h"
    #include "twim.c"
    
    
    
    
    
    
    
    
    int main(void) 
    {
        // Map interrupt vectors table in bootloader section
        ccp_write_io((uint8_t*)&PMIC.CTRL, PMIC_IVSEL_bm | PMIC_LOLVLEN_bm
                | PMIC_MEDLVLEN_bm | PMIC_HILVLEN_bm);
    
    
        sysclk_init();
        cpu_irq_enable();
    
    
        // Start USB stack to authorize VBus monitoring
        udc_start();
    
    
        udc_attach();
        while (true) {
        }
    }
    Last edited by Elixz; 06-14-2012 at 06:20 AM.
    Chuck Norris has a grizzly bear carpet in his room. The bear isn't dead it is just afraid to move.

  4. #4
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    Whatever external library contains those files (if in fact it's external), needs to be linked into the executable. If these functions are defined in your code, then they must be compiled along with the rest of your code. How you go these things will depend on your compiler/development environment.

  5. #5
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    Quote Originally Posted by Elixz View Post
    I'm still trying to figure C out.
    if you're a beginner in C, then this project is almost certainly too advanced for you.

  6. #6
    Registered User
    Join Date
    May 2012
    Location
    Netherlands
    Posts
    24
    I'm a quick study, I managed to understand basic full within 2 days
    Chuck Norris has a grizzly bear carpet in his room. The bear isn't dead it is just afraid to move.

  7. #7
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Quote Originally Posted by Elixz View Post
    I'm a quick study, I managed to understand basic full within 2 days
    Teach Yourself Programming in Ten Years

  8. #8
    Registered User
    Join Date
    May 2012
    Location
    Netherlands
    Posts
    24
    And now someone who can actually help me out instead of posting lame ass comments
    Chuck Norris has a grizzly bear carpet in his room. The bear isn't dead it is just afraid to move.

  9. #9
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Quote Originally Posted by Elixz View Post
    And now someone who can actually help me out instead of posting lame ass comments
    Read this post once more. It answers the problem you are having.

    Tim S.

    Quote Originally Posted by rags_to_riches View Post
    Whatever external library contains those files (if in fact it's external), needs to be linked into the executable. If these functions are defined in your code, then they must be compiled along with the rest of your code. How you go these things will depend on your compiler/development environment.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  10. #10
    Registered User
    Join Date
    May 2012
    Location
    Netherlands
    Posts
    24
    Missed that post, tnx for the reminder. Will check it the first thing in the morning
    Chuck Norris has a grizzly bear carpet in his room. The bear isn't dead it is just afraid to move.

  11. #11
    Registered User
    Join Date
    May 2012
    Location
    Netherlands
    Posts
    24
    I've added the ccp.h include file but still after including I receive the same errors.
    The other 3 errors from sysclk and udc were already included so I don't understand why its going wrong.

    I've tried to compile in WinAVR and AVRstudio 5 and 6, even with different compiler settings but every time I get those errors again.
    Chuck Norris has a grizzly bear carpet in his room. The bear isn't dead it is just afraid to move.

  12. #12
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    YOU NEED to link to the file/library that supplies the missing functions!!

    Including a header does NOT link to any file when using GCC style compilers!!

    Look up how to compile and link multiple files; And/Or, how to link to libraries.

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  13. #13
    Registered User
    Join Date
    May 2012
    Location
    Netherlands
    Posts
    24
    tnx all, fixed it.

    @ stahta01 tnx for pointing out that I had to include the .c files in the makefile this helped a lot.

    Threw the whole project in the trashcan and opened a working example project in AVR Studio 6 for xmega.
    Only thing was that is was for a different xmega then I use but fixed that already.
    Finally I can make the actual software instead of debugging a faulty one.
    Chuck Norris has a grizzly bear carpet in his room. The bear isn't dead it is just afraid to move.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Making a (atom) class in a (struct) class makes big errors!
    By Yarin in forum Windows Programming
    Replies: 4
    Last Post: 09-11-2007, 07:18 PM
  2. FTP protocol
    By IfYouSaySo in forum Tech Board
    Replies: 5
    Last Post: 08-07-2006, 08:54 PM
  3. irc protocol
    By chrismiceli in forum C Programming
    Replies: 4
    Last Post: 09-16-2003, 12:56 AM
  4. Making my own networking protocol
    By EvBladeRunnervE in forum Networking/Device Communication
    Replies: 8
    Last Post: 08-21-2003, 08:30 PM
  5. help on protocol
    By Prasad kulkarni in forum C Programming
    Replies: 3
    Last Post: 10-20-2002, 08:54 AM