[Solved] MDK Compile Error: error:No section matches selector – no section to be FIRST/LAST

In the process of using MDK, the compilation found that the error: No section matches selector – no section to be FIRST/LAST is generated, which means that the system driver file, i.e. .s file, is missing from the project.

There are two cases of missing .s files.

1. The .s file has not been added. If the .s file is not added, the .s file can be added to CMSIS (normally, under normal circumstances, the .s file is directly available in MDK_ARM), and after it is added, the compilation is successful.

In the process of adding .s file: find the left column at the main function .c file, and click Add in the file where it is located (file type click .s file for easy finding) .s file.

2. No .s file is generated. This error usually occurs when using MDK for the first time, usually because the file where the mdk’s keil is located is not in the same folder as the project file created. Just move the created project file into the mdk file.

Read More: