<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Model-Based Design Toolbox (MBDT)中的主题 Re: MBD toolbox, external mode:  asking for too much RAM = system hang</title>
    <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/MBD-toolbox-external-mode-asking-for-too-much-RAM-system-hang/m-p/1528843#M7697</link>
    <description>&lt;P&gt;Hello,&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/146851"&gt;@glenndoiron&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you send me the model with multiple signals logged that overflow the buffer for external mode? So I can investigate further the problem that you have found.&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Stefan.&lt;/P&gt;</description>
    <pubDate>Tue, 27 Sep 2022 12:59:51 GMT</pubDate>
    <dc:creator>stefancinipeanu</dc:creator>
    <dc:date>2022-09-27T12:59:51Z</dc:date>
    <item>
      <title>MBD toolbox, external mode:  asking for too much RAM = system hang</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/MBD-toolbox-external-mode-asking-for-too-much-RAM-system-hang/m-p/1521452#M7682</link>
      <description>&lt;P&gt;We have been trying to use the external mode with the S32K144 MBD toolkit, and have found a hard crash problem.&lt;/P&gt;&lt;P&gt;If you go into Model Properties -&amp;gt; Code Generation -&amp;gt; Interface -&amp;gt; External Mode Configuration and check "Static memory allocation", then give it a static memory buffer size that (along with everything else in your model) exceeds the total RAM on the system, then the compilation correctly fails and gives you a message that there is 0 ram left.&amp;nbsp; This is good.&lt;/P&gt;&lt;P&gt;However, if you uncheck "Static memory allocation", and allocate enough signals to monitor and a duration which causes the buffer to exceed available memory (in the Control Panel -&amp;gt; Signal and Triggering window), then model hangs and gives a timeout error, instead of erroring out with an out of memory error.&lt;/P&gt;&lt;P&gt;Reviewing the compiled binary, the logic to report the failed memory allocation in UploadBufInit()&amp;nbsp; in fact looks to be correct to report the error, however the malloc() function linked to in the project triggers an exception instead of returning 0, causing a crash of the model; Simulink eventually times out with an error instead of reporting that the memory allocation failed.&lt;/P&gt;&lt;P&gt;Here in the debugger I have the program counter trapped on the malloc() function where it is about to call malloc(48048), which exceeds the remaining RAM.&amp;nbsp; I also have a breakpoint on the next instruction after the malloc() call.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="glenndoiron_18-1663101062914.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/193492iB419A292F2509AD6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="glenndoiron_18-1663101062914.png" alt="glenndoiron_18-1663101062914.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I then hit run, and the system generates an exception instead of returning from malloc().&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="glenndoiron_19-1663101203134.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/193493iCF2C8C70533B7A97/image-size/medium?v=v2&amp;amp;px=400" role="button" title="glenndoiron_19-1663101203134.png" alt="glenndoiron_19-1663101203134.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;After many hours of trying to understand why external mode was "not working", I finally have the smoking gun.&amp;nbsp; If we reduce the trigger duration to a very small number, the allocation succeeds and external mode works as advertised.&lt;/P&gt;&lt;P&gt;I don't think that this one needs to be reported to Mathworks, as Simulink is almost certainly linking against the NXP-supplied linker libraries for malloc().&amp;nbsp; It technically isn't an MBD Toolbox issue either, but hopefully the MBD guys can find out which linker library is broken and get it fixed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2022 20:37:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/MBD-toolbox-external-mode-asking-for-too-much-RAM-system-hang/m-p/1521452#M7682</guid>
      <dc:creator>glenndoiron</dc:creator>
      <dc:date>2022-09-13T20:37:26Z</dc:date>
    </item>
    <item>
      <title>Re: MBD toolbox, external mode:  asking for too much RAM = system hang</title>
      <link>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/MBD-toolbox-external-mode-asking-for-too-much-RAM-system-hang/m-p/1528843#M7697</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/146851"&gt;@glenndoiron&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you send me the model with multiple signals logged that overflow the buffer for external mode? So I can investigate further the problem that you have found.&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Stefan.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2022 12:59:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/MBD-toolbox-external-mode-asking-for-too-much-RAM-system-hang/m-p/1528843#M7697</guid>
      <dc:creator>stefancinipeanu</dc:creator>
      <dc:date>2022-09-27T12:59:51Z</dc:date>
    </item>
  </channel>
</rss>

