How to disable optimization for protecting an unused function

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

How to disable optimization for protecting an unused function

835 Views
jasoncui
Contributor II

I created a function, and didn't call it in my project, the compiler treated it as unused dead code and removed it by the linker. I hope the optimization doesn't work only for this function, how can I do? The CodeWarrior I used is ver5.9, and the MCU is MC9S12G128.

 

Any help would be much appreciate!

Labels (1)
0 Kudos
3 Replies

648 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Jason.

add the function name to ENTRIES block in prm file can avoid unused function being optimized. can you please try it? can it work for you?

pastedImage_0.png


Have a great day,
Jennie Zhang

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

648 Views
jasoncui
Contributor II

Hi, Jennie

I works well. Thanks a lot.

0 Kudos

648 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

you are welcome!

Jennie Zhang

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

0 Kudos