Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: compiling at91bootstrap v1.16 with gcc 4.6.x fails
PostPosted: Mon Jan 16, 2012 11:12 am 
Offline

Joined: Thu Oct 13, 2011 2:57 pm
Posts: 3
We are using ptxdist [1] and the OSELAS toolchains for building Linux and the software around it for our embedded target, which is a at91sam9g20 on a board similar (not identical) to the ek board. Compiling the at91bootstrap with the 2011.03.1 toolchain including gcc 4.5.2, glibc 2.13 and binutils 2.21 worked fine. After upgrading to OSELAS toolchain 2011.11.0 with gcc 4.6.2, glibc 2.14.1 and binutils 2.21.1a building at91bootstrap fails with the following error:

Quote:
-gnueabi/bin/ld: section .text.startup loaded at [00200ff4,00201033] overlaps section .data loaded at [00200ff4,00201127]
collect2: ld returned 1 exit status


While compiling works, the linker seems to have a problem. I searched the web and only found this:

http://lists.busybox.net/pipermail/buil ... 43505.html

No answer with solution, not very helpful so far.

Has anybody experienced similar problems here and already got a solution or at least a hint how to solve this issue? Maybe a patch I didn't find?

Greets

[1] http://www.ptxdist.org/


Top
 Profile  
 
 Post subject: Re: compiling at91bootstrap v1.16 with gcc 4.6.x fails
PostPosted: Thu Jan 19, 2012 8:57 pm 
Offline

Joined: Wed Jan 18, 2012 10:20 pm
Posts: 13
I just started trying to compile this project and have encountered the same error. My toolchain is a little different than yours (I'm using YAGARTO), and I'm compiling for a different board (the at91sam9m10g45ek).

I haven't figured out how to make this problem go away yet...just figured I'd let you know that you're not alone. If you've already managed to come by a solution, could you post some hint at how you fixed it here? Otherwise I will try to update whatever I find as a workaround later.

Thanks.


Top
 Profile  
 
 Post subject: Re: compiling at91bootstrap v1.16 with gcc 4.6.x fails
PostPosted: Fri Jan 20, 2012 12:27 am 
Offline

Joined: Wed Jan 18, 2012 10:20 pm
Posts: 13
Quote:
While compiling works, the linker seems to have a problem. I searched the web and only found this:
http://lists.busybox.net/pipermail/buil%20...%2043505.html

The comment on the Web site you refer to says:
Quote:
Note that Atmel is working on a newer AT91Bootstrap version, available
as part of their Android4Sam initiative. This version, labeled "3" is
available at
ftp://ftp.linux4sam.org/pub/Android4SAM/9m10g45/v1.1/patches/bootstrap30.tar.gz.

I noticed some "3" versions of the Bootstrap on the Linux4Sam site before, but really didn't know what to make of them. They looked a bit like works-in-progress, so I figured I would stick with the oft-mentioned (and I assumed reliable) v. 1.16.

After the "overlap" linker error that we both experienced, I decided to download the "3" patch from the FTP link above. I just wanted to compare the two projects so that I could at least get v. 1.16 up and running. I concentrated on the "elf32-littlearm.lds" file, as this is where I figured the memory mapping specifications for .text and .data would reside. Modifiying this file, I definitely got things working...I was able to replace the original Linux4Sam AT91 bootstrap file with mine, load it to the board, and actually boot into Linux. I call that a success.

I'll step through what I did in a little more detail. First, I compiled the v. 1.16 bootstrap project and waited for the "overlap" error to appear again. This build does generate a .map file, which I set aside. Then I modified the "elf32-littlearm.lds" file with some code from the "3" patch .lds file. I compiled the v. 1.16 bootstrap with this modification. Next, I diff'd the .map files. No surprise, these files were different. There isn't a huge difference in these files, but I will highlight what I think were the most important items.

The .map file generated with the ORIGINAL v. 1.16 bootstrap project looked like this:
Code:
.text.startup   0x00301114       0x28
.text.startup  0x00301114       0x28 main.o
                0x00301114                main
.data           0x0030113c       0xdc load address 0x00301114

The .map file generated with the MODIFIED v. 1.16 bootstrap project looked like this:
Code:
.text.startup   0x00301114       0x28
.text.startup  0x00301114       0x28 main.o
                0x00301114                main
                0x0030113c                . = ALIGN (0x4)
.dummy          0x0030113c        0x0
                0x0030113c                _edummy = .

.data           0x0030113c       0xdc

The original output file generated .text.startup code at location 0x00301114, which happened to be a location greater than 0x0030113c, where the .data section started. Hence the overlap. The modified code realigned the .text.startup code into location 0x0030113c, eliminating the overlap.

Here is what I did to the .lds file:

I added this (just before the .data section:
Code:
   
. = ALIGN(4);
   .dummy : {
      _edummy = .;
   }


And I modified the .data section like this (just replaced the data location) :
Code:
   .data : AT (LOADADDR(.dummy)) {
      _sdata = .;
      *(.vectors)
      *(.data)
      _edata = .;
   }

As I've said, all of this seems to work just fine. However, I haven't really done much with .lds files before...I knew they existed, but I'm taking baby steps into the world of ARM development, so this was something new for me to work with. Someone else may say that I should have modified the v. 1.16 .lds file differently, or that I should not have modified it at all. I am definitely open to insight and suggestions. From the way it sounds, though, gcc 4.6.2 seems to want this file modified.


Top
 Profile  
 
 Post subject: Re: compiling at91bootstrap v1.16 with gcc 4.6.x fails
PostPosted: Fri Jan 20, 2012 5:49 pm 
Offline

Joined: Thu Oct 13, 2011 2:57 pm
Posts: 3
I integrated this in my project and it compiles again. I didn't have time yet to test it on the target hardware, will try this next week. Thank you so far! :)


Top
 Profile  
 
 Post subject: Re: compiling at91bootstrap v1.16 with gcc 4.6.x fails
PostPosted: Thu Jan 26, 2012 5:14 pm 
Offline

Joined: Thu Oct 13, 2011 2:57 pm
Posts: 3
Had this tested now and it works, at least my target boots. I'll paste the patch, because uploading does not work because .patch, .diff and even .txt are no allowed file extensions for this board.

Code:
circumvent gcc 4.6.x linker overlap error, suggestion from AT91 forum at
http://www.at91.com/forum/viewtopic.php/f,12/t,20624/
---
elf32-littlearm.lds |    6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

Index: Bootstrap-v1.16/elf32-littlearm.lds
===================================================================
--- Bootstrap-v1.16.orig/elf32-littlearm.lds
+++ Bootstrap-v1.16/elf32-littlearm.lds
@@ -14,7 +14,11 @@
   }

   /* collect all initialized .data sections */
-   .data : AT ( ADDR (.text) + SIZEOF (.text) ) {
+    . = ALIGN(4);
+    .dummy : {
+        _edummy = .;
+    }
+   .data : AT ( LOADADDR(.dummy) ) {
      _sdata = .;
      *(.vectors)
      *(.data)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: