avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Releasing an installer of avrgcc3.2 on AVRfreaks.net


From: Peter Bosscha
Subject: Re: [avr-gcc-list] Releasing an installer of avrgcc3.2 on AVRfreaks.net
Date: Tue, 25 Jun 2002 14:30:02 +0200

(Sorry about the length, then again, I always think it's good to share
..)

All of the below comments are based on current (14 Dec 2001) win32
release on AvrFreaks.
The listed problems are the ones I encountered whilst working on
MEGA128:

------------------

1 Watchdog (wdt.h) does not work as per current Avrfreaks release, in
other words:
If your new release has the same wdt.h then it won't work for MEGA128
(don't know about other MEGA's)

2 Floating Point library (libm) does not work if loaded above 64K, this
because it uses LPM instructions for tables which are also loaded above
64K.

3. There's a bug in AVRGCC when you have a lot of local variables (R28
register gets overwritten), this combined with a sizable piece of code.
(The bug is not easily reproduced.)

4. The __ELPM_enhanced__ macro in "INA90.h" for some reason does not
want to compile. As I recall, some sort of asm error.

5. Be very careful with function pointers to absolute addresses, the
compiler has the habit of halving your address.


------------------

For completeness sake, there are my fixes for this:

1. Write your own wdt.h (nothing much changes):


#define wdt_enable(timeout)                             \
        __asm__ __volatile__ (                          \
                "in __tmp_reg__, __SREG__" "\n\t"       \
                "cli" "\n\t"                            \
                "wdr" "\n\t"                            \
                "out %1, %0" "\n\t"                     \
                "out %1, %0" "\n\t"                     \
                "out __SREG__, __tmp_reg__" "\n\t"      \
                : /* no outputs */                      \
                : "r" ((uint8_t)((timeout) | BV(WDE) |
BV(WDCE))),     \
                  "I" (WDTCR)                           \
                : "r0"                                  \
        )

#define wdt_disable()                                   \
        __asm__ __volatile__ (                          \
                "in __tmp_reg__, __SREG__" "\n\t"       \
                "cli" "\n\t"                            \
                "wdr" "\n\t"                            \
                "out %1, %0" "\n\t"                     \
                "out %1, __zero_reg__" "\n\t"           \
                "out __SREG__, __tmp_reg__"             \
                : /* no outputs */                      \
                : "r" (BV(WDCE) | BV(WDE)),             \
                  "I" (WDTCR)                           \
                : "r0"                                  \
        )



2. Rearrange your linker script so that libm always loads first:

  /* Internal text space or external memory */
  .text :
  {
    *(.init)
    *(.progmem.gcc*)
    *(.progmem*)
    . = ALIGN(2);
    *(.text.*)
    . = ALIGN(2);
    *(.text)
    . = ALIGN(2);
    *(.fini)
     _etext = . ;
  }  > text

(.text.* swaps place with .text)

3. As far as I understand, this one was reported somehwere in February
and was fixed. (on the Linux release)


4. Wrote my own ELPM macro, all I did was change the "v" into "r"


5. Who ever uses these anyway ? I did for a bootloader function, most
people will never encounter this problem.


For the rest it's a nice compiler to work with (very wide grin (what's
the symbol for that?)).
Seriously though, we have an application running on MEGA128, currently
about 80K big, which is working fine. You simply have to be aware of the
curve balls that the compiler can throw you..

I would suggest it's better to apply these changes to the original
releases (not the AVRfreaks build only)
Comments are welcome.

Regards,

Peter




>>> "address@hidden" <address@hidden> 06/25/02
10:58AM >>>
Hi all,
I would just like to commend Tony (and Marc) on the successful minGW
build.
They did what we all couldn't :-)
Anyway, I have packaged a ready-to-run version into a 11MB
self-installer
package and plan to put it up on Freaks.
Just wondering; is there a "best way" to get the confirmed part support
for
this release?
It compiles successfully for mega128 and mega8 at least...but what
else?

Comments are welcome!

        Eivind



avr-gcc-list at http://avr1.org 

avr-gcc-list at http://avr1.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]