How do I import a code example into ModusToolbox™ IDE?
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:
- 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.
- Clone the repository using git clone or the GitHub desktop client.
After you have the repository on your hard drive, follow these steps.
There is a third way to get all the examples into the IDE as source files (not as Eclipse projects).
- Copy the URL on GitHub.
- In the IDE select File > Import > Git > Projects from Git.
- 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.