Importing Code Example into ModusToolbox IDE - KBA225201

Version: *C

 

Question:

How do I import a code example into ModusToolbox™ IDE?

 

Answer:

This knowledge base article applies to code examples found at the Cypress GitHub repository for ModusToolbox IDE.

 

A ModusToolbox IDE code example is based on the application description in a file named modus.mk, along with associated source code. Using the IDE’s New Application feature, you import the modus.mk file and create the application.

 

First, clone or download a code example repository from GitHub. There are two ways you can do this:

  1. Download a zip file and unzip that file to a location on your hard drive. This approach is especially useful if you are not familiar with the Git version control system.

  2. Clone the repository using git clone or the GitHub desktop client.

After you have the repository on your hard drive, follow these steps.

In ModusToolbox IDE, in the Quick Panel, click New Application.

 

You can also use a menu command,
File > New > ModusToolbox IDE Application.

Select your kit and click Next. The code example you want to create must support the kit you select in this step.

Click Import. Navigate to the code example location on your computer and select the modus.mk file for the example you want to create. The example name and description appear. Click Next and then Finish to complete the application creation process.

The application appears in the Project Explorer

 

There is a third way to get all the examples into the IDE as source files (not as Eclipse projects).

  1. Copy the URL on GitHub.
  2. In the IDE select File > Import > Git > Projects from Git.
  3. Follow the steps in the import wizard.

The URL appears automatically in the wizard. You do not need to provide account credentials; the code example repository is public. Specify a destination directory on your hard drive. Use the Import as a general project option because there are no Eclipse projects in the repository.

The contents of the repository are cloned to your hard drive. As noted above, these are not Eclipse projects, so you can’t build them. But the modus.mk file for each example is there. The files also appear in the project explorer in the IDE. You can study them, copy and paste source code, and so on, without ever having to create or build the example as an application.