How to remove linked resource in Eclipse project

I have a project that is derived from one of the RSL10 CMSIS-Pack Examples. I would like to customize the RTE/Utility/printf.c file, so I have made a copy of it and located it in my local directory structure appropriately (i.e., next to the SEGGER_RTT_Conf.h file in RTE/Utility).

I then went into the Eclipse project Properties dialog, selected Resources->Linked Resources and deleted printf.c in the Linked Resources tab. So far, so good - my version of the file shows up instead of the one referenced in the ONSemi CMSIS Pack directory. However, as soon as I perform a refresh on the project (either manually, or as byproduct of launching Eclipse), the previously deleted Linked Resource of printf.c re-appears and is pointing at the ONSemi CMSIS Pack file. I have also tried converting the linked resource, using a relative path variable (PROJECT_LOC/RTE/Utilities) with the same result.

How do I permanently delete this link so the project utilizes my printf.c? What file/configuration is responsible for reverting to this “hard-coded project config”?

Hi @mbianchi,

Please note that the PDSC file for the specific CMSIS pack will automatically define which files to import and which Include/Library directories and files to link. Therefore, once the project is refreshed it will automatically replace anything have changed or removed.

You have 3 options to address this:

  • (Not Recommended) Change the CMSIS Packs PDSC file to automatically import your version of the print implementation instead of our provided one. This file is written in a specific HTML like format that you will need to learn if you wish to change which files are imported, and will also affect every project within the pack.

  • Within the CMSIS Pack installation directory, rename the default printf file (ie. printf_backup) and place your custom printf file in the same location with the same name. This will ensure that every new project you import from the CMSIS Pack will automatically import and include your version of the file.

  • Disable the printf utility option within the ‘.rteconfig’ project file and import all of the necessary files and components manually. This will prevent the project from automatically importing and including all of the default printf files, allowing you to manually add your own as required.

Thank you for using our Community Forum.

Hi @rastislav.stefun,

Thanks for your suggestions! I finally got back to this issue and implemented option 3 you outlined above (disabling the printf utility in the .rteconfig file and placing the required souce files in my local project directories). The almost works, unfortunately disabling the printf utility also removes the include path in the build settings in Eclipse. Any attempts to manually add this include directory ends up eventually getting removed when the project is refreshed.

I am assuming that something in this PDSC project automation is recognizing all include paths beginning with “${cmsis_pack_root}” and adding/removing such paths based on the settings in the .rteconfig file. The project automatic configuration respects other manually added include paths, but I am suspecting that is because they begin with something like “${workspace_loc}” and not “${cmsis_pack_root}”.

I don’t want to add the printf include path using and absolute path, and I made a feeble attempt at setting a new build variable which pointed to the ‘onsemi-pack/source/firmware’ directory and then used variable to define a build setting include path (e.g., “${MY_UTILITY_DIR}/printf”), but that didn’t seem to work; possibly due to a mistake in variable notation, or perhaps the project automation recognizes the path after variable substitution and will always end up removing the printf include directory.

I’m wondering if I am heading down the right path in attempting to use a different build variable which points at the onsemi packs dir, or will I not ever be able to make this work without also copying the required include files into my local project directories. Any guidance you have here would be greatly appreciated.

Thanks!