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:
A MATLAB M-script or pre-built options files are provided, which help you automatically build your MEX-files.
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.
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
mex -setup
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
motdsp_build_mexopts
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 OptionsFile
s 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
mex -v -f <OptionsFile> <MEX-file>
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
mex -v -f ./motdsp_mexopts3xx.sh ../motdsp/56300/mot563_mean.cpp
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.
LINK fatal error: cannot open file <DLL>
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
clear mot563_mean
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 | ![]() |