[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] Re: Patch for Win32 build of avr-gcc to support ATMega128
From: |
Matthias Lange |
Subject: |
[avr-gcc-list] Re: Patch for Win32 build of avr-gcc to support ATMega128 |
Date: |
Fri, 18 Jan 2002 14:12:51 +0100 |
Anton Erasmus wrote:
>
> Hi,
>
> It seems that quite a number of people are interested in compiling
> for the ATMega128 without having to build the avr-gcc binaries with
> proper ATMega128 support for themselves.
>
> Attached is a zip file with the modified files I use to compile code
> for the ATMega128 as well as a small example that shows using
> the inp and outp macros to access ATMega128 I/O registers that
> cannot be accessed with the "in" and "out" instructions.
>
> The make1 and make2 files are modified versions of the Volker Oth
> originals. These should be copied to avrgcc/include.
> mk128 is the make file to make the example. Use make -fmk128
> or use cc.bat.
> m128test.c is the example c file.
> iomacros.h is a modified version of the standard iomacros.h files.
> This should be copied to avrgcc/avr/include.
> Only the inp and outp macros have been modified.
> crtm128.o is the startup object file for the ATMega128. This is
> assembled from the gcrt1.s file using the make file m128_crt.
> ldscript.x is the linker script modified for the ATMega128. It also
> adds a section "batram" which is external memory from 0x1100 to
> 0x7FFF. This section is not initialised by the startup file. Hence
> suitable for battery backed RAM. See the example C file on how to
> declare a variable in this section.
>
> Remember that the ATMega128 as shipped is in ATmega103
> mode. One has to update the fuses to get it to run in ATMega128
> mode.
>
> I see no reason why these patches would not work for a Linux build
> of avr-gcc.
>
> Regards
> Anton Erasmus
Hi Anton,
I got it working, on Linux, thanks a lot !
This is my configuration :
binutils-2.11.2
gcc-3.0.2
avr-libc-20020115
I am using your crtm128.o, iomacros.h and the setting MCU = atmega128 in
my makefile.
In addition I made some changes to the iom128.h file to get
compatibility with my atmega103 sources.
I did some changes to your iomacros.h too:
- cbi, sbi, bit_is_clear and bit_is_set are now working on PORTG too
- I added outw() and inw() macros to access the extended 16Bit registers
like TCNT3L/H
I am not sure if this is the best way and if it works on all MCUs. But
anyway I have attached these files. Perhaps its useful for somebody else
too.
Best regards
-Matthias Lange
iom128.zip
Description: Zip compressed data