QM  6.1.2
Model-Based Design Tool
No Matches
Manage Tools Dialog Box

New Model Dialog Box Code Generation License Dialog Box

The Manage Tools dialog box allows you to configure up to 5 different external tools that can then be launched directly from QM™ with the keyboard shortcuts F8 through F12. Examples of external tools include make to perform a software build, lint to statically check your code, your own unit tests that run on the host computer, or a command-line tool to download the code to the embedded target, directly from QM with just one key press. The output generated by the external tool will appear in the QM's Log Console.

The external tools that can be launched directly from QM™ are not limited to command-line programs only. An external tool can be a GUI application and can be launched as "detached" from QM™.

Opening the Manage Tools dialog box

To open the Manage Tools dialog box, go to the Tools->Manage External Tools... menu or press the Manage Tools button in the Tools Toolbar :

Manage External Tools dialog

Setting Environment Variables

The Environment Variables list at the top of the "Manage External Tools" dialog box allows you to define any number of environment variables for the local process that runs an external tool. These environment variables can then be used inside the path names or as arguments to the launched programs. This is specifically helpful to avoid repetitions of information needed to define a tool or a group of related tools.

The environment variables defined at the top of the "Manage External Tools" dialog box are used in the tool configuration according to the syntax rules of the specific platform on which you run the tools. For example, environment variables on Windows are accessed by placing them between %% characters (e.g., %FOO%). Environment variables on Linux are accessed by placing them in the parentheses following the dollar sign (e.g., $(FOO)).

The environment variables defined at the top of the "Manage External Tools" dialog box have scope and lifetime limited to the temporary process that is used to launch an external tool. They only persist during the run of the tool and disappear afterwards.

Configuring an External Tool

  • Click on the tool you want to configure in the External Tools list in the middle of the dialog box.
  • Choose an icon for this tool from the Icon combo box. This icon will be displayed in the Tools Toolbar and the Tools Menu.
  • In the Title box, enter the Title of this tool. The Title is used to identify the tool in the Tools Menu and will also appear in the "balloon help" when you hover the mouse cursor over the tool button in the Tools Toolbar.
  • In the Command box, enter the file name for invoking the tool. You can either press the search button to open the standard file-search dialog box or you can type in the file name manually. If the file resides on the system PATH, you can enter just the file name. If not, enter the full absolute path to the file. You can also use a relative path (starting with ".") with respect to the model file location.
  • If the command needs arguments, you can specify them in the Arguments box. The button allows you to choose the pre-defined argument (currently the model file name or the model file path).
  • Typically, you want your command to start in a specific working directory. For example, the make command needs to start in the directory where the Makefile is located. To specify the initial working directory, type it in manually in the Initial Directory box, or you can press the button to open the standard folder-search dialog box. You can also specify the Initial Directory to be a relative path (starting with ".") with respect to the model file location. NOTE: The initial directory is not where the tool is located. The initial directory is the working directory in which the tool starts operating.
  • Check the Generate code before launching box if you want QM to generate the code before running your external tool.
  • Check the Show error message box after failure box if you want QM to alert you with a message box about the tool failure.
  • Check the Start as detached from QM box only if you want the tool to operate independently from QM. This option makes sense only for tools with their own GUI. NOTE: a tool launched as "detached" must be closed explicitly.
  • Press the Save button to save the tool configuration.
QM™ stores the External Tool configuration in the Settings for the QM™ application, which is the same storage that holds the most recently used models or the recent arrangement of the docking windows. These Settings are not part of the model, but rather are specific to the machine on which QM™ is installed.

Example: A Tool for Calling GCC Compiler

As a simple example of using an external tool, consider a tool for building the Blinky project discussed in the QM™ Tutorial.

The screen shot below shows how to set up the "build Blinky" tool:

Setting up GCC build
  • Title property: build Blinky
  • Command property: gcc (this assumes that gcc is on the PATH)
  • Arguments property: blinky.c -oblinky.exe -IQPC%\include -IQPC%\ports\win32 -LQPC%\ports\win32\mingw\dbg -lqp
  • Initial Directory property: . (model directory)
As shown in the screen shot above, in the Arguments: property you can use the pre-defined symbols ${ModelPath}, ${ModelFile}, and ${ModelDir}.

Example: A Tool for Building an IAR Project

Many mature embedded toolsets support building projects from the command-line, because only such builds can be truly automated. For example, the popular IAR Embedded Workbench toolset supports command-line build of the projects through the IarBuild.exe utility. The following screen shot illustrates how to set up an External Tool to build an IAR project.

Setting up IAR build

The following screen shot shows the QM™ Log Console output from building an IAR project.

Log of IAR build
In case of the tool failure, the Log Console will show the error status. But, if you checked the Show error message box after failure box for the tool, you will get an additional alert in the form of a message box, which can be useful for unit testing.

New Model Dialog Box Code Generation License Dialog Box