From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org)
	by finch.gentoo.org with esmtp (Exim 4.60)
	(envelope-from <gentoo-embedded+bounces-4080-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1RIQPQ-00051n-8v
	for garchives@archives.gentoo.org; Mon, 24 Oct 2011 19:42:08 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 0829121C044;
	Mon, 24 Oct 2011 19:41:55 +0000 (UTC)
Received: from mail-iy0-f181.google.com (mail-iy0-f181.google.com [209.85.210.181])
	by pigeon.gentoo.org (Postfix) with ESMTP id 09E9D21C033
	for <gentoo-embedded@lists.gentoo.org>; Mon, 24 Oct 2011 19:41:42 +0000 (UTC)
Received: by iahk25 with SMTP id k25so10316239iah.40
        for <gentoo-embedded@lists.gentoo.org>; Mon, 24 Oct 2011 12:41:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=mime-version:date:message-id:subject:from:to:content-type;
        bh=TQYZhbvgAdNIJ0HBXl5OljbErWANXjOFVWZwAMoa1aU=;
        b=b5+9sbNOaqhI1oe37E4Ih380pc+o7Y7am4BcAnPvugq3SMX/dT1GoR3CbkaTB/nroJ
         EZf7Ybwne3z6RV9Ovk8hapxpqtquLk0DWRa2npJ/Vr82spRkmdlGAAkTX8R7uT/IdNoZ
         85iFn5/UbnuqE/MeXBtz6412ysePyt6Xbdrj4=
Precedence: bulk
List-Post: <mailto:gentoo-embedded@lists.gentoo.org>
List-Help: <mailto:gentoo-embedded+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-embedded+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-embedded+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-embedded.gentoo.org>
X-BeenThere: gentoo-embedded@lists.gentoo.org
Reply-to: gentoo-embedded@lists.gentoo.org
MIME-Version: 1.0
Received: by 10.42.155.70 with SMTP id t6mr2902617icw.38.1319485302464; Mon,
 24 Oct 2011 12:41:42 -0700 (PDT)
Received: by 10.42.167.4 with HTTP; Mon, 24 Oct 2011 12:41:42 -0700 (PDT)
Date: Mon, 24 Oct 2011 21:41:42 +0200
Message-ID: <CAK7bL3ym8MsJ7wbHDC28a03A8Rkui0zbhvVCW6Qa05pAUgMfLQ@mail.gmail.com>
Subject: [gentoo-embedded] Atmega issue since reinstallation of cross-avr/gcc
From: Jean-Marc Beaune <jm.beaune@gmail.com>
To: gentoo-embedded@lists.gentoo.org
Content-Type: multipart/alternative; boundary=90e6ba1eff4abd5f4704b0109c3c
X-Archives-Salt: 
X-Archives-Hash: d688aff991ee0f64e5f744d6f7997087

--90e6ba1eff4abd5f4704b0109c3c
Content-Type: text/plain; charset=ISO-8859-1

Hi,

Not easy to explain but I'll gi ve a go.

I programed an atmega328p to read temperature and send it via USART. That
worked fine untill I changed my laptop.

After changing my computer (and therefore reinstalling cross-avr/gcc), then
a part of a function used to read the temperature doesn't work anymore, i.e.
it compiles fine but the atmega doesn't send anything via USART, the program
dumps.

I narrowed down the problem and it seems to be a problem when doing some
calculation in a function:

All variables below are declared as uint8_t

The return statement below causes the program to crash:
return (double) temp_LSB - 0.25 + (double)(count_per_c - count_remain) /
count_per_c;

The return statement below causes the program to crash also:
return (double) temp_LSB - 0.25;

The return statement below is OK:
return  (double)(count_per_c - count_remain) / count_per_c;

Since it coincides with a change of computer used to compile the program I
wonder if it could be a missing flag/option for cross-avr/gcc?

Any advice appriciated,
Thank you

-- 
Jean-Marc

--90e6ba1eff4abd5f4704b0109c3c
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi,<div><br></div><div>Not easy to explain but I&#39;ll gi ve a go.</div><d=
iv><br></div><div>I programed an atmega328p to read temperature and send it=
 via USART. That worked fine untill I changed my laptop.</div><div><br></di=
v>
<div>After changing my computer (and therefore reinstalling cross-avr/gcc),=
 then a part of a function used to read the temperature doesn&#39;t work an=
ymore, i.e. it compiles fine but the atmega doesn&#39;t send anything via U=
SART, the program dumps.</div>
<div><br></div><div>I narrowed down the problem and it seems to be a proble=
m when doing some calculation in a function:</div><div><br></div><div>All v=
ariables below are declared as uint8_t</div><div><br></div><div><div>The re=
turn statement below causes the program to crash:</div>
<div>return (double) temp_LSB - 0.25 + (double)(count_per_c - count_remain)=
 / count_per_c;</div><div><br></div><div>The return statement below causes =
the program to crash also:</div><div>return (double) temp_LSB - 0.25;</div>
<div><br></div><div>The return statement below is OK:</div><div>return =A0(=
double)(count_per_c - count_remain) / count_per_c;</div><div><br></div><div=
>Since it coincides with a change of computer used to compile the program I=
 wonder if it could be a missing flag/option for cross-avr/gcc?</div>
<div><br></div><div>Any advice appriciated,</div><div>Thank you</div><div><=
br></div>-- <br>Jean-Marc<br>
</div>

--90e6ba1eff4abd5f4704b0109c3c--