4

To build to target hardware, an an S-function Builder block requires access
to its source files and .mex file.

It seems that the source files and the .mex file
MUST be in the same directory on the Matlab path.

Is it possible to place distribute
the .mex file and the other source files
across multiple directories
and still be able to build to target hardware?

Configuration:

  • Minseg hardware (effectively a modded Arduino Mega 2560)
  • Laptop with OS X (10.11)
    • XCode 6.x.x (compiler which is supported by Mathworks)
    • Mathworks Matlab/Simulink (r2015b)
      • Mathworks Arduino support package (See targetinstaller command)
      • Mathworks Minseg driver library (library of S-functions based on C and C++ code.)
      • Both libraries are on the Matlab path
      • Compiler configured for C++ language (See mex command)
    • Minimum Working Example (MWE):
      • Simulink model correctly configured for use with Arduino Mega 6050
      • Contains MPU-6050 S-function block from the driver library, connected to a scope.

MWE:

Build Model to Target Hardware:
If the .meximac64 file and the S-function source code files
are placed within a single directory on the Matlab path,
then the model builds to the target hardware and runs perfectly.

kando
  • 441
  • 4
  • 16

0 Answers0