S12DP512 Library generation

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

S12DP512 Library generation

586 Views
monstor
Contributor II

We want to hid the source code. How can we transfer the source code into library?

Labels (1)
0 Kudos
3 Replies

323 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Henry

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 NE64 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: start12.c, datepage.c, *.prm, MC9S12NE64.h, MC9S12NE64.c, ansibi.lib.c
  7. 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.
  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.

can this help you?


Have a great day,
Zhang Jun

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

0 Kudos

323 Views
monstor
Contributor II

Dear Jennie,

Thanks a lot. Let me try it.

BTW, is it the only way to prohibit people for reading the source code?

Any hardware protection of S12 MCU?

Best regards,

Henry

0 Kudos

323 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Henry,

>>BTW, is it the only way to prohibit people for reading the source code?

from software respect, yes.

>>Any hardware protection of S12 MCU?

MCU can has mechanism to prevent code in flash being read out by others. to do it, we need secure flash when we program it. To secure the flash,  we need set Flash Security Register (FSEC).

If you want to secure it with back door key(thus ctm can not see the code but worker still can see the code with backdoor key), the attached document and its related code will be helpful. The example code is for MC9S12DP256, but the method and theory is the same to other HCS12 family MCUs.

http://cache.freescale.com/files/microcontrollers/doc/app_note/AN2880.pdf

software for AN2880

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


Have a great day,
Zhang Jun

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

0 Kudos