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

cross mob

Using the Project-Creator Command Line Interface (CLI)

Using the Project-Creator Command Line Interface (CLI)

DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

Having a GUI makes developing applications more intuitive. The visual feedback and ease of use are really helpful. But, sometimes, I like to use the command line to learn what is happening in the background.

 

So, this blog will be focusing on what happens when you create projects using the Command Line Interface. I’ll show you things you would never usually think about, to give you a different perspective so that you can learn something new.

 

We are going to look into the project-creator-cli tool. But before that, there are some things you need to know about ModusToolbox. It uses Cygwin under the hood and all tools are verified to be compatible with *NIX terminal environments. Based on the OS you are using, you need to keep this in mind:

  • All Linux terminal applications are compatible.
  • All macOS terminal applications (including the Apple-provided Terminal App) are compatible.
  • On Windows, you need to run the “Cygwin.bat” script available inside the “tools_2.0\modus-shell” directory. The Windows “Command Prompt” and “Power Shell” aren’t tested/supported/known to be compatible.

 

Okay, now we are all set. The project-creator-cli tool comes packaged with ModusToolbox and as the name suggests it creates a project.

pastedImage_0.png

 

This is the first step you will take while creating any ModusToolbox application. Every command-line tool comes with a “--help” (dash dash help) option to provide information on what it can do. I like playing with my toys first and then looking at the user manual. You can refer to the docs folder for usage documentation but I do that only when I get stuck.

 

So, type in “project-creator-cli.exe --help” to get the list of options. 

pastedImage_1.png

Before I can pass in all the arguments, I need information on what kind of values I can provide. As the help info suggests, I can list the boards and applications using the “--list-boards” and “--list-apps <board>” and I’m going to do just that.

pastedImage_2.png

pastedImage_4.png

Okay great. Now that I have all the information I need, I can pass in the arguments. I’m going to ignore the optional arguments.

>> ./project-creator-cli.exe --board-id CY8CPROTO-062-4343W --app-id mtb-example-psoc6-empty-app

cmd.png

 

The project will be created in the user profile directory by default as shown in the figure above. The project folder will have the same name as the application name.

pastedImage_7.png

 

Here is an assignment for you to try over the weekend - Try out the “-d” and “-n” options to create the application in your target directory and to specify the application names respectively.

 

When you create a new application using the Eclipse IDE, this is exactly what happens in the background. Based on the target and application template selected, it passes them as arguments to the backend process that creates the project. That’s the beauty of the command line. It is hard work, but you understand how things flow. I hope this gave you a new perspective and you learned something new today. Stay tuned for more such content!

 

PS: This was my first blog. You will see more from me in the coming few weeks. I am planning to write about building and programming an application all from the command line next. Let me know if you would like to add something else as well.

2476 Views
3 Comments
Authors