Hi @KKumar
To create .lib file, you need follow the steps below.(please also refer the attached mylib project)
- Create one project with wizard.(I use NE64 as target chip)
- change the file name main.c as the lib name (in sample is mylib.c)
- define the lib functions in mylib.c
- add header file mylib.h in the project, and declare the prototype of the lib functions in it.
- add “#include mylib.h” in mylib.c
- delete the following files from the project: start12.c, datepage.c, *.prm, MC9S12NE64.h, MC9S12NE64.c, ansibi.lib.c
- Press ALT+F7, in “Target Setting”, select “Libmaker for HC12” as Linker in the second droplist. In “Libmaker for HC12”, name your Library Filename.(the sample use mylib.lib), Click OK to close this window.
- Compile again. In “bin” folder of the lib project, you could find the lib file named “mylib.lib”
The following is how to use the lib file in the project:
- copy “mylib.lib” and “mylib.h” to your current project folder.
- import “mylib.lib” and “mylib.h” in your current project
- add “#include "mylib.h"”in the main.c file
then you can use the lib functions in your current project code.
Hope this will help you.
Have a nice day,
Jun Zhang