make a library in CodeWarrior

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

make a library in CodeWarrior

跳至解决方案
5,862 次查看
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.


标签 (1)
标记 (2)
0 项奖励
回复
1 解答
4,190 次查看
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 项奖励
回复
5 回复数
4,191 次查看
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 项奖励
回复
4,190 次查看
youngcheolsong
Contributor II

Hello ZhangJennie,

Thank you for your explain.

I'm clear this problem.

Thanks again.

0 项奖励
回复
4,190 次查看
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 项奖励
回复
4,190 次查看
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 项奖励
回复
4,190 次查看
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 项奖励
回复