Gentoo Archives: gentoo-embedded

From: Jean-Marc Beaune <jm.beaune@×××××.com>
To: gentoo-embedded@l.g.o
Subject: [gentoo-embedded] Atmega issue since reinstallation of cross-avr/gcc
Date: Mon, 24 Oct 2011 19:42:08
Message-Id: CAK7bL3ym8MsJ7wbHDC28a03A8Rkui0zbhvVCW6Qa05pAUgMfLQ@mail.gmail.com
1 Hi,
2
3 Not easy to explain but I'll gi ve a go.
4
5 I programed an atmega328p to read temperature and send it via USART. That
6 worked fine untill I changed my laptop.
7
8 After changing my computer (and therefore reinstalling cross-avr/gcc), then
9 a part of a function used to read the temperature doesn't work anymore, i.e.
10 it compiles fine but the atmega doesn't send anything via USART, the program
11 dumps.
12
13 I narrowed down the problem and it seems to be a problem when doing some
14 calculation in a function:
15
16 All variables below are declared as uint8_t
17
18 The return statement below causes the program to crash:
19 return (double) temp_LSB - 0.25 + (double)(count_per_c - count_remain) /
20 count_per_c;
21
22 The return statement below causes the program to crash also:
23 return (double) temp_LSB - 0.25;
24
25 The return statement below is OK:
26 return (double)(count_per_c - count_remain) / count_per_c;
27
28 Since it coincides with a change of computer used to compile the program I
29 wonder if it could be a missing flag/option for cross-avr/gcc?
30
31 Any advice appriciated,
32 Thank you
33
34 --
35 Jean-Marc