How can I set portable word sizes for the MATLAB Coder?

10 次查看(过去 30 天)
Hi,
I'm using the MATLAB Coder (not the Simulink Coder) to automatically generate 'C' code from MATLAB algorithims. I'm using the GNU Tools for ARM Embedded Processors compiler, otherwise the ARM Cortex-M code replacement library doesn't work. When I run a SIL simulation, I get the error: "The toolchain for '<my entry function>' is 'GNU Tools for ARM Embedded Processors' and the model option Enable portable word sizes was not selected. This configuration is not supported for SIL simulation"
I've looked how to enable portable word sizes, but all the information is for the Simulink Coder, the MATLAB Coder doesn't have an option to enable portable word sizes. Is there a hidden menu somewhere? Incidentally, although MATLAB Coder is using Embedded Coder settings, the MATLAB Coder still provides many fewer options for settings than the Simulink version.
Many thanks, Dan

采纳的回答

Ryan Livingston
Ryan Livingston 2015-7-8
MATLAB Coder does not have support for portable word sizes. Unfortunately this message is misleading in that regard and has been reported to our development teams.
To verify your code I would recommend either switching to a host computer toolchain and running the code on the host using SIL or using processor-in-the-loop (PIL) to run directly on your target hardware if you are using MATLAB R2014b or later.
You can refer to this page and this page to see how to use PIL with MATLAB Coder.
  2 个评论
Daniel Wagstaff
Daniel Wagstaff 2015-7-8
编辑:Daniel Wagstaff 2015-7-8
Thank you for your reply; it's good to know I'm not just missing something. May I ask a related follow-up question, please?
MATLAB Coder uses Embedded Coder features, but has many fewer options than the Embedded Coder, which is available on Simulink; is there a way to access similar options, specifically building for ROM efficiency, or do I have to port to Simulink for that?
Many thanks, Dan
Ryan Livingston
Ryan Livingston 2015-7-9
You're welcome, Dan. Currently MATLAB Coder supports a subset of the Embedded Coder features supported in Simulink that you see in the configuration object and the settings dialog. Building for ROM efficiency is not currently among those features.
We're always working to increase the support and I made a note of your desire for supporting building for ROM efficiency.
Decreasing inlining may be one option to help keep the ROM size under control. You can manually prevent a function from being inlined by adding:
coder.inline('never');
to it. Alternatively, you could reduce the thresholds related to which functions may be inlined in the settings InlineThreshold and InlineThresholdMax. Coupling those changes with the right C compiler options may be helpful to reduce code size.

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by