I noticed that if I select a few RTD modules, then all the functions, include the ones that I don't use or need in the project, are compiling into firmware, how can I fix this(for saving the space)?
All RTD modules provide options to enable/disable a few features (These options can be found in ASR Specification or UM). These options allow the code for unused features to not be compiled. You can do this on the configuration tool.
For example on MCU module: