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.htmlThe 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.