Showing results for 
Search instead for 
Did you mean: 

Delete modules and variables that are not used in IAR COMPILER

Associate II

I wanted to use a standard library (CMSIS-DSP) WITH stm32f103c8t6 and I only used a few functions & variables of that library, but it's like the whole library has been added to my project.

And it takes a lot of memory, but now I have an error of lack of memory This space is related to the common table in CMSIS-DSP that used for calculating fft

And this is also the case, the IAR compiler said that I will delete the module and the variables that are not used, but this has not happened to me.

And as far as I understand, it is possible to define a series of rules or flags for the compiler to consider only the required parts for this library model, which are generally large, but we only need a small part of them.

Has anyone had such an experience that without changing the source of the library, just by making settings in the compiler, only the required parts have been used? And how to define the flags and where should they be defined? On top of the source as defined? In Linker? or...


Typically it's the LINKER's job, to determine the interrelationships, what needs to bind to what to get closure and do dead code removal.

The LIB (library) files are supposed to be a collection of OBJ (object) files, which the linker can cherry pick at that level of granularity.

The COMPILER might be able to output each-function-as-an-object, check for options

All the source to the CMSIS-DSP should be available, the IDE presumably could just compile the pieces you need if they are dropped in the project.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..