We know by learning STM32F1 that if you want to optimize your code, you must know the rom and ram usage of the project. Therefore, we need to use the .map file. By analyzing the .map file, you can easily view the occupation of the project rom and ram, including a single source file or even a rom for each function.