In the build settings for the project, check the settings for the linker input. Is the Dead-strip Unused Code option checked?
Also, you may want to disable the generation of debug information, which can add the the file size. You would do that only after you have the code debugged, of course.
---Tom