<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"Pré-formatação HTML Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
span.EstiloDeEmail17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.Pr-formataoHTMLChar
{mso-style-name:"Pré-formatação HTML Char";
mso-style-priority:99;
mso-style-link:"Pré-formatação HTML";
font-family:"Courier New";
mso-fareast-language:PT-BR;}
..MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=PT-BR link=blue vlink=purple><div class=WordSection1><pre><span lang=EN-US style='color:black'>Hello Sebastian, and thanks for your answer. <o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'><o:p> </o:p></span></pre><pre><span lang=EN-US style='color:black'>The following example is enough to illustrate the problem I'm facing:<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'><o:p> </o:p></span></pre><pre><span lang=EN-US style='color:black'>rtems_task Init(rtems_task_argument argument)<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>{<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'> int *var = new int[10];<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'> <o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'> var[0] = 2;<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'> printk("testing... %i", var[0]);<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>}<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'><o:p> </o:p></span></pre><pre><span lang=EN-US style='color:black'>If 'var' is allocated on the stack ("int var[10]"), the program runs ok. When using the 'new' operator (and hence using the heap), the execution doesn't achieve the Init task, stopping at some instruction inside _Thread_Start_multitasking() – that’s what I vaguely called ‘crash’ before, sorry for that.<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'><o:p> </o:p></span></pre><pre><span lang=EN-US style='color:black'>This happens when linking with RTEMS 4.11 for the SIS BSP. Using RTEMS 4.10 for the same BSP, this problem doesn't occur.<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'><o:p> </o:p></span></pre><pre><span lang=EN-US style='color:black'>I have two suspicions: <o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'> 1) [more likely] Some problem with my compiling environment that I could not trace yet, or<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'> 2) Some change on the heap setup for the SPARC BSP between the release 4.10 and the current head of the git repository. I noticed some change on this aspect with the addition of a 'bsp_early_malloc' function that didn't exist on 4.10, but I don't think an error like this wouldn't be noticed previously.<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'><o:p> </o:p></span></pre><pre><span lang=EN-US style='color:black'>Thanks again and best regards,<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'><o:p> </o:p></span></pre><pre><span lang=EN-US style='color:black'>Fabrício.<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'><o:p> </o:p></span></pre><pre><span lang=EN-US style='color:black'><o:p> </o:p></span></pre><pre><span lang=EN-US style='color:black'><o:p> </o:p></span></pre><pre><span lang=EN-US style='color:black'>On 07/25/2014 09:49 PM, Fabrício de Novaes Kucinskis wrote:<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>><i> Hi all,<o:p></o:p></i></span></pre><pre><span lang=EN-US style='color:black'>><i><o:p> </o:p></i></span></pre><pre><span lang=EN-US style='color:black'>><i> <o:p></o:p></i></span></pre><pre><span lang=EN-US style='color:black'>><i><o:p> </o:p></i></span></pre><pre><span lang=EN-US style='color:black'>><i> I’ve recently installed RTEMS 4.11 from the git head and am facing a strange<o:p></o:p></i></span></pre><pre><span lang=EN-US style='color:black'>><i> problem: whenever I use the ‘new’ operator for a C++ application, the<o:p></o:p></i></span></pre><pre><span lang=EN-US style='color:black'>><i> application crashes.<o:p></o:p></i></span></pre><pre><span lang=EN-US style='color:black'><o:p> </o:p></span></pre><pre><span lang=EN-US style='color:black'>What do you mean with crash?<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'><o:p> </o:p></span></pre><pre><span lang=EN-US style='color:black'>><i><o:p> </o:p></i></span></pre><pre><span lang=EN-US style='color:black'>><i> <o:p></o:p></i></span></pre><pre><span lang=EN-US style='color:black'>><i><o:p> </o:p></i></span></pre><pre><span lang=EN-US style='color:black'>><i> If, for instance, I have a printk instruction some lines before calling<o:p></o:p></i></span></pre><pre><span lang=EN-US style='color:black'>><i> ‘new’ (as “int *a = new int[10];”), there is no output. It seems that the<o:p></o:p></i></span></pre><pre><span lang=EN-US style='color:black'>><i> addition of ‘new’ is forcing the link to some C++ library that is not ok<o:p></o:p></i></span></pre><pre><span lang=EN-US style='color:black'>><i> working well.<o:p></o:p></i></span></pre><pre><span lang=EN-US style='color:black'><o:p> </o:p></span></pre><pre><span lang=EN-US style='color:black'>I would follow the printk() call and figure out why there is no output.<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'><o:p> </o:p></span></pre><pre><span lang=EN-US style='color:black'>><i><o:p> </o:p></i></span></pre><pre><span lang=EN-US style='color:black'>><i> <o:p></o:p></i></span></pre><pre><span lang=EN-US style='color:black'>><i><o:p> </o:p></i></span></pre><pre><span lang=EN-US style='color:black'>><i> I’m using the SIS BSP, and this example works fine with RTEMS 4.10 (note:<o:p></o:p></i></span></pre><pre><span lang=EN-US style='color:black'>><i> RTEMS 4.10 and 4.11 are installed in different computers).<o:p></o:p></i></span></pre><pre><span lang=EN-US style='color:black'>><i><o:p> </o:p></i></span></pre><pre><span lang=EN-US style='color:black'>><i> <o:p></o:p></i></span></pre><pre><span lang=EN-US style='color:black'>><i><o:p> </o:p></i></span></pre><pre><span lang=EN-US style='color:black'>><i> I’m feeling dumb right now for not having any idea about what is going on.<o:p></o:p></i></span></pre><pre><span lang=EN-US style='color:black'>><i> Any tips?<o:p></o:p></i></span></pre><pre><span lang=EN-US style='color:black'><o:p> </o:p></span></pre><pre><span lang=EN-US style='color:black'>It helps if you provide a self contained example that reproduces the <o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>problem.<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'><o:p> </o:p></span></pre><pre><span lang=EN-US style='color:black'>-- <o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>Sebastian Huber, embedded brains GmbH<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'><o:p> </o:p></span></pre><pre><span lang=EN-US style='color:black'>Address : Dornierstr. 4, D-82178 Puchheim, Germany<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>Phone : +49 89 189 47 41-16<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>Fax : +49 89 189 47 41-09<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>E-Mail : </span><span style='color:black'><a href="http://lists.rtems.org/mailman/listinfo/users"><span lang=EN-US>sebastian.huber at embedded-brains.de</span></a></span><span lang=EN-US style='color:black'><o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>PGP : Public key available on request.<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'><o:p> </o:p></span></pre><pre><span lang=EN-US style='color:black'>Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.<o:p></o:p></span></pre><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p></div>
<br /><br />
<hr style='border:none; color:#909090; background-color:#B0B0B0; height: 1px; width: 99%;' />
<table style='border-collapse:collapse;border:none;'>
<tr>
<td style='border:none;padding:0px 15px 0px 8px'>
<a href="http://www.avast.com/">
<img border=0 src="http://static.avast.com/emails/avast-mail-stamp.png" />
</a>
</td>
<td>
<p style='color:#3d4d5a; font-family:"Calibri","Verdana","Arial","Helvetica"; font-size:12pt;'>
Este email está limpo de vírus e malwares porque a proteção do <a href="http://www.avast.com/">avast! Antivírus</a> está ativa.
</p>
</td>
</tr>
</table>
<br />
</body></html>