Filter löschen
Filter löschen

Embedded Coder Portable Word Sizes Issue (Code was generated for compiler with different sized X)

86 Ansichten (letzte 30 Tage)
I am working on a Simulink Coder project where we have a number of export function model references being built by a single top-level export function model, porting the resulting code over to an external application we are developing. We are then running the full codebase through Polyspace Access to verify MISRA compliance. When we get to the compilation step in Polyspace Access, it is failing on a single file; one of the MODEL_private.h files among the dozens generated for the code has a block of precompiler checks, and ALL of the #errors are being flagged, despite all of the defined constants in our GNU version's limits.h file matching the checks below:
/*
* File: MODEL_private.h
*
* Code generated for Simulink model 'MODEL'.
*
* Model version : 3.307
* Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
*
* Target selection: ert.tlc
* Embedded hardware selection: ARM Compatible->ARM Cortex
* Code generation objectives:
* 1. MISRA C:2012 guidelines
* 2. Execution efficiency
* 3. Debugging
* Validation result: Not run
*/
#ifndef RTW_HEADER_MODEL_private_h_
#define RTW_HEADER_MODEL_private_h_
#include "rtwtypes.h"
#ifndef PORTABLE_WORDSIZES
#ifndef UCHAR_MAX
#include <limits.h>
#endif
#if ( UCHAR_MAX != (0xFFU) ) || ( SCHAR_MAX != (0x7F) )
#error Code was generated for compiler with different sized uchar/char. \
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.
#endif
#if ( USHRT_MAX != (0xFFFFU) ) || ( SHRT_MAX != (0x7FFF) )
#error Code was generated for compiler with different sized ushort/short. \
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.
#endif
#if ( UINT_MAX != (0xFFFFFFFFU) ) || ( INT_MAX != (0x7FFFFFFF) )
#error Code was generated for compiler with different sized uint/int. \
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.
#endif
#if ( ULONG_MAX != (0xFFFFFFFFU) ) || ( LONG_MAX != (0x7FFFFFFF) )
#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.
#endif
#endif
We have the same configuration being used as a configuration reference for all of the models in our project, and the configuration has Portable Word Sizes enabled. Does anyone know why this block of checks is being generated for only a single file? Why would these checks fail if my limits.h file values match the 3defines in this block?

Antworten (0)

Kategorien

Mehr zu Deployment, Integration, and Supported Hardware finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by