Motorola DSP Developer's Kit    

Building Motorola DSP MEX-Files

This section provides detailed instructions for building Motorola DSP MEX-files. The two approaches available are:

  1. Automated Build

    A MATLAB M-script or pre-built options files are provided, which help you automatically build your MEX-files.

  1. Custom Build

    This approach gives more control over the build process to developers more knowledgeable about their compiler and system configuration. You must create your own project workspace via an Integrated Development Environment (IDE) or use your own makefiles.

For background information on building MEX-files, read "Getting Started" (Chapter 2) and "System Setup" (Chapter 8) of the MATLAB Application Program Interface Guide.

Automated Build Process

Configuring the MEX Build Setup (Windows Only)

This configuration needs to be performed for each C++ compiler you want to use on the Windows platform. Once completed, you are ready to build DSP MEX-files using the MATLAB mex build script.

Before you create a MEX-file, configure the default options file, mexopts.bat, for your compiler. This is done by entering

at the MATLAB prompt.

This mexopts.bat file needs further changes to build Motorola DSP MEX-files. These changes are made by running the motdsp_build_mexopts.m script, which generates new options files that provide the capability to build the DSP MEX-file correctly for a particular Motorola Suite56 DSP family. To run this script, type

at the MATLAB prompt.

The script creates two options files in <matlab>/toolbox/motdsp/motdspmex: one OptionsFile for the 56300 DSP family and the other for the 56600 DSP family. The OptionsFiles contain compiler directives and a list of arguments (e.g., include directories) used by your compiler to build the DSP MEX-files. The OptionsFile is passed to the mex command with the -f mex option.

Building the MEX-File

In the same directory as the OptionsFile, enter

at the MATLAB prompt, where <MEX-file> is the full or relative pathname of the MEX-file source you want to compile, and <OptionsFile> is replaced by the DSP family-specific file name. An example, while in the <matlab>/toolbox/motdsp/motdspmex directory, using relative pathnames might be

Windows.   Successful compilation results in the creation of a dynamically linked library (DLL) with the same name as the compiled MEX-file, but with a .dll extension. The created DLL resides in the current working directory unless you specify otherwise with the -outdir switch to the mex command. Type help mex at the MATLAB prompt for more information.

The error message

is seen if you try to rebuild a MEX-file that has recently been run. By default, the DLL is still loaded into memory and must be explicitly released with the clear command by typing

at the MATLAB prompt.

UNIX.   Successful compilation results in the creation of a MEX shared library with the same name as the compiled MEX-file, but with a .mexsol extension for Solaris.


 Demos Custom Build Process