Keil Logo

µVISION: Modules With Same Name In the Project


Information in this knowledgebase article applies to:

  • Keil MDK 5.12 and later

QUESTION

Can multiple modules with the same name added to a µVision project? And if yes, how does µVision deal with this duplicate module names?

ANSWER

Yes, in Keil MDK 5.12 a mechanism was introduced to deal with modules having the same name in a project.

While modules with the same name can be compiled individually without issue, the linker will finally complain about them. To avoid this problem, µVision does index all files with "filename_N.ext" (N = 0,1,2,...), which get generated from the source modules with same name. Looking specifically at the object files, the first module keeps the original name "*.o", the second becomes "*_1.o", the third becomes "*_2.o", and so on.

For certain situations, like when excluding one of the files with same name form the build, the wrong current object file could be used for linking. To avoid that problem, also the from build excluded files are counted when doing the indexing since Keil MDK 5.27.

Keil MDK 5.28 expanded this mechanism also over different target output folders from projects with more than one target.

Due to this mechanism you need to pay attention when using the same scatter file for different project targets, when modules with the same name are in the project. A module select pattern for such a module will then only fit in one of the targets. The scatter file needs to be adapted for the other target(s).

STATUS

Since Keil MDK 5.30, µVision generates a related warning when renaming object files because of the reasons explained in this article:

Note: source file '...\test.c' - object file renamed from '...\test.o' to '...\test_1.o'.

There is a situation, that can cause the rename still to happen, even if the cause was removed already. To resolve this, do a "Project -> Clean Targets" and then close and reopen the project.

MORE INFORMATION

Last Reviewed: Friday, November 13, 2020


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.