WinAVR20080610 Bugs

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've been gone a while but now I'm back and writing code again. I've started running the latest 20080610 version and noticed two things:

The BSS bug is still there. This happens when you place code near the end of the memory area. The fix for this was suggested a while back and it works fine. I would just like to see this added into the next release:

In the script avr5.x the BSS line should read:

.bss SIZEOF(.data) + ADDR(.data) : AT (ADDR (.bss) )

The other thing I've noticed is that my bootloader (via UART) is extremely slow when I run it on an AT90CAN128 while it runs fine on an ATMEGA1281. If I downgrade to WinAVR20071221, it runs fine on the CAN128 also.

Before my absence, I was using WinAVR20080402rc1 and I don't remember having this issue. I unfortunately do not have this version anymore.

Is there a location where I can get this unreleased version along with the later builds (i.e. WinAVR200805xx) such that I can try to track down at which point this effect started and thus narrow down where the bug is?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You do not want the WinAVR 200804xx versions. The two released versions in that time frame had code generation bugs. One was related to saving and restoring registers in an ISR that calls a function, and the other was related to saving and restoring registers in regular functions. These were two different bugs in back to back releases.

The release with the code gen bug for regular functions was pulled and is not available, which I believe was 20080411.

You can find the previous releases on SourceForge.
http://sourceforge.net/projects/winavr/

Select the Download->Browse All Packages link from the menu bar like area at the top

This will show you the single current release.

Now select the WinAVR link on the left hand side under Package, which will show you all of the WinAVR releases.

-Preston

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
The BSS bug is still there
I just filed a bug report with binutils. Maybe it will be taken care of in the default avr linker script.

http://sourceware.org/bugzilla/s...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks regarding the BSS bug.

I found an AVR mirror on the web to get the unreleased versions. That and a look back at my previous posts confirmed that I couldn't get my code to work right with the 20080402 or the 20080411 versions due to issues with compiled code.

This means that there is still an issue remaining with the integration of GCC 4.3.0 since WinAVR20071221 which causes my code to malfunction.

Unfortunately for me, it won't be easy to track this one down since the code does function starting with 20080402, it's just really really slow.

I'll start with checking if it's still related to possible incorrect inlining that I had noticed in 20080411.

Eric (EW), did you get a chance to look into the code I had sent you back in April? Did you find the issue?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK, I just confirmed that it is in fact related to the incorrect inlining I noticed back in April.

Thanks and cudos to losmirkos over at sourceforge who had more time than me and found the root cause (Bug #2138490). If I use O1 to compile my code, it works! Of course my code is 15% larger and I can't fit my bootloader in the chip now. :-(

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Have you tried the -fno-inline-small-functions compiler option?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, I've tried that and it doesn't work. I think the optimizer levels override that option somehow.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Looks like the .bss problem is now handled (that was fast). It appears to me (not that I really understand what's happening in the binutils world), that the linker script template (avr.sc) will no longer set the VMA for the .bss and .init sections (which were previously set and based on the previous section adrress and size). Since these sections are already in order and go into the same memory region (data), the VMA's will take care of themselves, and were never really needed (I think). The .bss section will now be assigned an LMA which is equal to its VMA (and also do the same for .noinit since it follows .bss), which will take care of the problem 2.18 created.

Eventually it will 'filter' on down to WinAVR for those of us using that. Until that time, a simple edit of the linker scripts will take care of the problem (for the few that will see the problem).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is there any way of forcing off inlining in optimizations O2 and above? I've tried the fno-inline-small-functions but that doesn't seem to work. Can someone confirm that O2 and above override this switch?

I'm referring again to this bug:

http://sourceforge.net/tracker/i...

Alternatively if there is any workaround for this, that would work too. :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The -f should over-ride the -O I believe but it'll probably be important that it comes AFTER the -O on the command line (I *think*!)