Different Sized Ulong/Long Error When Building Simulink Model for VeriStand

Updated Apr 17, 2023

Reported In

Software

  • VeriStand
  • Simulink

Issue Details

I have a model in Simulink that I am trying to build for use in VeriStand.
I have tried using both the VeriStand Model Framework and VeriStand Model Generation Support Add-On for MATLAB but get the same error with both compiler toolchains:
​​​​​

error: #error Code was generated for compiler with different sized ulong/long. Consider adjusting Test hardware word size settings on the Hardware Implementation pane to match your compiler word sizes as defined in limits.h of the compiler. Alternatively, you can select the Test hardware is the same as production hardware option and select the Enable portable word sizes option on the Code Generation > Verification pane for ERT based targets, which will disable the preprocessor word size checks. #error Code was generated for compiler with different sized ulong/long.

The model may have previously compiled successfully for different targets (such as NI Phar Lap targets) or compiler toolchains.

Solution

This error is caused by a mismatch between the compiler settings and actual hardware in how datatypes are represented, specifically signed and unsigned integers or long and ulong datatypes.

To resolve this issue, we need to change the compiler settings. Follow these steps to correct the mismatch:
  1. Open MATLAB and open your model in Simulink
  2. Go to the Modelling tab and Click on Model Settings
  3. Go to the Hardware Implementation tab
    1. If you see an ellipse "..." under the last setting, or a way to expand Advanced Settings, select it
      1. Elipse.PNG
      2. Now tick the Test hardware is the same as production hardware option
    2. If you do not see an ellipse or way to show the Advanced Settings of the Hardware Implementation tab, select List from the top of the Configuration Parameters configuration window and search for Test Hardware
      1. List.png
      2. Find the Test hardware is the same as production hardware parameter and ensure the value tickbox is ticked
  4. Now save the model and ensure the other configuration parameters are set correctly for compilation by following the instructions in either Using the VeriStand Model Framework for Simulink or Creating Simulation Models Using VeriStand Model Generation Support Add-On depending on whether you are using the VeriStand Model Framework or the VeriStand Model Generation Support MATLAB Add-On