make a library in CodeWarrior

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

make a library in CodeWarrior

Jump to solution
3,858 Views
youngcheolsong
Contributor II

Hello,

I use Codewarrior 6.3 and would like to make a common library and use it sevral projects.

How can i make library files with CodeWarrior 6.3.


Labels (1)
Tags (2)
0 Kudos
1 Solution
2,186 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hello Youngcheol.

you can use Codewarrior create your own lib file. To create .lib file, you need follow the steps below.(please also refer the attached mylib project)

  1. Create one project with wizard.(I use QG8 as target chip)
  2. change the file name main.c as the lib name (in sample is mylib.c)
  3. define the lib functions in mylib.c
  4. add header file mylib.h in the project, and declare the prototype of the lib functions in it.
  5. add “#include mylib.h” in  mylib.c
  6. delete the following files from the project: start08.c, derivative.h, *.prm, MC9S08QG8.h, MC9S08QG8.c, ansiis.lib.c
  7. Press ALT+F7, in “Target Setting”, select “Libmaker for HC08” as Linker in the second droplist. In “Libmaker for HC08”, name your Library Filename.(the sample use mylib.lib), Click OK to close this window.
  8. 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:

  1. copy “mylib.lib” and “mylib.h” to your current project folder.
  2. import “mylib.lib” and “mylib.h” in your current project
  3. add “#include "mylib.h"”in the main.c file
  4. then you can use the lib functions in your current project code.

see attached demo code

I hope this information is helpful to you.

Best Regards,

Zhang Jun

==================================

if this answer helps, please click on "Correct Answer" button. thanks!

=====================================

View solution in original post

0 Kudos
5 Replies
2,187 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hello Youngcheol.

you can use Codewarrior create your own lib file. To create .lib file, you need follow the steps below.(please also refer the attached mylib project)

  1. Create one project with wizard.(I use QG8 as target chip)
  2. change the file name main.c as the lib name (in sample is mylib.c)
  3. define the lib functions in mylib.c
  4. add header file mylib.h in the project, and declare the prototype of the lib functions in it.
  5. add “#include mylib.h” in  mylib.c
  6. delete the following files from the project: start08.c, derivative.h, *.prm, MC9S08QG8.h, MC9S08QG8.c, ansiis.lib.c
  7. Press ALT+F7, in “Target Setting”, select “Libmaker for HC08” as Linker in the second droplist. In “Libmaker for HC08”, name your Library Filename.(the sample use mylib.lib), Click OK to close this window.
  8. 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:

  1. copy “mylib.lib” and “mylib.h” to your current project folder.
  2. import “mylib.lib” and “mylib.h” in your current project
  3. add “#include "mylib.h"”in the main.c file
  4. then you can use the lib functions in your current project code.

see attached demo code

I hope this information is helpful to you.

Best Regards,

Zhang Jun

==================================

if this answer helps, please click on "Correct Answer" button. thanks!

=====================================

0 Kudos
2,186 Views
youngcheolsong
Contributor II

Hello ZhangJennie,

Thank you for your explain.

I'm clear this problem.

Thanks again.

0 Kudos
2,186 Views
youngcheolsong
Contributor II

Hello,

I made lib file for my project.

There are included some common library functions, like as memcpy, memset, memcmp, ... ...

How can i make a lib file that don't include a common library functions.

I will be appreciated your help.

Thanks.

0 Kudos
2,186 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hello Youngcheol.


please make sure there is no ansi related lib included in your self-made lib file.

Best Regards,

Zhang Jun

==================================

if this answer helps, please click on "Correct Answer" button. thanks!

=====================================

0 Kudos
2,186 Views
youngcheolsong
Contributor II

  Hello Jennie,

Thank you for your answer.

But i can't find the "no ansi related lib".

How can i set the  "no ansi related lib".

/BR

Youngcheol

0 Kudos