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

cross mob

Creating Applications in ModusToolbox

Creating Applications in ModusToolbox

50 sign-ins 10 solutions authored 5 solutions authored

A few weeks ago I announced that ModusToolbox 1.0 was released and available for download. I think it's time to start posting some pointers on how to use the product effectively. I think a good place to start that is to explain the options you have when creating new projects.

First of all, I recommend you resist the temptation to use the "File->New" dialog to create a C or C++ project. We have created a shortcut for you, with the catchy name "ModusToolbox IDE Application" that is a lot easier to use than starting the project from scratch. You *can* create your own project but you'll have to figure out how to handle the PDL libraries, and code for the CM0+ core in the PSoC 6, and the generated configuration files and, all in all, it is just way easier to use the shortcut! Just click on the shortcut in the Quick Panel or the New Project dialog.

Opening the ModusToolbox New Application Wizard           Opening the ModusToolbox New Application Wizard

Our wizard walks you through the selection of the target and a starter template for the application. You can either pick a board or choose a specific target part number. The "Custom Hardware" option is really intended for users going to market and using their own hardware. Given that ModusToolbox was released two weeks ago I am going to make the wild guess that most of you are just starting out and have one of our kits. The "Dev/Eval Kit" path is for us.


Choose target hardware dialog in ModusToolbox

Here is the list of supported kits - not too many today but we are busy working on new kits and shall be adding support for them in the future.

Choose the dev/eval kit

I have a CY8CKIT-062-WIFI-BT kit, but I think many of you will have the 062-BLE version, because that has been on sale for a while longer. Either way, pick your board and follow along - the process is the same whichever board you have. You then get a list of applications for the kit.

Choose a starter template

These are typically not full-blown reference products but rather examples of useful things to do and good places to just get started. I strongly recommend creating your own projects with a few of them - to get a feel for the tools and try out some cool stuff. The ones that are prefixed with CE are Code Examples from our Applications team so they are thoroughly tested and meticulously documented.

Most of the others are a little less formal and just show off a feature or function as quickly as possible. Let's start with "BlinkyLED", as I have in the above image. Here is the generated application.

BlinkyLED projects

The first thing you'll see is that there are actually 5 projects in an application - I'll try to be consistent in using "application" to refer to whole shooting match and "project" when I mean a specific Eclipse project. The 5 projects are as follows:

  • BlinkyLED_mainapp - this contains the code that runs on the CM4 core (your project)
  • BlinkLED_mainapp_psoc6pdl - this contains the driver code from the PDL which will be built for the CM4 core
  • BlinkyLED_config - this project contains the generated source code from the ModusToolbox configurator tools (more on this next time)
  • BlinkLED_mainapp_cm0p - this contains the code that runs on the CM0+ cor​e
  • BlinkLED_mainapp_cm0p_psoc6pdl - this contains the driver code from the PDL which will be built for the CM0+ core

Our application - and almost certainly all of your's too - is in the BlinkyLED_mainapp project. In the source folder, double-click the main.c file to see the code we are going to run. Connect you board to the USB port of your PC and, in the Quick Panel, press "BlinkyLED Program (KitProg3)" (or change the prefix for whatever you named your application).

BlinkyLED Program (KitProg3)

If all is well you will build the application, program it, and see the blinking LED. You are now ready to start modifying the code to get used to the IDE and also trying out a few more of the examples. In my next post I'll talk about some of these templates in more detail and show you everything they automate in the generated applications.