Don't compile uncalled functions

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

Don't compile uncalled functions

1,722 Views
colinluan
Contributor III

I am developing my project with RT1064 + MCUXpresso. I found some unused functions are compiled, I would not like to compile them. How do I need to set in the MCUXPresso, anyone can help me? thanks.

0 Kudos
Reply
5 Replies

1,669 Views
abnxpweb
Contributor III

Unused functions should get automatically removed by the link step using its "unused section elimination" optimisation (unless you have changed the project default settings). More information in this old LPCXpresso FAQ, which still applies to MCUXpresso IDE.

https://community.nxp.com/t5/LPCXpresso-IDE-FAQs/Unused-Section-Elimination/m-p/475002

Hope this helps!

1,677 Views
Masmiseim
Senior Contributor I

Hello colinluan,

gcc (which is used inside of MCUXPresso) can do this for you. Compare this guide

https://stackoverflow.com/questions/6687630/how-to-remove-unused-c-c-symbols-with-gcc-and-ld

 

Best Regards

0 Kudos
Reply

1,717 Views
danielchen
NXP TechSupport
NXP TechSupport

HI @colinluan 

 

You can exclude resource from build

Please refer to below link for more details

 

https://mcuoneclipse.com/2014/07/22/exclude-source-files-from-build-in-eclipse/

 

Regards

Daniel

 

0 Kudos
Reply

1,707 Views
colinluan
Contributor III

hi,@danielchen

I only want to exclude unused functions instead of excluding whole file. Is there any way to implement it?

0 Kudos
Reply

1,697 Views
danielchen
NXP TechSupport
NXP TechSupport

for unused function, I would suggest you use 

#if 0

#endif.

 

 

Regards

Daniel

0 Kudos
Reply