How to disable optimization for protecting an unused function

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

How to disable optimization for protecting an unused function

883 次查看
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!

标签 (1)
0 项奖励
3 回复数

696 次查看
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!
-----------------------------------------------------------------------------------------------------------------------

696 次查看
jasoncui
Contributor II

Hi, Jennie

I works well. Thanks a lot.

0 项奖励

696 次查看
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 项奖励