This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C123GH6PM: Understanding how .c libraries are called.

Part Number: TM4C123GH6PM

I'm only just starting to learn ARM on my TM4C123GXL board. My previous experience has been with AVR.

I'm trying to figure out everything about header files, libraries, preprocessor, etc, and figure out the structure of the folders in the Tivaware library.

In the "driverlib" folder I see many .h files have an accompanying .c file (same file name). In the .h file I see the macro definitions and the function prototypes/declarations, while the functions themselves are actually defined in the .c file with the same name.

I notice that most code example do not include the .c files so how does the preprocessor know to look for the defined functions in the accompanying .c file. Does the preprocessor expect a .c file with the same name as the .h file for instance, or does it just look through any/all .c files in the same folder until it finds the defined function.

  • Hi,

    No, there is another trick: all files in driverlib folder are compiled and linked into the file driverlib.lib, to be found in Tiva/driverlib/ Debug/CCS/ driverlib.lib; this .lib file is addea to the link settings and searched at the link phase, and the various functions are extracted for your program.

    The best thing you can do is to import an example provided for your board, preferably the most complex one and look to all settings in Project Properties; there are many, read them all, learn them , even you do not understand their meaning - for other projects you will know where to look for . Search the forum for extra explanations how to import a project, other posters had the same problem.

  • Thanks Petrei,

    that makes sense now. When I first installed CCS I had a lot of problems getting my first project to build - symbol errors.

    I came across a thread that mentioned driverlib.lib and I had to specify it in Project Properties:

    Build - ARM Linker - File Search Path - Include library file or command file as input (--library, -l)

    and enter the file path:    

    C:\ti\TivaWare_C_Series-2.1.4.178\driverlib\ccs\Debug\driverlib.lib

    Then my project would build without errors.