<?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>topic Re: Bug: Cpp Example - Global Object with new/malloc in Construct in MQX Software Solutions</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Cpp-Example-Global-Object-with-new-malloc-in-Construct/m-p/226282#M6121</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rui,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;This may be of some interest I had the same problem using IAR rather than CW &lt;/SPAN&gt;and I had to change some linker options&lt;/P&gt;&lt;P&gt;--redirect __iar_dlmalloc=malloc&lt;BR /&gt; --redirect __iar_dlcalloc=calloc&lt;BR /&gt; --redirect __iar_dlfree=free&lt;BR /&gt; --skip_dynamic_initialization&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And then, first thing in my main function before any tasks etc I had to issue the following&lt;/P&gt;&lt;P&gt;__iar_dynamic_initialization();&amp;nbsp;&amp;nbsp; // initialize c++ initialized data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know this isn’t the same for CW but thought it may at least be helpful and may help in were to look &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kevin&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Sep 2013 07:40:04 GMT</pubDate>
    <dc:creator>KJFPE</dc:creator>
    <dc:date>2013-09-12T07:40:04Z</dc:date>
    <item>
      <title>Bug: Cpp Example - Global Object with new/malloc in Construct</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Cpp-Example-Global-Object-with-new-malloc-in-Construct/m-p/226280#M6119</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;I am using TWRK70 + MQX 4.0.1 + CW10.4 Windows XP + g++.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created a new MQX 4.0 project by selecting a Example application named &lt;STRONG&gt;cplus&lt;/STRONG&gt; and changed the "HelloWorld" Class to use operator &lt;STRONG&gt;new&lt;/STRONG&gt; in Constructor methods of Class, see the changed in below as &lt;STRONG&gt;BOLD:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;class HelloWorld {&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;private:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; int check_init;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; const char *id;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;void* pointer;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;public:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; HelloWorld() {&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; check_init = 0x1234567;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;pointer = new int;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; }&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; ~HelloWorld() {&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _io_printf("%s: deallocation\n",id);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;delete (int*)pointer;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pointer = NULL;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; }&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; void print(const char *x) {&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; id = x;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (check_init == 0x1234567) {&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _io_printf("%s: Constructed OK\n",id);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } else {&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _io_printf("%s: Constructor not called\n",id);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; }&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;};&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And it is created a Global Object with the name "global"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;static HelloWorld global;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then Crashed!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I noticed that the &lt;STRONG&gt;C++ static initializers&lt;/STRONG&gt; is called before of MQX initialization and the allocation of HEAP memory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My quick fix was:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;comment the following line in &lt;STRONG&gt;__thumb_startup&lt;/STRONG&gt; function, in &lt;STRONG&gt;__arm_start.c&lt;/STRONG&gt; source file in &lt;STRONG&gt;ARM_GCC_Support\ewl\EWL_Runtime\src\arm&lt;/STRONG&gt; folder and recompile it.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;EM&gt;//__call_static_initializers();&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;added the following lines in &lt;STRONG&gt;init_bsp.c&lt;/STRONG&gt; source file in &lt;STRONG&gt;mqx\source\bsp\twrk70f120m&lt;/STRONG&gt; folder&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #if BSPCFG_ENABLE_CPP&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; extern void __init_cpp(void);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #endif&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;added the following lines in &lt;STRONG&gt;_bsp_enable_card&lt;/STRONG&gt; function, in &lt;STRONG&gt;init_bsp.c&lt;/STRONG&gt; source file in &lt;STRONG&gt;mqx\source\bsp\twrk70f120m&lt;/STRONG&gt; folder&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #if BSPCFG_ENABLE_CPP&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* initialize C++ constructors */&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; __init_cpp();&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #endif&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;recompile MQX Kernel&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Seems to work properly but i don't know if it is missing some detail. Anyone can help me?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Sep 2013 16:38:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Cpp-Example-Global-Object-with-new-malloc-in-Construct/m-p/226280#M6119</guid>
      <dc:creator>RuiFaria</dc:creator>
      <dc:date>2013-09-11T16:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: Bug: Cpp Example - Global Object with new/malloc in Construct</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Cpp-Example-Global-Object-with-new-malloc-in-Construct/m-p/226281#M6120</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Rui Faria,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;we will look into it. I'll share this with the team.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll inform you with any changes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;0xc0170&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Sep 2013 05:36:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Cpp-Example-Global-Object-with-new-malloc-in-Construct/m-p/226281#M6120</guid>
      <dc:creator>c0170</dc:creator>
      <dc:date>2013-09-12T05:36:29Z</dc:date>
    </item>
    <item>
      <title>Re: Bug: Cpp Example - Global Object with new/malloc in Construct</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Cpp-Example-Global-Object-with-new-malloc-in-Construct/m-p/226282#M6121</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rui,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;This may be of some interest I had the same problem using IAR rather than CW &lt;/SPAN&gt;and I had to change some linker options&lt;/P&gt;&lt;P&gt;--redirect __iar_dlmalloc=malloc&lt;BR /&gt; --redirect __iar_dlcalloc=calloc&lt;BR /&gt; --redirect __iar_dlfree=free&lt;BR /&gt; --skip_dynamic_initialization&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And then, first thing in my main function before any tasks etc I had to issue the following&lt;/P&gt;&lt;P&gt;__iar_dynamic_initialization();&amp;nbsp;&amp;nbsp; // initialize c++ initialized data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know this isn’t the same for CW but thought it may at least be helpful and may help in were to look &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kevin&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Sep 2013 07:40:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Cpp-Example-Global-Object-with-new-malloc-in-Construct/m-p/226282#M6121</guid>
      <dc:creator>KJFPE</dc:creator>
      <dc:date>2013-09-12T07:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: Bug: Cpp Example - Global Object with new/malloc in Construct</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Cpp-Example-Global-Object-with-new-malloc-in-Construct/m-p/226283#M6122</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kevin,&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;I could find or try some of those linker options in CW, specially the "&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12px; background-color: #f6f6f6;"&gt;--skip_dynamic_initialization&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;" and only call it after the initialization of MQX and memory. Because i didn't want to change the sources of &lt;/SPAN&gt;&lt;STRONG style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;ARM_GCC_Support&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; provided by CW.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the attention.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Rui Faria&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Sep 2013 09:29:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Cpp-Example-Global-Object-with-new-malloc-in-Construct/m-p/226283#M6122</guid>
      <dc:creator>RuiFaria</dc:creator>
      <dc:date>2013-09-12T09:29:23Z</dc:date>
    </item>
    <item>
      <title>Re: Bug: Cpp Example - Global Object with new/malloc in Construct</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Cpp-Example-Global-Object-with-new-malloc-in-Construct/m-p/226284#M6123</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have received an answer from one of our engineers:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;Existing MQX/C++ support depends on third-part toolchain startup routines.All of the supported toolchains invoke static object constructors before the main function – which starts the MQX. It means that you are not allowed to use new, malloc, alloc, … or any MQX system functions. Static constructors should setup only constant values to attributes. The number of static object constructors is also limited to 32. The information about restrict C++ usage is missing in the MQX documentation, it will be updated in the next release.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;Your modification allows to use new/malloc operator in static constructors and also allow to use “unlimited” number of static object constructors,but you might violate the C++ standard - the initialization process of static object constructors is implementation-defined and you moved it from before-main to inside-main. Thus it is non-portable solution across other toolchains. &lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your feedback! We will consider to provide full C++ support in the future.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;0xc0170&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Sep 2013 11:03:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Cpp-Example-Global-Object-with-new-malloc-in-Construct/m-p/226284#M6123</guid>
      <dc:creator>c0170</dc:creator>
      <dc:date>2013-09-12T11:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: Bug: Cpp Example - Global Object with new/malloc in Construct</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Cpp-Example-Global-Object-with-new-malloc-in-Construct/m-p/226285#M6124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;Hi I am not sure I agree with your response here is a section copied from the MQXUG.pdf&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 17.0pt; font-family: 'HelveticaLTStd-Bold','sans-serif';"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 17.0pt; font-family: 'HelveticaLTStd-Bold','sans-serif';"&gt;6.3 Global Constructors&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="font-size: 14.0pt; font-family: 'TimesLTStd-Bold','serif';"&gt;I need to initialize some global constructors, which use the 'new' operator, before I call 'main'; that is, before I start MQX. The 'new' operator calls malloc(), which I redefine to call the MQX function _mem_alloc(). How do I do this?&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 14.0pt; font-family: 'TimesLTStd-Roman','serif';"&gt;Initialize the constructors from &lt;/SPAN&gt;&lt;STRONG style="font-size: 14.0pt; font-family: 'TimesLTStd-Bold','serif';"&gt;_bsp_enable_card() &lt;/STRONG&gt;&lt;SPAN style="font-size: 14.0pt; font-family: 'TimesLTStd-Roman','serif';"&gt;(in &lt;/SPAN&gt;&lt;EM style="font-size: 14.0pt; font-family: 'TimesLTStd-Italic','serif';"&gt;init_bsp.c&lt;/EM&gt;&lt;SPAN style="font-size: 14.0pt; font-family: 'TimesLTStd-Roman','serif';"&gt;), which MQX calls after it initializes the memory management component.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Sep 2013 11:16:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Cpp-Example-Global-Object-with-new-malloc-in-Construct/m-p/226285#M6124</guid>
      <dc:creator>KJFPE</dc:creator>
      <dc:date>2013-09-12T11:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: Bug: Cpp Example - Global Object with new/malloc in Construct</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Cpp-Example-Global-Object-with-new-malloc-in-Construct/m-p/226286#M6125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know that it is not standard, i shouldn't &lt;SPAN style="font-size: 10pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;change the sources of &lt;/SPAN&gt;&lt;STRONG style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;ARM_GCC_Support&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; provided by CW&lt;/SPAN&gt; but is it only a limitation of Kinetics?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I already use new/malloc in Constructors in Coldfire MCF52259 without problems and now i am porting to Kinetic K70.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the attention.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Rui Faria&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Sep 2013 13:04:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Cpp-Example-Global-Object-with-new-malloc-in-Construct/m-p/226286#M6125</guid>
      <dc:creator>RuiFaria</dc:creator>
      <dc:date>2013-09-12T13:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: Bug: Cpp Example - Global Object with new/malloc in Construct</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Cpp-Example-Global-Object-with-new-malloc-in-Construct/m-p/226287#M6126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;I am having a similar problem when I attempt to declare a constant string in a header file as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static const std::string x = "123456789123456789123456789";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was thinking that the size of this string would be known at compile time and it would be placed in the constants code section. Instead what happens is the static initializer calls the string constructor code. The constructor invokes the memory allocator when the string size is greater than a predetermined value (which this case is). Since mqx was not initialized the program crashes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have no problems doing this on other systems, so I believe this is a bug.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dave&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Oct 2013 17:42:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Cpp-Example-Global-Object-with-new-malloc-in-Construct/m-p/226287#M6126</guid>
      <dc:creator>davemcgahey</dc:creator>
      <dc:date>2013-10-23T17:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: Bug: Cpp Example - Global Object with new/malloc in Construct</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Cpp-Example-Global-Object-with-new-malloc-in-Construct/m-p/226288#M6127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also believe that it is a bug. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The initialization of MQX in Kinectics is wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have to wait and hope for &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;full C++ support.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Nov 2013 17:12:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Cpp-Example-Global-Object-with-new-malloc-in-Construct/m-p/226288#M6127</guid>
      <dc:creator>RuiFaria</dc:creator>
      <dc:date>2013-11-28T17:12:48Z</dc:date>
    </item>
  </channel>
</rss>

