Info
この質問は閉じられています。 編集または回答するには再度開いてください。
Building S-Function model and deploy to Raspberry Pi
1 回表示 (過去 30 日間)
古いコメントを表示
Hello Everyone,
I am working on a simulation by coupling two software (OpenFresco and Simulink) through TCP/IP communication. It works fine when using Simulink Desktop Real-Time in Normal or Accelerator modes. But, I have tried to use external mode in conjunction with a Raspberry Pi 4 Model B (RBP4B) as external hardware, and I am having trouble generating the standalone executable before running the code in real-time.
First, I’m using Matlab release 2021a, with Simulink version 10.3 and Simulink Support Package for Raspberry Pi Hardware version 21.1.1. The Simulink model includes an S-function block written in C++, as shown below. This code allows for TCP/IP communication with the OpenFresco software running as a server on the same local network.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/643955/image.png)
As I show in the following screenshots, the source code is referenced in the “Code Generation” settings window. To compile the C++ code, I have used either Microsoft Visual Studio 2019 version 16.10.0 or MinGW-w64 version 21.1.0 compilers, both with the same bad results.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/643960/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/643965/image.png)
In the following lines, I’ll try to explain the error message. When trying to generate the executable, multiple syntax errors appear on the screen (in Spanish):
C:\...\matrix.h(194): error C2143: error de sintaxis: falta '{' delante de ':'
When modifying the indicated line of code, the error is modified and replaced by another:
C:\...\matrix.h(194): error C2433: 'Matrix': 'inline' no se permite en las declaraciones de datos
If I keep modifying the source code, the error continues changing. The problem with this is that the initial simulation that used to work with Simulink Desktop Real-Time and Normal/Accelerator modes doesn’t work anymore.
I appreciate your help in trying to figure this out and solve my issue. Thanks!
-----
The complete error message is shown below:
Top Model Building
### Starting build procedure for: AMB_NL_sim
### Generating code and artifacts to 'Model specific' folder structure
### Generating code into build folder: C:\Users\diego.mera\OneDriveUTFSM\Escritorio\Modelo_CG_hc\AMB\AMB_NL_sim_ert_rtw
Making simulation target "AMB_NL_sim_sfun", ...
Utilidad de mantenimiento de programas de Microsoft (R) versi≤n 14.28.29914.0
(C) Microsoft Corporation. Todos los derechos reservados.
### Compiling "AMB_NL_sim_sfun.c"
cl.exe /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMX_COMPAT_64 /DMATLAB_MEXCMD_RELEASE=R2018a /DMATLAB_MEX_FILE /nologo /MD /I "C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\slprj\_sfprj\amb_nl_sim\_self\sfun\src" /I "C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB" /I "C:\Program Files\MATLAB\R2021a\extern\include" /I "C:\Program Files\MATLAB\R2021a\simulink\include" /I "C:\Program Files\MATLAB\R2021a\simulink\include\sf_runtime" /I "C:\Program Files\MATLAB\R2021a\stateflow\c\mex\include" /I "C:\Program Files\MATLAB\R2021a\rtw\c\src" /I "C:\Users\diego.mera\OneDriveUTFSM\Escritorio\Modelo_CG_hc\AMB\slprj\_sfprj\AMB_NL_sim\_self\sfun\src" "AMB_NL_sim_sfun.c"
AMB_NL_sim_sfun.c
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\MovableObject.h(42): error C2061: error de sintaxis: identificador 'Channel'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\MovableObject.h(42): error C2059: error de sintaxis: ';'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\MovableObject.h(43): error C2061: error de sintaxis: identificador 'FEM_ObjectBroker'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\MovableObject.h(43): error C2059: error de sintaxis: ';'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\MovableObject.h(44): error C2061: error de sintaxis: identificador 'Information'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\MovableObject.h(44): error C2059: error de sintaxis: ';'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\MovableObject.h(45): error C2061: error de sintaxis: identificador 'Parameter'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\MovableObject.h(45): error C2059: error de sintaxis: ';'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\MovableObject.h(47): error C2061: error de sintaxis: identificador 'MovableObject'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\MovableObject.h(47): error C2059: error de sintaxis: ';'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\MovableObject.h(48): error C2449: se encontró '{' en el ámbito de archivo (¿falta el encabezado de función?)
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\MovableObject.h(77): error C2059: error de sintaxis: '}'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\OPS_Stream.h(31): error C2061: error de sintaxis: identificador 'Vector'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\OPS_Stream.h(31): error C2059: error de sintaxis: ';'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\OPS_Stream.h(32): error C2061: error de sintaxis: identificador 'ID'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\OPS_Stream.h(32): error C2059: error de sintaxis: ';'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\OPS_Stream.h(34): error C2061: error de sintaxis: identificador 'OPS_Stream'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\OPS_Stream.h(34): error C2059: error de sintaxis: ';'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\OPS_Stream.h(34): error C2059: error de sintaxis: ':'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\OPS_Globals.h(46): error C2143: error de sintaxis: falta ')' delante de '*'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\OPS_Globals.h(46): error C2143: error de sintaxis: falta '{' delante de '*'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\OPS_Globals.h(46): error C2059: error de sintaxis: ')'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\OPS_Globals.h(53): error C2143: error de sintaxis: falta '{' delante de 'enum [tag]'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\OPS_Globals.h(63): error C2061: error de sintaxis: identificador 'Domain'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\OPS_Globals.h(63): error C2059: error de sintaxis: ';'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\OPS_Globals.h(64): error C2061: error de sintaxis: identificador 'Element'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\OPS_Globals.h(64): error C2059: error de sintaxis: ';'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\OPS_Globals.h(70): error C2143: error de sintaxis: falta '{' delante de '*'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\OPS_Globals.h(71): error C2143: error de sintaxis: falta '{' delante de '*'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\matrix.h(42): error C2061: error de sintaxis: identificador 'Vector'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\matrix.h(42): error C2059: error de sintaxis: ';'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\matrix.h(43): error C2061: error de sintaxis: identificador 'ID'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\matrix.h(43): error C2059: error de sintaxis: ';'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\matrix.h(44): error C2061: error de sintaxis: identificador 'Message'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\matrix.h(44): error C2059: error de sintaxis: ';'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\matrix.h(48): error C2061: error de sintaxis: identificador 'Matrix'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\matrix.h(48): error C2059: error de sintaxis: ';'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\matrix.h(49): error C2449: se encontró '{' en el ámbito de archivo (¿falta el encabezado de función?)
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\matrix.h(183): error C2059: error de sintaxis: '}'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\matrix.h(194): error C2143: error de sintaxis: falta '{' delante de ':'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\matrix.h(194): error C2059: error de sintaxis: ':'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\matrix.h(200): error C2059: error de sintaxis: '&'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\matrix.h(217): error C2143: error de sintaxis: falta '{' delante de ':'
C:\Users\diego.mera\onedriveutfsm\escritorio\modelo_cg_hc\AMB\matrix.h(217): error C2059: error de sintaxis: ':'
C:\Users\diego.mera\OneDriveUTFSM\Escritorio\Modelo_CG_hc\AMB\slprj\_sfprj\AMB_NL_sim\_self\sfun\src\AMB_NL_sim_sfun.h(32): warning C4067: símbolos (token) inesperados después de la directiva del preprocesador; se esperaba una nueva línea
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\cl.exe"' : c≤digo devuelto '0x2'
Stop.
Component: Make | Category: Make error
### Build procedure for AMB_NL_sim aborted due to an error.
Build Summary
Top model targets built:
Model Action Rebuild Reason
======================================================================
AMB_NL_sim Failed Code generation information file does not exist.
0 of 1 models built (0 models already up to date)
Build duration: 0h 0m 8.13s
Unable to create mex function 'AMB_NL_sim_sfun.mexw64' required for simulation.
1 件のコメント
回答 (0 件)
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!