This chapter covers how to make various changes to your application. It includes:

Modify code

Most code examples work as they are, and there is no need to add or modify code in order to build or program them. However, if you want to update and change an application to do something else, or if you are developing your own application, open the appropriate file in the code editor.

  • PSoC™ MCU

    : In the Project Explorer, double-click the

    main.c

    file.


    ../figures/image23.png

    Note:

    The "includes" in this example show "unresolved inclusions" because the files are located in the mtb_shared folder. This and other issues with IntelliSense are resolved after a build.

  • AIROC™ Bluetooth®

    : In the Project Explorer, expand the

    <app-name>

    project folder and double-click the application

    <app-name>.c

    file.


    ../figures/image24.png

As you type into the file, an asterisk (*) will appear in the file’s tab to indicate changes were made. The

Save/Save As

commands will also become available to select.

Use configurators

ModusToolbox™ software provides graphical applications called configurators that make it easier to configure a hardware block. However, before you make changes to settings in configurators, you should first copy the configuration information to the application and override the BSP configuration or create a custom BSP. If you make changes to a standard BSP library, it will cause the repo to become dirty. Additionally, if the BSP is in the shared asset repository, changes will impact all applications that use the shared BSP. For more information, refer to the

ModusToolbox™ tools package user guide

.

Each configurator provides a separate guide, available from the configurator's

Help

menu.

Launching configurators from the IDE

To launch a configurator from the Eclipse IDE, right-click on the <app-name> project in the Project Explorer, select

ModusToolbox™

, and then select the appropriate configurator.



Note:

You can also launch available configurators from links in the Quick Panel.

Depending on the enabled resources in your application, there may be several configurators available to launch.

  • If you launch the Device Configurator from the IDE, you are opening the project’s design.modus file, which is responsible for holding all of the BSP configuration information. It contains the following:

    • Selected device

    • Resource parameters

    • Constraints

  • If you launch any of the other configurators from the IDE, they will open using that configurator’s configuration file (

    design.cycapsense

    ,

    design.cyseglcd

    , etc.). These files are specific to the given resource, and they may rely on configuration data from the design.modus file.

Launching configurators without the IDE

To launch any Configurator without using the IDE, refer to the applicable configurator guide for details about configuration information. You may need to open a configuration file or create a new one.

Use tools

In addition to the configurators, there are several tools, including Library Manager, BTSpy, ClientControl, and Device Firmware Update (DFU) Host Tool. Many tools do not apply to all types of projects. So, the available tools depend on the project/application you have selected in the Project Explorer.

Launching tools from the IDE

To launch a tool from the Eclipse IDE, right-click on the <app-name> project in the Project Explorer, select

ModusToolbox™

, and then select the appropriate tool.


../figures/image26.png

Note:

You can also launch available tools from links in the Quick Panel.

Library Manager

The Library Manager allows you to select which Board Support Package (BSP) and version should be used by default when building a ModusToolbox™ application. It also allows you to add and remove libraries, as well as change their versions.

For more information about how to use this tool, refer to the

Library Manager user guide

.

BTSpy and ClientControl

BTSpy is a trace utility that can be used in the AIROC™ Bluetooth® applications to view protocol and generic trace messages from the embedded device. The tool listens on the UDP port 9876 and can receive specially formatted message from another application on the same or different system.

BTSpy can be used in conjunction with ClientControl to receive, decode and display protocol application and stack trace messages. ClientControl communicates with the embedded app to perform various functionalities, tests, exercising features, etc.

DFU Host tool

The Device Firmware Update (DFU) Host tool is a stand-alone program used to communicate with a PSoC™ MCU that has already been programmed with an application that includes device firmware update capability. For more information, refer to the

Device Firmware Update Host tool user guide

.

Use integrated terminal

The Eclipse IDE for ModusToolbox™ software includes an integrated terminal where you can enter various commands for the selected project. To view the terminal, click the

Terminal

tab in the bottom pane. Then, select a project in the Project Explorer to open a shell in the project directory.


../figures/image27.png

Note:

You can configure the terminal colors for the Workspace under

