- Configuration Parameters: First, make sure the "TargetLang" parameter is set to 'C++' in your Model Configuration Parameters. This setting is essential for generating C++ code instead of C.
- Array Container Type: If you’re using "std::array" for the "ArrayContainerType", be aware that this might cause numerical differences between software-in-the-loop (SIL) or processor-in-the-loop (PIL) simulations and normal mode simulations. This happens especially if you're logging non-scalar signals, as the generated code uses "std::array" for these signals, which might behave differently. You may refer to the below bug reports link to know more about it: https://www.mathworks.com/support/bugreports/details/3419440
- External Mode Considerations: Be cautious if you enable the External mode configuration parameter, as it may lead to uncompilable C++ code. Starting in R2024b, there’s a change where Embedded Coder uses member methods instead of macros to access real-time model (RTM) data structures, so you might need to update your code accordingly. You can read more about the same in the R2024b release notes: https://www.mathworks.com/help/ecoder/release-notes.html?startrelease=R2024b&endrelease=R2024b&rntext=embedded+coder&groupby=release&sortby=descending&searchHighlight=embedded+coder#:~:text=%C2%A0Replace%20real%2Dtime%20model%20macros%20with%20member%20methods
- Custom Storage Classes: It might be helpful to define custom storage classes in the Embedded Coder Dictionary that are specifically designed for C++ code generation. This can give you more control over how variables are managed and represented in the generated code.
Unable to use Localizable/FileScope storage for signal state variables while generating C++ code generation. For C code generation I am able to use it.
51 次查看(过去 30 天)
显示 更早的评论
I am using Matlab 2024a and with Embedded coder I am generating C++ code for our application.
I am trying to generate a code where model signal, state variables have storage class of Localizable/FileScop which have unstructured representation of variables. In Embedded coder dictionary I make these changes it does not reflect for C++ code generation. But it is applied for C code generation only. Could you please provide its solution? Kindly let me know if any more inputs needed from my side.
0 个评论
回答(2 个)
Abhas
2024-10-28,6:32
编辑:Abhas
2024-10-29,4:22
I was also facing the issue while generating code in C++, and after going through the bug reports and documentation, I found some insights that might help you with your C++ code generation using Embedded Coder in MATLAB 2024a.
I hope this helps!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Deployment, Integration, and Supported Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!