[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] avr-libc-20020602, C++ support, new ld scripts
From: |
Marek Michalkiewicz |
Subject: |
[avr-gcc-list] avr-libc-20020602, C++ support, new ld scripts |
Date: |
Sun, 2 Jun 2002 02:04:21 +0200 (CEST) |
Hi,
I've just committed GCC and binutils changes necessary to support C++
constructors/destructors. Please test with the required new avr-libc:
http://www.amelek.gda.pl/avr/test/avr-libc-20020601.tar.gz
This avr-libc won't work with any older GCC/binutils - latest sources
from CVS are required. Note that if you install the latest binutils,
old (3.0.x, 3.1.x) versions of GCC will still work as they use the old
(unchanged) ld scripts - this means you can have the latest binutils,
and only switch avr-gcc+avr-libc versions at the same time.
Note that gcrt1.S is completely rewritten. Some old features may be
missing, but it is now more flexible with the new .init0 ... .init9
and .fini9 ... .fini0 sections. For example, link your application
with the following small asm file to enable the WDT right after reset:
=== begin wdt.S
/* avr-gcc -mmcu=... -x assembler-with-cpp -c wdt.S -o wdt.o */
#include <io.h>
.section .init1,"ax",@progbits
ldi r16, value_to_load_to_WDTCR
wdr
out _SFR_IO_ADDR(WDTCR), r16
=== end wdt.S
Same goes with MCUCR to enable external SRAM (if any) - must be done
no later than in .init3 because .init4 initializes data and BSS.
Look at comments in /usr/local/avr/lib/ldscripts/* for more details.
Note that if you don't insert any code, startup code will be smaller
than it was before - should help on small chips like the 2313.
One optimization which is not done yet: data and BSS init code could
be omitted (saving code space) if the sections are empty. This is
not yet supported, but shouldn't be hard to add. Basically, GCC now
unconditionally emits the following:
.global __do_copy_data
.global __do_clear_bss
and should do it only if it puts anything in .data and .bss sections,
respectively. The same trick is used to omit __do_global_[cd]tors if
there aren't any C++ con/destructors to call.
Going to sleep now, I expect to see lots of bug reports in my mailbox
after I get up ;)
Happy hacking,
Marek
avr-gcc-list at http://avr1.org
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [avr-gcc-list] avr-libc-20020602, C++ support, new ld scripts,
Marek Michalkiewicz <=