Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

Bond CY_TOOLS_PATHS to Your Eclipse IDE for ModusToolbox™

Bond CY_TOOLS_PATHS to Your Eclipse IDE for ModusToolbox™

250 sign-ins 10 likes given 10 questions asked

By default, the ModusToolbox™ software uses the most current version of the tools directory installed. That is, if you have ModusToolbox™ versions 2.3 and 2.4 installed and if you launch the Eclipse IDE from the ModusToolbox™ 2.3 installation, the IDE will use the tools from the "tools_2.4" directory to launch configurators and build an application.

The overall way to specify a path other than the default "tools" directory, is to use a system variable named CY_TOOLS_PATHS.

An environment variable is a user-definable value that can affect the way running processes will behave on a computer. Environment variables are part of the environment in which a process runs.

Here is the thing: the system variable is shared by all the processes, which means it's shared by ModusToolbox™ 2.3 and 2.4 together indistinguishably.

So if you set CY_TOOLS_PATHS to the "tools_2.3" directory, though ModusToolbox™ 2.3 is configured properly, ModusToolbox™ 2.4 will now use the "tools_2.3" directory as well. You have to set CY_TOOLS_PATHS to the "tools_2.4" directory to let ModusToolbox™ 2.4 work properly. However, ModusToolbox™ 2.3 is left out again.

This is not what we want. It could be very annoying if you need to switch quite often between ModusToolbox™ versions like 2.3 and 2.4.

This KBA shows you how to work around this issue. The method only works on Windows. Linux and MacOS are not covered.


Install ModusToolbox™ 3.1 and 3.0 both on your Windows 10/11 PC without errors.

Installing them to the default directory is always recommended.

You can install it for the current user or for all users of your computer.

Steps to Follow

Now, search for the shortcuts using the term "Eclipse IDE for ModusToolbox", in the Windows Taskbar. Right-click on one of them and select "Open file location", as follows:


You will be navigated to the shortcut's location. Right-click on the shortcut "Eclipse IDE for ModusToolbox <X.Y>" and select "Properties", as follows:


Then you can see a dialog box as shown below:


At present, the target's original value is like the following. Don't delete or change it.


Now insert the following text before the original value:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command "& { $env:CY_TOOLS_PATHS='C:/Users/yourname/ModusToolbox/tools_3.0' ; start-process '

Then append the following text after the original value:


Now you make the target's value something like this (the BOLD characters are what you added just now and the NONBOLD characters are the original value):

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command "& { $env:CY_TOOLS_PATHS='C:/Users/yourname/ModusToolbox/tools_3.0' ; start-process 'C:\Users\yourname\ModusToolbox\ide_3.0\eclipse\modustoolbox-eclipse.exe'}"

It's not finished yet. Now you need to adjust the ORANGE&BOLD characters to the actual value of CY_TOOLS_PATHS you want to set up for the intended ModusToolbox™ Eclipse IDE of the shortcut (i.e. set tools_3.0 directory for ModusToolbox™ Eclipse IDE 3.0, tools_3.1 for 3.1, etc.).

And don't forget to use slash '/' in CY_TOOLS_PATHS. So you need to change the backslashes '\' to '/' in the CY_TOOLS_PATHS.

Hit "Apply" to save the changes to the shortcut as follows:


Now you can see the shortcut's icon is changed to Powershell's icon as follows:


Don't worry it's okay.

Repeat the steps above until you finally alter all the shortcuts named "Eclipse IDE for ModusToolbox <X.Y>" of all your installed versions.

Magic Starts Now


One good thing is that you don't have to add CY_TOOLS_PATHS to the system environment and change it to the corresponding value every time before you start a certain version of ModusToolbox™. Just search and hit the shortcut "Eclipse IDE for ModusToolbox <X.Y>" and enjoy. Simple as follows:


This is because the environment variable CY_TOOLS_PATHS can now be dynamically added to the process of the started ModusToolbox™ IDE according to its version just in time, by the scripts appended to the shortcut's target. No need to change it manually for a certain version or worry about mismatches.


Another good thing is that you can now open multiple versions of the Eclipse IDE for ModusToolbox™ at the same time and each of them can use its own "tools" directory (and edit different workspaces of course because a workspace can't be opened by several ModusToolbox™ at the same time), as follows:


You can see, ModusToolbox™ 3.0 and 3.1 are opened simultaneously. When you select "New Application" in ModusToolbox™ 3.0, the corresponding Project Creator 2.0 is opened for you. When you select "New Application" in ModusToolbox™ 3.1, the corresponding Project Creator 2.10 is opened for you. 


If you suffered from the meaningless environment variable editing and restarting of ModusToolbox, please try this workaround and leave your comments if any.