[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-dev] io.h re-org
From: |
Theodore A. Roth |
Subject: |
[avr-libc-dev] io.h re-org |
Date: |
Thu, 12 Dec 2002 10:36:05 -0800 (PST) |
On Thu, 12 Dec 2002, Joerg Wunsch wrote:
:) As Joerg Wunsch wrote:
:)
:) > > Ultimately, yes. I'd say go ahead and move SREG, SPL and SPH now since
:) > > that is a relatively simple change.
:) >
:) > SPL/SPH is not present on avr1 architecture devices, but that is easy
:) > to handle. There are some devices (with only 256 bytes of SRAM) that
:) > don't support SPH (2313, 2323, 2343, tiny22, tiny26), but i guess
:) > nothing bad will happen when attempting to write to the respective
:) > non-register. Hopefully, the non-present SPH will read out as 0,
:) > otherwise malloc() might run into troubles anyway... We can easily
:) > #define all the common registers first in <avr/io.h>, and then divert
:) > to the MCU-specific <avr/ioXXX.h> which can #undefine SPH so the
:) > application won't see the wrong register name. Some of the headers
:) > are even wrong here, e. g. the 2333 has only 128 bytes of SRAM and
:) > thus no SPH, but the header file declares it anyway...
:) >
:) > MCUCR is only missing in tiny28 and at94k.
:) >
:) > WDTCR is only missing in AT90C8534 (an almost unknown device anyway).
:) > Pah. Does the tiny28 really have a different location for WDTCR, or
:) > is this an error in the header file (0x01 vs. 0x21, looks pretty damn
:) > like _SFR_OFFSET). Gotta look into that datasheet...
:) >
:) > XL/XH/YL/YH are only missing in avr1 architectures, easy to catch.
:) >
:) > ZL/ZH is present in all devices.
:)
:) I left out WDTCR since it's not all that common.
:)
:) However, i noticed i had to pull in the EEPROM definitions in order to
:) get eeprom.S assembled using an `anonymous' -mmcu option. This made
:) it apparent that the existing EEPROM library will not work with the
:) ATmega169 since that device uses different IO port locations. Good to
:) know at least.
:)
:) Here's the diff.
The patch looks good, but it's too much at once. My plan (when I got
around to it) was to do something similar but in small, incremental steps.
It's a pain, but it makes review much easier. It's not much fun trying to
review a 2500 line diff and grok everything it does. ;-)
I'd break the patch up as such:
- move #include <avr/sfr_defs.h> from ioXXXX.h to io.h
- move sreg
- move SP
- move X, Y, Z pointers
- move eeprom
- etc.
Also, can you please post the patches with a ChangeLog entry? It's nice to
have an overview of which files were changed and how when reviewing. I've
attached a script which automates generating the diff with changelog entry
template.
Ted Roth
cpatch
Description: Text document