Window > Preferences >Terminal

.

Switch projects

When you switch projects, the Eclipse IDE creates additional tabs and automatically switches between them, so that a shell in the current project directory is always in focus. To disable this automatic switching, deselect the

Track Current Project

button in the terminal toolbar.


../figures/image28.png

Specify alternate shell

By default, the terminal uses your login shell on Linux and macOS, or the "modus-shell" Cygwin bash shell provided with your ModusToolbox™ tools installation on Windows. You can specify a different shell from

Window > Preferences > ModusToolbox™ Tools

.


../figures/image29.png

Update local terminal settings

By default, the local terminal uses your User home directory as the Initial Working Directory. You can specify different options from

Window > Preferences > Local Terminal

.


../figures/image30.png

Note:

Linux and macOS include additional settings for Shell Command and Arguments.

Connect to remote machine/board

You can also connect to a remote machine or board via serial, telnet, or SSH by clicking the

Open a Terminal

button in the terminal toolbar.


../figures/image31.png

Use the

Choose terminal

pull-down menu to select the appropriate terminal.

Refresh Quick Panel

When you use tools external to the Eclipse IDE, such as the Library Manager or Device Configurator, it is likely that the Eclipse IDE will not refresh to detect changes made in those other tools. Use this link to refresh the Eclipse IDE. You may notice new documentation links or a new Active BSP in the Quick Panel as an indication that your application has new libraries and/or components.


../figures/image32.png

Rename application

Single-core application

The Eclipse IDE for ModusToolbox™ software uses the standard Eclipse rename functionality. That is, right-click on the application and select

Rename

. If you use the rename feature, you will need to update your application’s launch configurations. The easiest way to do this is to use the "Generate Launches…" link in the Quick Panel.

After renaming the application, select it in the Project Explorer and notice that there is only one item under Launches. Click on the

Generate Launches for…

link. After a few moments, the generate process completes. Click on the application again in the Project Explorer and notice that all the items are shown under Launches in the Quick Panel.


../figures/image33.png

Multi-core application

For a multi-core application, you also use the standard Eclipse rename functionality; however, there are a few additional steps required. After renaming the main application project, you'll notice that the core subprojects become regular folders.


../figures/image34.png

Select each folder, right-click, and select

Import as Project

.


../figures/image35.png

Note:

During the rename process, you may see index errors. These usually go away once the rename process is complete.

After making each folder a subproject, notice that each retains the prefix of the original application name.


../figures/image36.png

You can rename each subproject individually, but ensure they each have a unique name. You can do so by keeping the suffix.


../figures/image37.png

When complete with the rename process, you may have to build the application or click the Generate Launches for … link as described under

Single-core application

.

Restore shared directory

Beginning with the ModusToolbox™ 2.2 release, shared BSPs, libraries, and versions are located in a shared directory (named mtb_shared, by default) adjacent to your application directories. You can delete the mtb_shared directory at any time because it can be recreated. You might do this when sharing the application, for example. The shared directory only contains files that are already controlled and versioned, so you should NOT check it into a revision control system.

When using the Eclipse IDE, if you delete the shared library directory from disk and then regenerate it, the directory will not be restored properly. This is because several files required by the Eclipse IDE are not restored as they were when the application was created. To resolve this:

  1. Regenerate the mtb_shared directory and assorted libraries on disk using make getlibs or the Library Manager.

  2. In the Eclipse IDE, delete the "mtb_shared" folder shown in the Project Explorer.

    Note:

    Do

    NOT

    select the check box "Delete project contents on disk" (if you do, you will have to regenerate it again).

  3. Then, select

    File > Import > C/C++ > Existing Code as Makefile Project

    and click

    Next >

    .


    ../figures/image38.png

  4. On the Import Existing Code page:


    ../figures/image39.png

    • Under

      Existing Code Location

      , click

      Browse…

      , navigate to the application's root directory, select the "mtb_shared" folder, and click

      Select Folder

      .

    • Under

      Toolchain for Indexer Settings

      , select

      ARM Cross GCC

      .

    • Click

      Finish

      .

  5. After the import completes, build the application.