[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] ATMega8 Support?
From: |
Michael Tsao |
Subject: |
Re: [avr-gcc-list] ATMega8 Support? |
Date: |
Mon, 20 May 2002 10:24:38 -0700 |
Is the ATMega8 supported yet?
Building for the '163 mostly works. Just change the MCU switch in your
makefile to specify the '163 and do a clean build of your project. However,
interrupts won't work (except for INT0, which happens to be at the right
place in the mega8's vector table).
If you want your interrupt vector table to be correct, you have to do some
minor surgery:
1. Find the iom163.h and iom8.h header files. These should have come with
the source distribution you already have; if you're missing iom8.h, get it
in the latest source distribution, which has it (I used avr-libc-20020203).
2. Modify iom163.h as follows:
i. Change FLASHEND from 3fff to 1fff.
ii. Copy the interrupt macros (the list mapping things like
SIG_INTERRUPT1 to _vector_2) from iom8.h to iom163.h, replacing the one
already in iom163.h. You probably also should have made a backup copy of the
original iom163.h. If you can't find _vector_xxx in your header file, then
the version of libc that you have is too old.
iii. Copy the vector table descriptors from iom8.h to iom163.h, replacing
the ones already in iom163.h:
#define END_VECTOR (18)
#define INT_VECT_SIZE (0x26)
3. cd to the root directory of your libc source distribution.
4. Make clean, make, then make install (in other words, follow the same
steps you followed when you first acquired libc for avr).
5. Rebuild your project (be sure to clean first). At this point, you should
have a .hex file that gcc/libc *thinks* was built for the '163 but that has
an interrupt vector table for the '8.
6. If you want to make sure that the project built correctly, open the .hex
file in AVR Studio and verify that the vector table at the beginning of the
file is composed of RJMP (relative jump) instructions and not JMP (absolute
jump) instructions. Or make sure that the table is aligned on single-word
boundaries, not double-word boundaries.
Good luck.
P.S. If anyone else knows of reasons why this bastardized code won't work
properly for the mega8, please let the list know -- it'll save the rest of
us some debugging time until gcc/libc for the mega8 comes out.
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
avr-gcc-list at http://avr1.org