This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to create library

i have written a simple UART code, my project is entirely depends upon the serial comunnication.

i have to control 4 to 5 stepper motor and sensor, for which lot of subroutines r to be written,
i wanted to make small library which are classified into motor,uart,sensor codes .

now i have written a simple test code for my project, it is working fine when i write all the code in one C file.

when i am tring to modularized the code compiler shows 0 errors but 10 warnings.

*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL
    SYMBOL:  SYSTEM_INIT
    MODULE:  D:\SWAPNIL_PROJECT\S.O.A.M_30112010\CODE\VERSION2\SOAM_12112010\K
>> EIL2\TEST1.OBJ (TEST1)

*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL
    SYMBOL:  PORT_IO_INIT
    MODULE:  D:\SWAPNIL_PROJECT\S.O.A.M_30112010\CODE\VERSION2\SOAM_12112010\K
>> EIL2\TEST1.OBJ (TEST1)

*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL
    SYMBOL:  _UART1_TX
    MODULE:  D:\SWAPNIL_PROJECT\S.O.A.M_30112010\CODE\VERSION2\SOAM_12112010\K
>> EIL2\TEST1.OBJ (TEST1)

*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL
    SYMBOL:  UART1_INIT
    MODULE:  D:\SWAPNIL_PROJECT\S.O.A.M_30112010\CODE\VERSION2\SOAM_12112010\K
>> EIL2\TEST1.OBJ (TEST1)

*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL
    SYMBOL:  _DELAY
    MODULE:  D:\SWAPNIL_PROJECT\S.O.A.M_30112010\CODE\VERSION2\SOAM_12112010\K
>> EIL2\TEST1.OBJ (TEST1)

*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL
    SYMBOL:  SYSTEM_INIT
    MODULE:  D:\SWAPNIL_PROJECT\S.O.A.M_30112010\CODE\VERSION2\SOAM_12112010\K
>> EIL2\TEST1.OBJ (TEST1)
    ADDRESS: 0090H

*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL
    SYMBOL:  UART1_INIT
    MODULE:  D:\SWAPNIL_PROJECT\S.O.A.M_30112010\CODE\VERSION2\SOAM_12112010\K
>> EIL2\TEST1.OBJ (TEST1)
    ADDRESS: 0093H

*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL
    SYMBOL:  PORT_IO_INIT
    MODULE:  D:\SWAPNIL_PROJECT\S.O.A.M_30112010\CODE\VERSION2\SOAM_12112010\K
>> EIL2\TEST1.OBJ (TEST1)
    ADDRESS: 0096H
BL51 BANKED LINKER/LOCATER V6.11            11/15/2010  17:19:25  PAGE 3



*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL
    SYMBOL:  _DELAY
    MODULE:  D:\SWAPNIL_PROJECT\S.O.A.M_30112010\CODE\VERSION2\SOAM_12112010\K
>> EIL2\TEST1.OBJ (TEST1)
    ADDRESS: 00A0H

*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL
    SYMBOL:  _UART1_TX
    MODULE:  D:\SWAPNIL_PROJECT\S.O.A.M_30112010\CODE\VERSION2\SOAM_12112010\K
>> EIL2\TEST1.OBJ (TEST1)
    ADDRESS: 00ADH

Program Size: data=17.0 xdata=0 code=198
LINK/LOCATE RUN COMPLETE.  10 WARNING(S),  0 ERROR(S)

please help me understand where i am going wrong

Parents
No data
Reply
  • When multiple projects shares the same source code, I normally keep that code in a subdirectory.

    So when checking out the project source code from a source code repository, I both check out the project-specific code, and the common code.

    The advantage with building the full project from source code instead of having part of it linked with a library, is that the debugger will have access to all source - I can single-step into the shared code without problems.

    Next thing is that if I do feel the common code lacks a feature, I can update that code with additional functions and directly test within the project. Obviously, shared code must be handled carefully, i.e. I can't redefine the meaning of a variable or function since that would break all other projects that are using the same shared code.

    If a project do make changes to common code, then I check in these changes and make a new source code "tag" for the shared code. So when building other projects, I can decide to either check out the old version of the shared code, or upgrade the other projects to use a newer version of the shared code.

    Binary libraries are best when:
    - the library is huge, making the build time extremely long. But this is seldom a problem with modern computers. Few developers have projects that takes 10 minutes or more for a full build.
    - the library is shipped to other people, and you do not want them to have access to the source code (might contain proprietary, maybe patented/trade secret algorithsms, or maybe you don't want to give support when they change things and breaks the library).

    A big problem with a binary library is that they often fail if you switch compiler vendor or sometimes even compiler version. And you often need several libraries, depending on what compiler options you have used - i.e. a debug build, a release build, a unicode build, a "strict" build, ...

    So in the end, there is normally very little reasons for building own libraries unless it's a school assignment. If you do work for a company that does sell libraries, then that company must have (or at least have had) other people who have done this before.

Children
No data