rgoel / optiboot

Automatically exported from code.google.com/p/optiboot
0 stars 0 forks source link

Content of AVR_FREQ gets messed up --> F_CPU set to invalid characters (random?) #106

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Setting the variable "AVR_FREQ" as a command line parameter for make causes 
madness.

E.g. "make atmega168" works, whereas "make atmega168 AVR_FREQ=16000000L" 
doesn't.

AVR_FREQ should end up in F_CPU, but along the way it gets mangled somehow. 
Each and every time "make... AVR_FREQ=..." is run, the value of F_CPU is 
different.

Suffice to say avr-gcc doesn't like it.

openSUSE 13.1 (make-3.82-160.2.1.x86_64), using the tool-chain that comes with 
Arduino-IDE 1.0.5

Original issue reported on code.google.com by madworm_...@spitzenpfeil.org on 11 Jun 2014 at 8:56

Attachments:

GoogleCodeExporter commented 8 years ago
I've tried to compile on an older Debian system (squeeze), but the corruption 
of F_CPU is the same there. Setting AVR_FREQ as command line parameter is not 
good.

Interestingly, if you replace (Makefile line 115):

override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) -DF_CPU=$(AVR_FREQ) 
$(DEFS) 

with something like this:

override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) 
-DF_CPU=$(SOMETHING_ELSE) $(DEFS)

and run:

make atmega168 SOMETHING_ELSE=16000000L

it works just fine.

So it seems that something corrupts AVR_FREQ before it is put into F_CPU.

Original comment by madworm_...@spitzenpfeil.org on 11 Jun 2014 at 9:09

GoogleCodeExporter commented 8 years ago
OK, this is really odd.

Replacing ALL instances of "AVR_FREQ ?= ..." with "AVR_FREQ = ..." fixes the 
corruption problem. Of course this defeats using default values.

Original comment by madworm_...@spitzenpfeil.org on 11 Jun 2014 at 9:39

GoogleCodeExporter commented 8 years ago
The version of optiboot that is distributed with the arduino IDE 1.0.5 doesn't 
have any of the "?=" assignments.

Original comment by madworm_...@spitzenpfeil.org on 11 Jun 2014 at 10:13

GoogleCodeExporter commented 8 years ago
The optiboot distributed with the IDE hasn't been changed since 4.4 (the 
initial "fixed" optiboot) because most of the changes since then have been 
irrelevant to the actual arduino platforms.

This does seem really weird.

(Duplicated with ubuntu 12.04.  Does not occur when using "remake" (my favorite 
makefile debugging tool.)  Sigh.)

Original comment by wes...@gmail.com on 12 Jun 2014 at 3:23

GoogleCodeExporter commented 8 years ago
I get the same nonsense with "remake-3.82_0.8-1.5.x86_64" (openSUSE).

However, on my Debian squeeze VPS "remake 3.81+dbg0.2~dfsg.1-1" works, "make 
3.81-8" doesn't.

Original comment by madworm_...@spitzenpfeil.org on 12 Jun 2014 at 5:21

GoogleCodeExporter commented 8 years ago
Hmmm.

This doesn't work: 

"make atmega644p AVR_FREQ=..."

But this does:

"AVR_FREQ=... make atmega644p"

Original comment by madworm_...@spitzenpfeil.org on 12 Jun 2014 at 5:36

GoogleCodeExporter commented 8 years ago
http://savannah.gnu.org/bugs/?34806 mentions this as "fixed", back in 2011.  
Unfortunately, "everyone" seems to still distribute 3.81 or so (from 2006.) 
(Sigh.)

Original comment by wes...@gmail.com on 28 Jun 2014 at 9:37

GoogleCodeExporter commented 8 years ago
Hmmm. I've filed a bug with my distro of choice. Maybe someone there will show 
an interest.

Original comment by madworm_...@spitzenpfeil.org on 28 Jun 2014 at 10:06

GoogleCodeExporter commented 8 years ago
Well, I got a response on the bug-tracker. They're asking what packages of the 
distro are affected by this... I have a gut feeling I know where this is going.

Original comment by madworm_...@spitzenpfeil.org on 16 Jul 2014 at 4:01