[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-dev] [bug #17561] headers returning PORTx, PINx and DDRx incor
From: |
Scott Price |
Subject: |
[avr-libc-dev] [bug #17561] headers returning PORTx, PINx and DDRx incorrectly for Mega168 |
Date: |
Mon, 28 Aug 2006 20:17:10 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.0.5) Gecko/20060821 Firefox/1.5.0.5 |
URL:
<http://savannah.nongnu.org/bugs/?17561>
Summary: headers returning PORTx, PINx and DDRx incorrectly
for Mega168
Project: AVR C Runtime Library
Submitted by: scottprice
Submitted on: Monday 08/28/2006 at 20:17
Category: Header
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Percent Complete: 0%
Originator Email: address@hidden
Open/Closed: Open
_______________________________________________________
Details:
If I compile this:
void
test(void) {
PINB = 0;
PORTB = 0;
DDRB = 0;
PINC = 0;
PORTC = 0;
DDRC = 0;
PIND = 0;
PORTD = 0;
DDRD = 0;
}
Using this command line:
avr-gcc -mmcu=atmega168 -D_01_ -Os -Wall -fpack-struct
-fdollars-in-identifiers -ffunction-sections -DVERSION=00 -DVERSIONSMALL=00
-DVERSIONTINY=04 -c test.c -o test.o
I get:
00000000 <test>:
0: 13 b8 out 0x03, r1 ; 3
2: 15 b8 out 0x05, r1 ; 5
4: 14 b8 out 0x04, r1 ; 4
6: 16 b8 out 0x06, r1 ; 6
8: 18 b8 out 0x08, r1 ; 8
a: 17 b8 out 0x07, r1 ; 7
c: 19 b8 out 0x09, r1 ; 9
e: 1b b8 out 0x0b, r1 ; 11
10: 1a b8 out 0x0a, r1 ; 10
12: 08 95 ret
According to the datasheet those addresses should be 0x23, 0x24, 0x25... I
get absolutely nothing when I try to use PORTB, etc, but it works if I use
the direct address in the datashet.
It seems to be something in sfr_defs.h, but I am having trouble following
that file. I will keep looking at it to see if I can find the problem.
My compiler and assembler are:
address@hidden /usr/avr/include/avr]% avr-gcc --version
avr-gcc (GCC) 4.1.1 (Gentoo 4.1.1)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
address@hidden /usr/avr/include/avr]% avr-as --version
GNU assembler 2.17.50.0.3 20060715
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License. This program has absolutely no warranty.
This assembler was configured for a target of `avr'.
I am using AVR-libc version 1.4.4
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/bugs/?17561>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
- [avr-libc-dev] [bug #17561] headers returning PORTx, PINx and DDRx incorrectly for Mega168,
Scott Price <=