Bulding a static library with CodeWarrior for Microcontrollers (Classic IDE)

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Bulding a static library with CodeWarrior for Microcontrollers (Classic IDE)

ソリューションへジャンプ
1,050件の閲覧回数
eisenrah
Contributor I

Hello,

 

I developed a firmware containing many generic functions on a HCS08 microcontroller using CodeWarrior for Microcontrollers (Classic IDE) Version 6.3.

It would be very nice to precompile certain modules and supply them as a static library to customers, so that they can compile own C code against this API without seeing the source code.

Could you tell me how to 1.) build a static library in CodeWarrior and 2.) include it into a CodeWarrior project so that the linker will find it?

 

Thank you very much,

Friedemann

ラベル(1)
0 件の賞賛
返信
1 解決策
714件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi

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.

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.

can it help you?


Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

元の投稿で解決策を見る

3 返答(返信)
715件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi

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.

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.

can it help you?


Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

714件の閲覧回数
inside_system
Contributor II

thank you very much zang jennie, thats waht i excatyl want ,,thanks

0 件の賞賛
返信
714件の閲覧回数
eisenrah
Contributor I

Exactly what I need.

Perfect, thanks a bunch! :smileyhappy:

0 件の賞賛
返信