@FZheng There are 2 possibilities to use the Additional Pack
you choose the Board Component and you are free to develop the application on top of the APIs. In this case the app_x-cube-mems1.[ch] files are not generated
you choose an Application. In this case an applicative code is generated in the app_x-cube-mems1.[ch] files and it is referenced in the main.c. However, in this way you have less freedom to regenerate the code in STM32CubeMX a second time. Either you put your code between /* USER BEGIN */ ... /* USER END */ sections, or it will be overridden when you press GENERATE CODE button a second time
Please ensure that all dependencies are satisfied before you generate the code. This means that a green checbox appears in all items in picture 1 and picture 2 of your attachments.