<?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: Linker errors when using the &amp;quot;new&amp;quot; operator in S32 Design Studio</title>
    <link>https://community.nxp.com/t5/S32-Design-Studio/Linker-errors-when-using-the-quot-new-quot-operator/m-p/491573#M199</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I changed the heap size and added an "end" definition at the beginning of the heap section, it works just fine.&lt;/P&gt;&lt;P&gt;One thing I noticed though is that the newlib implementation of malloc allocates a minimium of 16 bytes even for single byte types.&lt;/P&gt;&lt;P&gt;The overhead is used internally and is probably useful/needed when running on a platform such as Linux.&lt;/P&gt;&lt;P&gt;In an embedded environment with limited RAM however, it may be a good idea to use something more rudimentary.&lt;/P&gt;&lt;P&gt;I'm going to stick with newlib for now but probably find a way to use my proprietary implementation in the future.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help Stanislav!&lt;/P&gt;&lt;P&gt;Ville&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 Dec 2015 10:53:31 GMT</pubDate>
    <dc:creator>villevallinder</dc:creator>
    <dc:date>2015-12-22T10:53:31Z</dc:date>
    <item>
      <title>Linker errors when using the "new" operator</title>
      <link>https://community.nxp.com/t5/S32-Design-Studio/Linker-errors-when-using-the-quot-new-quot-operator/m-p/491570#M196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Everybody!&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I add something like "int* MyInt = new int;" to a C++ project I get the following result:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Invoking: Standard S32DS C++ Linker&lt;/P&gt;&lt;P&gt;powerpc-eabivle-g++ -o "Basic_Z4_1.elf" "@Basic_Z4_1.args"&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;D:/Freescale/S32_Power_v1.0/S32DS/e200_ewl2/lib/fp/e200z4\libsupc++.a(vterminate.o): In function `__gnu_cxx::__verbose_terminate_handler()':&lt;/P&gt;&lt;P&gt;/home/rb501c/build_gcc_dir/build_gnu/opt/freescale/ELvle/obj_gcc/powerpc-eabivle/fp/e200z4/libstdc++-v3/libsupc++/../../../../../../src_gcc/libstdc++-v3/libsupc++/vterminate.cc:67: undefined reference to `_impure_ptr'&lt;/P&gt;&lt;P&gt;/home/rb501c/build_gcc_dir/build_gnu/opt/freescale/ELvle/obj_gcc/powerpc-eabivle/fp/e200z4/libstdc++-v3/libsupc++/../../../../../../src_gcc/libstdc++-v3/libsupc++/vterminate.cc:67: undefined reference to `_impure_ptr'&lt;/P&gt;&lt;P&gt;/home/rb501c/build_gcc_dir/build_gnu/opt/freescale/ELvle/obj_gcc/powerpc-eabivle/fp/e200z4/libstdc++-v3/libsupc++/../../../../../../src_gcc/libstdc++-v3/libsupc++/vterminate.cc:69: undefined reference to `_impure_ptr'&lt;/P&gt;&lt;P&gt;/home/rb501c/build_gcc_dir/build_gnu/opt/freescale/ELvle/obj_gcc/powerpc-eabivle/fp/e200z4/libstdc++-v3/libsupc++/../../../../../../src_gcc/libstdc++-v3/libsupc++/vterminate.cc:72: undefined reference to `_impure_ptr'&lt;/P&gt;&lt;P&gt;/home/rb501c/build_gcc_dir/build_gnu/opt/freescale/ELvle/obj_gcc/powerpc-eabivle/fp/e200z4/libstdc++-v3/libsupc++/../../../../../../src_gcc/libstdc++-v3/libsupc++/vterminate.cc:49: undefined reference to `_impure_ptr'&lt;/P&gt;&lt;P&gt;D:/Freescale/S32_Power_v1.0/S32DS/e200_ewl2/lib/fp/e200z4\libsupc++.a(vterminate.o):/home/rb501c/build_gcc_dir/build_gnu/opt/freescale/ELvle/obj_gcc/powerpc-eabivle/fp/e200z4/libstdc++-v3/libsupc++/../../../../../../src_gcc/libstdc++-v3/libsupc++/vterminate.cc:49: more undefined references to `_impure_ptr' follow&lt;/P&gt;&lt;P&gt;D:/Freescale/S32_Power_v1.0/S32DS/e200_ewl2/lib/fp/e200z4\libc.a(vsnprintf.o): In function `vsnprintf':&lt;/P&gt;&lt;P&gt;S32DS/e200_ewl/EWL_C/src/stdio/vsnprintf.c:58: undefined reference to `__pformatter'&lt;/P&gt;&lt;P&gt;D:/Freescale/S32_Power_v1.0/S32DS/e200_ewl2/lib/fp/e200z4\libc.a(abort.o): In function `abort':&lt;/P&gt;&lt;P&gt;S32DS/e200_ewl/EWL_C/src/stdlib/abort.c:34: undefined reference to `_ExitProcess'&lt;/P&gt;&lt;P&gt;D:/Freescale/S32_Power_v1.0/S32DS/e200_ewl2/lib/fp/e200z4\libc.a(alloc.o): In function `sbrk':&lt;/P&gt;&lt;P&gt;S32DS/e200_ewl/EWL_C/src/stdlib/alloc.c:285: undefined reference to `_end'&lt;/P&gt;&lt;P&gt;S32DS/e200_ewl/EWL_C/src/stdlib/alloc.c:285: undefined reference to `_end'&lt;/P&gt;&lt;P&gt;D:/Freescale/S32_Power_v1.0/S32DS/e200_ewl2/lib/fp/e200z4\libc.a(exit.o): In function `exit':&lt;/P&gt;&lt;P&gt;S32DS/e200_ewl/EWL_C/src/stdlib/exit.c:40: undefined reference to `__fini_cpp'&lt;/P&gt;&lt;P&gt;S32DS/e200_ewl/EWL_C/src/stdlib/exit.c:53: undefined reference to `_ExitProcess'&lt;/P&gt;&lt;P&gt;collect2.exe: error: ld returned 1 exit status&lt;/P&gt;&lt;P&gt;make: *** [Basic_Z4_1.elf] Error 1&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone know the reason for this?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a proprietary implementation of "new" that I could use, is there a way to make DS use that one instead of the built-in one?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ville&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Dec 2015 07:30:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-Design-Studio/Linker-errors-when-using-the-quot-new-quot-operator/m-p/491570#M196</guid>
      <dc:creator>villevallinder</dc:creator>
      <dc:date>2015-12-18T07:30:44Z</dc:date>
    </item>
    <item>
      <title>Re: Linker errors when using the "new" operator</title>
      <link>https://community.nxp.com/t5/S32-Design-Studio/Linker-errors-when-using-the-quot-new-quot-operator/m-p/491571#M197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ville,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your contribution on NXP Community.&lt;/P&gt;&lt;P&gt;You cannot link the project since you selected EWL (Embedder Warrior Libraries).&lt;/P&gt;&lt;P&gt;The EWL libs are built with the smallest footprint by default. Therefore the libs does not include all the features - e.g. dynamic memory allocation routines.&lt;/P&gt;&lt;P&gt;The easiest way is to select "Newlib" libraries in the project Wizard (see below).&lt;/P&gt;&lt;P&gt;Other way is to customize EWL libs (using prefix .h files) and rebuild it.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="S32DS_Power_create_CPP__newlib_project.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/36048i726D2C5520FB6907/image-size/large?v=v2&amp;amp;px=999" role="button" title="S32DS_Power_create_CPP__newlib_project.png" alt="S32DS_Power_create_CPP__newlib_project.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;&lt;P&gt;Stan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Dec 2015 16:37:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-Design-Studio/Linker-errors-when-using-the-quot-new-quot-operator/m-p/491571#M197</guid>
      <dc:creator>stanish</dc:creator>
      <dc:date>2015-12-21T16:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: Linker errors when using the "new" operator</title>
      <link>https://community.nxp.com/t5/S32-Design-Studio/Linker-errors-when-using-the-quot-new-quot-operator/m-p/491572#M198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Stanislav!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I made a new project with newlib selected.&lt;/P&gt;&lt;P&gt;It still does not link but the issued error is completely different:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Invoking: Standard S32DS C++ Linker&lt;/P&gt;&lt;P&gt;powerpc-eabivle-g++ -o "Basic2_Z4_1.elf" "@Basic2_Z4_1.args"&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;D:/Freescale/S32_Power_v1.0/Cross_Tools/powerpc-eabivle-4_9/powerpc-eabivle/newlib/lib/fp/e200z4\libnosys.a(sbrk.o): In function `sbrk':&lt;/P&gt;&lt;P&gt;/home/rb501c/build_gcc_dir/build_gnu/opt/freescale/ELvle/obj_newlib/powerpc-eabivle/fp/e200z4/libgloss/libnosys/../../../../../../src_newlib/libgloss/libnosys/sbrk.c:21: undefined reference to `end'&lt;/P&gt;&lt;P&gt;/home/rb501c/build_gcc_dir/build_gnu/opt/freescale/ELvle/obj_newlib/powerpc-eabivle/fp/e200z4/libgloss/libnosys/../../../../../../src_newlib/libgloss/libnosys/sbrk.c:21: undefined reference to `end'&lt;/P&gt;&lt;P&gt;collect2.exe: error: ld returned 1 exit status&lt;/P&gt;&lt;P&gt;make: *** [Basic2_Z4_1.elf] Error 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shouldn't DS add "end" to "sections.ld" based on selected memory layout?&lt;/P&gt;&lt;P&gt;__HEAP_SIZE is set to 0 in "mem.ld", is there a project setting for heap size somewhere?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Ville&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Dec 2015 08:23:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-Design-Studio/Linker-errors-when-using-the-quot-new-quot-operator/m-p/491572#M198</guid>
      <dc:creator>villevallinder</dc:creator>
      <dc:date>2015-12-22T08:23:14Z</dc:date>
    </item>
    <item>
      <title>Re: Linker errors when using the "new" operator</title>
      <link>https://community.nxp.com/t5/S32-Design-Studio/Linker-errors-when-using-the-quot-new-quot-operator/m-p/491573#M199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I changed the heap size and added an "end" definition at the beginning of the heap section, it works just fine.&lt;/P&gt;&lt;P&gt;One thing I noticed though is that the newlib implementation of malloc allocates a minimium of 16 bytes even for single byte types.&lt;/P&gt;&lt;P&gt;The overhead is used internally and is probably useful/needed when running on a platform such as Linux.&lt;/P&gt;&lt;P&gt;In an embedded environment with limited RAM however, it may be a good idea to use something more rudimentary.&lt;/P&gt;&lt;P&gt;I'm going to stick with newlib for now but probably find a way to use my proprietary implementation in the future.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help Stanislav!&lt;/P&gt;&lt;P&gt;Ville&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Dec 2015 10:53:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-Design-Studio/Linker-errors-when-using-the-quot-new-quot-operator/m-p/491573#M199</guid>
      <dc:creator>villevallinder</dc:creator>
      <dc:date>2015-12-22T10:53:31Z</dc:date>
    </item>
  </channel>
</rss>

