Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

avr-gcc ATMega8 USART trouble, was: Compile problem

2009-12-06 by Marc R.J. Brevoort

Hi,

To answer my own question- it seems like the cause
is a possible bug in the avr-gcc toolset in file

/usr/avr/include/avr/iom8.h

This file states

#define UCSRC	_SFR_IO8(0x20)
#define UBRRH	_SFR_IO8(0x20)

(Twice the same definition for different ports?
Suspicious...)

To make ATmega8 USART functionality work for avr-gcc,
I changed these two lines to the following:

#define UCSRC   _SFR_IO8(0x03)
#define UBRRH   _SFR_IO8(0x02)

After these changes, I can compile my code (which
used to work on ATtiny2313) with -mmcu=atmega8 and
it will work on the ATmega8.

Hope this helps someone!

Best,
Marc

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.