[U-Boot] [PATCH 0/4] Convert MPC85xx platforms to a single linker script

This patch series does $SUBJ.
The first patch changes the way the existing linker scripts locate the boot page, reset vector, and bss section. This method works for any size of u-boot image (the previous one didn't work images that weren't 512K) and any location flash is mapped to.
At this point all the mpc85xx linker scripts are exactly the same, except for one line that defines the flash bank size, so they are combined into one script in cpu/mpc85xx/u-boot.lds. A common flash bank size that will work for all boards is used. If a board in the future needs something different (either very small flash or a very large u-boot), then it can easily be overridden by using a two line board/*/config.mk file that defines the flash bank size and then includes cpu/mpc85xx/u-boot.lds.
The next two patches clean up the common boot script some more.
I imagine there is more cruft in the script still, like the .data.init and .text.init sections that are 256 byte aligned but have nothing in them.

Dear Trent,
In message Pine.LNX.4.64.0810131610000.3399@t2.domain.actdsltmp you wrote:
At this point all the mpc85xx linker scripts are exactly the same, except for one line that defines the flash bank size, so they are combined into one script in cpu/mpc85xx/u-boot.lds. A common flash bank size that will work for all boards is used. If a board in the future needs something different
Umm... This is not how it should be done.
U-Boot should *never* assume static flash bank sizes. The whole design is based on the idea to automatically determine the actual size of flash and RAM that is fit on a specific board, and to auto-adjust for this.
There are many vendors out there who manufacture boards in different memory configurations. For these it is essential that they can use only one U-Boot image on all boards, no matter what the exact memory configuration of this board is.
I am aware that there are ports out there which violate this design principle, but if we touch this area, thenplease only to make more boards conformant, not to make things worse.
Thanks.
Best regards,
Wolfgang Denk

On Tue, 14 Oct 2008, Wolfgang Denk wrote:
Dear Trent,
In message Pine.LNX.4.64.0810131610000.3399@t2.domain.actdsltmp you wrote:
At this point all the mpc85xx linker scripts are exactly the same, except for one line that defines the flash bank size, so they are combined into one script in cpu/mpc85xx/u-boot.lds. A common flash bank size that will work for all boards is used. If a board in the future needs something different
Umm... This is not how it should be done.
U-Boot should *never* assume static flash bank sizes. The whole design is based on the idea to automatically determine the actual size of flash and RAM that is fit on a specific board, and to auto-adjust for this.
The bank size here is only used for linking u-boot. The actual u-boot code is no different that it is now.
In order to boot on mpc85xx, the u-boot image must be linked to locate the boot page as the last page in the flash bank. There is no way to do this at run time, it's the boot page. All existing 85xx platforms hard code the location of the boot page in the u-boot image one way or another. I'm just changing the linker script to do it in a way where the same script will work on all 85xx boards.
Right now changing the u-boot image size and/or the boot flash bank mapping requires changes to the linker script. Since not all boards have the same image size and/or flash bank mapping, they can't use the same script.

Dear Trent Piepho,
In message Pine.LNX.4.64.0810131647450.3399@t2.domain.actdsltmp you wrote:
U-Boot should *never* assume static flash bank sizes. The whole design is based on the idea to automatically determine the actual size of flash and RAM that is fit on a specific board, and to auto-adjust for this.
The bank size here is only used for linking u-boot. The actual u-boot code is no different that it is now.
How is this expected to work if the flash bank size used to link the u-boot image is different from the real flash bank size present on the board?
In order to boot on mpc85xx, the u-boot image must be linked to locate the boot page as the last page in the flash bank. There is no way to do this at run time, it's the boot page. All existing 85xx platforms hard code the location of the boot page in the u-boot image one way or another. I'm just changing the linker script to do it in a way where the same script will work on all 85xx boards.
But in the patch you submit you hard-wire certain flash bank sizes into the linker scriopts, don't you?
Best regards,
Wolfgang Denk

On Tue, 14 Oct 2008, Wolfgang Denk wrote:
In message Pine.LNX.4.64.0810131647450.3399@t2.domain.actdsltmp you wrote:
U-Boot should *never* assume static flash bank sizes. The whole design is based on the idea to automatically determine the actual size of flash and RAM that is fit on a specific board, and to auto-adjust for this.
The bank size here is only used for linking u-boot. The actual u-boot code is no different that it is now.
How is this expected to work if the flash bank size used to link the u-boot image is different from the real flash bank size present on the board?
This really has absolutely nothing to do with my patches!
All the mpc85xx platforms hard code the size of the flash via the local bus controller settings. For example, if you look in include/configs/MPC8572DS.h you will find these lines:
#define CFG_BR0_PRELIM 0xe8001001 #define CFG_OR0_PRELIM 0xf8000ff7
Those two lines encode the location of the flash bank at 0xe800_0000 and the size of the bank at 128MB. Also the port width and the timing parameters. Determining the value of these registers at run time would be somewhat of a challenge. You can't query the size of the flash chip with CFI until the chip is mapped. And you can't map the chip until you know its size, which creates a certain chicken and egg problem.
I think what you would have to do is create a huge initial mapping, big enough to cover the chip with the most address lines. I suppose you could map 4 GB to the flash and be assured of getting all 32 address lines on the eLBC. But you'd be running from the flash you just re-mapped, that makes things a little more interesting. Then you could do a CFI query to the base of that mapping to get the bank size, then resize the mapping to the correct value. I'm not sure how to figure out the port size. Maybe one could try 8, 16 and 32 bit ports and see which one worked, but that sounds a little iffy. Actually, I think this must be in the cpu reset strapping somewhere, otherwise how would it boot?
But again, this has nothing to do with my patch. I'm just improving the way the linker script works. If you want to talk about how the local bus controller is programmed, can we have another thread please? Something like "TODO: dynamically determine Freescale eLBC parameters at run time".
In order to boot on mpc85xx, the u-boot image must be linked to locate the boot page as the last page in the flash bank. There is no way to do this at run time, it's the boot page. All existing 85xx platforms hard code the location of the boot page in the u-boot image one way or another. I'm just changing the linker script to do it in a way where the same script will work on all 85xx boards.
But in the patch you submit you hard-wire certain flash bank sizes into the linker scriopts, don't you?
Not really. I'm calculating the boot page location in a better way.
Let's look at what's there now.
freescale/mpc8572ds/u-boot.lds: ADDR(.text) + 0x7f000 tqc/tqm85xx/u-boot.lds: 0xFFFFF000 mpc8540eval/u-boot.lds: (. & 0xFFF80000) + 0x0007F000
I do this: PROVIDE(__flash_mask = 4M - 1); (ADDR(.text) & ~(__flash_mask)) | (0xfffff000 & __flash_mask)
Suppose you want to change the size of the u-boot image from 512k to 256k? If you use the expression from mpc8572ds, it won't work. You must edit the linker script to change 0x7f000 to 0x3f000. With my method, the linker script doesn't need to be edited.
The expression from tqm85xx will let you change the image size without being edited. Why not use that one then? Suppose you decide to change the location of the flash bank? Then it won't work, unless you edit the linker script. That's why the tqm85xx expresion won't work for mpc8572ds, it would make a 256MB u-boot image because flash is mapped differently on that board. My expression works fine for both tqm85xx _and_ mpc8572ds and let's you change the location of the flash bank without editing the linker script.
The expression from mpc8540eval is *very* similar to what I've done. Mine has a couple advantages though. If you try to make a u-boot that is too small, mine will properly fail at link time when it tries to place the too large for the image u-boot code on top of the boot page. The mpc8540eval will happily create a broken image (that is 8MB+ in size). If you want to support a board with a 2 MB flash bank with the mpc8540eval style script, you need to copy the entire linker script and edit it. With my method method, you can create a two line script: __flash_mask = 2M - 1; INCLUDE cpu/mpc85xx/u-boot.lds
Which doesn't require creating a duplicate copy of the linker script.
This is what my patch is for. Letting all existing 85xx boards use one script. And if a board is created that can't use the script alone, it can be handled easily, re-using the common script without duplicating any code. Clearly this is an improvement over how things work now, is it not?

Dear Trent,
In message Pine.LNX.4.64.0810141231490.3705@t2.domain.actdsltmp you wrote:
All the mpc85xx platforms hard code the size of the flash via the local bus
No, they don't.
controller settings. For example, if you look in include/configs/MPC8572DS.h you will find these lines:
#define CFG_BR0_PRELIM 0xe8001001 #define CFG_OR0_PRELIM 0xf8000ff7
Mind the "PRELIM" part in that names. PRELIM as in PRELIMINARY.
Those two lines encode the location of the flash bank at 0xe800_0000 and the size of the bank at 128MB. Also the port width and the timing parameters. Determining the value of these registers at run time would be somewhat of a challenge. You can't query the size of the flash chip with CFI until the chip is mapped. And you can't map the chip until you know its size, which creates a certain chicken and egg problem.
You think you have to tell me that? Umm...
I think what you would have to do is create a huge initial mapping, big enough to cover the chip with the most address lines. I suppose you could map 4 GB to the flash and be assured of getting all 32 address lines on the eLBC. But
Not really. You just have to map a small part, just big enough to be able to read the CFI information.
you'd be running from the flash you just re-mapped, that makes things a little more interesting. Then you could do a CFI query to the base of that mapping to get the bank size, then resize the mapping to the correct value. I'm not sure how to figure out the port size. Maybe one could try 8, 16 and 32 bit ports and see which one worked, but that sounds a little iffy. Actually, I
You might want to have a look at the CFI driver, then.
think this must be in the cpu reset strapping somewhere, otherwise how would it boot?
But again, this has nothing to do with my patch. I'm just improving the way the linker script works. If you want to talk about how the local bus controller is programmed, can we have another thread please? Something like "TODO: dynamically determine Freescale eLBC parameters at run time".
We are talking about your patches here, which claim to cover "all MPC85xx" boards.
But in the patch you submit you hard-wire certain flash bank sizes into the linker scriopts, don't you?
Not really. I'm calculating the boot page location in a better way.
Now what. First you say you do, then you say you don't?
The expression from tqm85xx will let you change the image size without being edited. Why not use that one then? Suppose you decide to change the location
He. Funny that you come up with that example.
of the flash bank? Then it won't work, unless you edit the linker script.
"Change the location of the flash bank" - what exactly do you mean by that?
create a broken image (that is 8MB+ in size). If you want to support a board with a 2 MB flash bank with the mpc8540eval style script, you need to copy the entire linker script and edit it. With my method method, you can create a two line script: __flash_mask = 2M - 1; INCLUDE cpu/mpc85xx/u-boot.lds
And what do I do with a board that can have 2, 4, 8, 16, 32 or 64 MB of flash?
This is what my patch is for. Letting all existing 85xx boards use one script. And if a board is created that can't use the script alone, it can be handled easily, re-using the common script without duplicating any code. Clearly this is an improvement over how things work now, is it not?
I'd be happy if that works, but somehow you don't add the missing pieces of explanation I'm looking for.
Best regards,
Wolfgang Denk

On Wed, 15 Oct 2008, Wolfgang Denk wrote:
In message Pine.LNX.4.64.0810141231490.3705@t2.domain.actdsltmp you wrote:
All the mpc85xx platforms hard code the size of the flash via the local bus
No, they don't.
Name one that doesn't.
controller settings. For example, if you look in include/configs/MPC8572DS.h you will find these lines:
#define CFG_BR0_PRELIM 0xe8001001 #define CFG_OR0_PRELIM 0xf8000ff7
Mind the "PRELIM" part in that names. PRELIM as in PRELIMINARY.
For all the Freescale mpc85xx platforms, PRELIM also means final. But even for something like tqm85xx, this preliminary mapping is compiled in, is it not? This compiled in mapping is the one that must be taken into account when linking the u-boot image. Trying changing the BR0 value for tqm85xx and not editing the boot script and see what happens. Doesn't work. Then try using my boot script and see what happens. Does work.
you'd be running from the flash you just re-mapped, that makes things a little more interesting. Then you could do a CFI query to the base of that mapping to get the bank size, then resize the mapping to the correct value. I'm not sure how to figure out the port size. Maybe one could try 8, 16 and 32 bit ports and see which one worked, but that sounds a little iffy. Actually, I
You might want to have a look at the CFI driver, then.
I'm not seeing where it programs the local bus controller while u-boot is running from flash.
think this must be in the cpu reset strapping somewhere, otherwise how would it boot?
But again, this has nothing to do with my patch. I'm just improving the way the linker script works. If you want to talk about how the local bus controller is programmed, can we have another thread please? Something like "TODO: dynamically determine Freescale eLBC parameters at run time".
We are talking about your patches here, which claim to cover "all MPC85xx" boards.
You're talking about dynamically programming the local bus controller. My patches have nothing to do with that.
But in the patch you submit you hard-wire certain flash bank sizes into the linker scriopts, don't you?
Not really. I'm calculating the boot page location in a better way.
Now what. First you say you do, then you say you don't?
First of all, the boot scripts already have the boot flash bank location and size hardwired in. Secondly, it doesn't really matter. It only makes a difference in certain extreme situations of a very small flash bank mapped in an unusual manner or a very very large u-boot image.
The expression from tqm85xx will let you change the image size without being edited. Why not use that one then? Suppose you decide to change the location
He. Funny that you come up with that example.
of the flash bank? Then it won't work, unless you edit the linker script.
"Change the location of the flash bank" - what exactly do you mean by that?
Change CFG_BR0_PRELIM (and probably also TEXT_BASE and CFG_FLASH_BASE too).
create a broken image (that is 8MB+ in size). If you want to support a board with a 2 MB flash bank with the mpc8540eval style script, you need to copy the entire linker script and edit it. With my method method, you can create a two line script: __flash_mask = 2M - 1; INCLUDE cpu/mpc85xx/u-boot.lds
And what do I do with a board that can have 2, 4, 8, 16, 32 or 64 MB of flash?
Same thing as now. You have to pick values for CFG_B/OR0_PRELIM, FLASH_BASE and TEXT_BASE. You can almost certainly just use cpu/mpc85xx/u-boot.lds, unless you've chosen very odd values for BR0/OR0/TEXT_BASE. In that case can you make the two line custom script from above, and set __flash_mask based on what you chose for B/OR0.
This is what my patch is for. Letting all existing 85xx boards use one script. And if a board is created that can't use the script alone, it can be handled easily, re-using the common script without duplicating any code. Clearly this is an improvement over how things work now, is it not?
I'd be happy if that works, but somehow you don't add the missing pieces of explanation I'm looking for.
How does it not work? Programming the local bus controller has nothing to do with my patch in any way.
Did you actually look at the patch? You're going on about how the local bus controller is programmed, doing CFI querying while u-boot is still running out of the boot flash bank, the image can't be linked with bss at 0 and all these things that have nothing what so ever to do with my patch.

The boot page and reset vector need to be at the absolute address 0xfffff000 and 0xfffffffc, respectively, when the CPU boots.
However, their location in the U-Boot image is relative to the address that flash is mapped at. For instance, mpc8572ds maps the 128MB flash boot bank to 0xe8000000, which means the boot page is at 0xeffff000 in the U-Boot image.
Currently the linker scripts use ADDR(.text) + 0x7f000 to location the boot page, but this only works if .text starts 512kB from the end of the flash window, e.g. TEXT_BASE is 0xeff80000 for mpc8572ds. If TEXT_BASE is somewhere else, such as when creating a 256kB image, the boot page will be at the wrong location.
To handle to both different U-Boot image sizes and flash locations, what we do is take the upper bits of the boot page from the location of .text and the lower bits are taken from the absolute address 0xfffff000. How many bits to take depends on the size of the flash bank. In effect the upper bits come from the location of the flash bank in the CPU address space and the lower bits come from the fixed location of the boot page within the flash bank.
The bss segment should go after the end of the u-boot image. Which is only at the fixed address 0 for platforms that don't remap flash. For those that do it's somewhere else, e.g. on mpc8572ds it's at 0xf0000000. The easiest way to locate bss is to say it starts 4k after the boot page, since we already put that in the final 4k of the image.
Since this part of the linker script is the same for all mpc85xx targets, maybe it should be placed into an include file instead of duplicated?
Signed-off-by: Trent Piepho tpiepho@freescale.com --- board/freescale/mpc8536ds/u-boot.lds | 11 +++++------ board/freescale/mpc8540ads/u-boot.lds | 11 +++++------ board/freescale/mpc8541cds/u-boot.lds | 11 +++++------ board/freescale/mpc8544ds/u-boot.lds | 12 ++++++------ board/freescale/mpc8548cds/u-boot.lds | 11 +++++------ board/freescale/mpc8555cds/u-boot.lds | 11 +++++------ board/freescale/mpc8560ads/u-boot.lds | 11 +++++------ board/freescale/mpc8568mds/u-boot.lds | 11 +++++------ board/freescale/mpc8572ds/u-boot.lds | 11 +++++------ 9 files changed, 46 insertions(+), 54 deletions(-)
diff --git a/board/freescale/mpc8536ds/u-boot.lds b/board/freescale/mpc8536ds/u-boot.lds index 901f633..05c8d4d 100644 --- a/board/freescale/mpc8536ds/u-boot.lds +++ b/board/freescale/mpc8536ds/u-boot.lds @@ -118,21 +118,20 @@ SECTIONS . = ALIGN(256); __init_end = .;
- .bootpg ADDR(.text) + 0x7f000 : + __flash_mask = 128M - 1; + .bootpg (ADDR(.text) & ~(__flash_mask)) | (0xfffff000 & __flash_mask) : { cpu/mpc85xx/start.o (.bootpg) } :text = 0xffff
- .resetvec ADDR(.text) + 0x7fffc : + .resetvec ADDR(.bootpg) + 0xffc : { *(.resetvec) } :text = 0xffff
- . = ADDR(.text) + 0x80000; - - __bss_start = .; - .bss (NOLOAD) : + .bss ADDR(.bootpg) + 0x1000 (NOLOAD) : { + __bss_start = ABSOLUTE(.); *(.sbss) *(.scommon) *(.dynbss) *(.bss) diff --git a/board/freescale/mpc8540ads/u-boot.lds b/board/freescale/mpc8540ads/u-boot.lds index 515d320..2148e12 100644 --- a/board/freescale/mpc8540ads/u-boot.lds +++ b/board/freescale/mpc8540ads/u-boot.lds @@ -121,21 +121,20 @@ SECTIONS . = ALIGN(256); __init_end = .;
- .bootpg ADDR(.text) + 0x7f000 : + __flash_mask = 16M - 1; + .bootpg (ADDR(.text) & ~(__flash_mask)) | (0xfffff000 & __flash_mask) : { cpu/mpc85xx/start.o (.bootpg) } :text = 0xffff
- .resetvec ADDR(.text) + 0x7fffc : + .resetvec ADDR(.bootpg) + 0xffc : { *(.resetvec) } :text = 0xffff
- . = ADDR(.text) + 0x80000; - - __bss_start = .; - .bss (NOLOAD) : + .bss ADDR(.bootpg) + 0x1000 (NOLOAD) : { + __bss_start = ABSOLUTE(.); *(.sbss) *(.scommon) *(.dynbss) *(.bss) diff --git a/board/freescale/mpc8541cds/u-boot.lds b/board/freescale/mpc8541cds/u-boot.lds index d728d8b..13ec8bf 100644 --- a/board/freescale/mpc8541cds/u-boot.lds +++ b/board/freescale/mpc8541cds/u-boot.lds @@ -118,21 +118,20 @@ SECTIONS . = ALIGN(256); __init_end = .;
- .bootpg ADDR(.text) + 0x7f000 : + __flash_mask = 8M - 1; /* Flash bank is 8 MB */ + .bootpg (ADDR(.text) & ~(__flash_mask)) | (0xfffff000 & __flash_mask) : { cpu/mpc85xx/start.o (.bootpg) } :text = 0xffff
- .resetvec ADDR(.text) + 0x7fffc : + .resetvec ADDR(.bootpg) + 0xffc : { *(.resetvec) } :text = 0xffff
- . = ADDR(.text) + 0x80000; - - __bss_start = .; - .bss (NOLOAD) : + .bss ADDR(.bootpg) + 0x1000 (NOLOAD) : { + __bss_start = ABSOLUTE(.); *(.sbss) *(.scommon) *(.dynbss) *(.bss) diff --git a/board/freescale/mpc8544ds/u-boot.lds b/board/freescale/mpc8544ds/u-boot.lds index a05ece5..10a333b 100644 --- a/board/freescale/mpc8544ds/u-boot.lds +++ b/board/freescale/mpc8544ds/u-boot.lds @@ -118,21 +118,21 @@ SECTIONS . = ALIGN(256); __init_end = .;
- .bootpg ADDR(.text) + 0x7f000 : + /* Flash blank size is 8M */ + __flash_mask = 8M - 1; + .bootpg (ADDR(.text) & ~(__flash_mask)) | (0xfffff000 & __flash_mask) : { cpu/mpc85xx/start.o (.bootpg) } :text = 0xffff
- .resetvec ADDR(.text) + 0x7fffc : + .resetvec ADDR(.bootpg) + 0xffc : { *(.resetvec) } :text = 0xffff
- . = ADDR(.text) + 0x80000; - - __bss_start = .; - .bss (NOLOAD) : + .bss ADDR(.bootpg) + 0x1000 (NOLOAD) : { + __bss_start = ABSOLUTE(.); *(.sbss) *(.scommon) *(.dynbss) *(.bss) diff --git a/board/freescale/mpc8548cds/u-boot.lds b/board/freescale/mpc8548cds/u-boot.lds index d4a2f72..2dca78a 100644 --- a/board/freescale/mpc8548cds/u-boot.lds +++ b/board/freescale/mpc8548cds/u-boot.lds @@ -118,21 +118,20 @@ SECTIONS . = ALIGN(256); __init_end = .;
- .bootpg ADDR(.text) + 0x7f000 : + __flash_mask = 8M - 1; /* Flash bank is 8 MB */ + .bootpg (ADDR(.text) & ~(__flash_mask)) | (0xfffff000 & __flash_mask) : { cpu/mpc85xx/start.o (.bootpg) } :text = 0xffff
- .resetvec ADDR(.text) + 0x7fffc : + .resetvec ADDR(.bootpg) + 0xffc : { *(.resetvec) } :text = 0xffff
- . = ADDR(.text) + 0x80000; - - __bss_start = .; - .bss (NOLOAD) : + .bss ADDR(.bootpg) + 0x1000 (NOLOAD) : { + __bss_start = ABSOLUTE(.); *(.sbss) *(.scommon) *(.dynbss) *(.bss) diff --git a/board/freescale/mpc8555cds/u-boot.lds b/board/freescale/mpc8555cds/u-boot.lds index 11885e8..644db2c 100644 --- a/board/freescale/mpc8555cds/u-boot.lds +++ b/board/freescale/mpc8555cds/u-boot.lds @@ -118,21 +118,20 @@ SECTIONS . = ALIGN(256); __init_end = .;
- .bootpg ADDR(.text) + 0x7f000 : + __flash_mask = 8M - 1; /* Flash bank is 8 MB */ + .bootpg (ADDR(.text) & ~(__flash_mask)) | (0xfffff000 & __flash_mask) : { cpu/mpc85xx/start.o (.bootpg) } :text = 0xffff
- .resetvec ADDR(.text) + 0x7fffc : + .resetvec ADDR(.bootpg) + 0xffc : { *(.resetvec) } :text = 0xffff
- . = ADDR(.text) + 0x80000; - - __bss_start = .; - .bss (NOLOAD) : + .bss ADDR(.bootpg) + 0x1000 (NOLOAD) : { + __bss_start = ABSOLUTE(.); *(.sbss) *(.scommon) *(.dynbss) *(.bss) diff --git a/board/freescale/mpc8560ads/u-boot.lds b/board/freescale/mpc8560ads/u-boot.lds index 515d320..2148e12 100644 --- a/board/freescale/mpc8560ads/u-boot.lds +++ b/board/freescale/mpc8560ads/u-boot.lds @@ -121,21 +121,20 @@ SECTIONS . = ALIGN(256); __init_end = .;
- .bootpg ADDR(.text) + 0x7f000 : + __flash_mask = 16M - 1; + .bootpg (ADDR(.text) & ~(__flash_mask)) | (0xfffff000 & __flash_mask) : { cpu/mpc85xx/start.o (.bootpg) } :text = 0xffff
- .resetvec ADDR(.text) + 0x7fffc : + .resetvec ADDR(.bootpg) + 0xffc : { *(.resetvec) } :text = 0xffff
- . = ADDR(.text) + 0x80000; - - __bss_start = .; - .bss (NOLOAD) : + .bss ADDR(.bootpg) + 0x1000 (NOLOAD) : { + __bss_start = ABSOLUTE(.); *(.sbss) *(.scommon) *(.dynbss) *(.bss) diff --git a/board/freescale/mpc8568mds/u-boot.lds b/board/freescale/mpc8568mds/u-boot.lds index ad96410..0c59e8c 100644 --- a/board/freescale/mpc8568mds/u-boot.lds +++ b/board/freescale/mpc8568mds/u-boot.lds @@ -118,21 +118,20 @@ SECTIONS . = ALIGN(256); __init_end = .;
- .bootpg ADDR(.text) + 0x7f000 : + __flash_mask = 8M - 1; /* Flash bank is 8 MB */ + .bootpg (ADDR(.text) & ~(__flash_mask)) | (0xfffff000 & __flash_mask) : { cpu/mpc85xx/start.o (.bootpg) } :text = 0xffff
- .resetvec ADDR(.text) + 0x7fffc : + .resetvec ADDR(.bootpg) + 0xffc : { *(.resetvec) } :text = 0xffff
- . = ADDR(.text) + 0x80000; - - __bss_start = .; - .bss (NOLOAD) : + .bss ADDR(.bootpg) + 0x1000 (NOLOAD) : { + __bss_start = ABSOLUTE(.); *(.sbss) *(.scommon) *(.dynbss) *(.bss) diff --git a/board/freescale/mpc8572ds/u-boot.lds b/board/freescale/mpc8572ds/u-boot.lds index a05ece5..7ee7d61 100644 --- a/board/freescale/mpc8572ds/u-boot.lds +++ b/board/freescale/mpc8572ds/u-boot.lds @@ -118,21 +118,20 @@ SECTIONS . = ALIGN(256); __init_end = .;
- .bootpg ADDR(.text) + 0x7f000 : + __flash_mask = 128M - 1; + .bootpg (ADDR(.text) & ~(__flash_mask)) | (0xfffff000 & __flash_mask) : { cpu/mpc85xx/start.o (.bootpg) } :text = 0xffff
- .resetvec ADDR(.text) + 0x7fffc : + .resetvec ADDR(.bootpg) + 0xffc : { *(.resetvec) } :text = 0xffff
- . = ADDR(.text) + 0x80000; - - __bss_start = .; - .bss (NOLOAD) : + .bss ADDR(.bootpg) + 0x1000 (NOLOAD) : { + __bss_start = ABSOLUTE(.); *(.sbss) *(.scommon) *(.dynbss) *(.bss)

Dear Trent Piepho,
In message 1223941151-13969-1-git-send-email-tpiepho@freescale.com you wrote:
The boot page and reset vector need to be at the absolute address 0xfffff000 and 0xfffffffc, respectively, when the CPU boots.
...
To handle to both different U-Boot image sizes and flash locations, what we do is take the upper bits of the boot page from the location of .text and the lower bits are taken from the absolute address 0xfffff000. How many bits to take depends on the size of the flash bank. In effect the upper
I would like to point out that it is essential that the code must be able to handle the situation where the flash bank size is unknown at compile time, and becomes known anly at runtime when the flash driver probes the actual flash size on the board.
This may be not strictly needed for the Freescale evaluation boards, but it is definitely needed for other boards, and we must be able to handle this.
The bss segment should go after the end of the u-boot image. Which is only at the fixed address 0 for platforms that don't remap flash. For those
I'm not sure what you mean here. Bss becomes significant only after relocation to RAM. By then, it must be located in a valid RAM area. "fixed address 0" is no such valid address.
Since this part of the linker script is the same for all mpc85xx targets, maybe it should be placed into an include file instead of duplicated?
That would make sense, indeed.
- .bootpg ADDR(.text) + 0x7f000 :
- __flash_mask = 128M - 1;
Does the linker actually understand the "128M" notation? Interesting - I didn't know that.
But - where is the number coming from? I guess that's a hard-wired flash size for this specific board?
This is bad, for two reasons: it means we have to maintain the same data in several places (in the linker script plus in the board config file), and second, we cannot handle boards where several size options exist.
Flash bank sizes must not be hard wired.
Best regards,
Wolfgang Denk

On Tue, 14 Oct 2008, Wolfgang Denk wrote:
In message 1223941151-13969-1-git-send-email-tpiepho@freescale.com you wrote:
The boot page and reset vector need to be at the absolute address 0xfffff000 and 0xfffffffc, respectively, when the CPU boots.
...
To handle to both different U-Boot image sizes and flash locations, what we do is take the upper bits of the boot page from the location of .text and the lower bits are taken from the absolute address 0xfffff000. How many bits to take depends on the size of the flash bank. In effect the upper
I would like to point out that it is essential that the code must be able to handle the situation where the flash bank size is unknown at compile time, and becomes known anly at runtime when the flash driver probes the actual flash size on the board.
This is an issue for how the local bus controller is programmed and has nothing to do with my patch.
The bss segment should go after the end of the u-boot image. Which is only at the fixed address 0 for platforms that don't remap flash. For those
I'm not sure what you mean here. Bss becomes significant only after relocation to RAM. By then, it must be located in a valid RAM area. "fixed address 0" is no such valid address.
One way to avoid editing the linker script when changing the image size is to *link* u-boot with bss at 0. But that only works for boards that have have *linked* the boot page at 0xffff_f000, it doesn't work for boards, like mpc8572ds, that link the boot page at 0xefff_f000. The way I find address to link bss at works for all boards.
- .bootpg ADDR(.text) + 0x7f000 :
- __flash_mask = 128M - 1;
Does the linker actually understand the "128M" notation? Interesting - I didn't know that.
If it didn't understand the notation, I sure wouldn't have tested my patches very well! I'm using this on mpc8572ds hardware now. I tested the other platforms and verified that the u-boot image remains unchanged, as it should.
But - where is the number coming from? I guess that's a hard-wired flash size for this specific board?
This is bad, for two reasons: it means we have to maintain the same data in several places (in the linker script plus in the board config file), and second, we cannot handle boards where several size options exist.
This data doesn't exist in the board config file. The linker scripts already in effect contain this data. I have a calculation that uses the flash bank size. What's there now is the result of a calculation that uses the flash bank size. Change the flash mapping and the result changes. The existing scripts depend on the flash mapping just as much as mine does, if not more.
Which is not that much of a dependency really. If you look at the comments to the patch, it's only an issue in certain extreme cases that current don't exist.

Dear Trent,
in message Pine.LNX.4.64.0810141319050.3705@t2.domain.actdsltmp you wrote:
This data doesn't exist in the board config file. The linker scripts already in effect contain this data. I have a calculation that uses the flash bank size. What's there now is the result of a calculation that uses the flash bank size. Change the flash mapping and the result changes. The existing scripts depend on the flash mapping just as much as mine does, if not more.
So how do you handle boards where the flash size is unknown at compile-time?
Best regards,
Wolfgang Denk

On Tue, 14 Oct 2008, Wolfgang Denk wrote:
Dear Trent,
in message Pine.LNX.4.64.0810141319050.3705@t2.domain.actdsltmp you wrote:
This data doesn't exist in the board config file. The linker scripts already in effect contain this data. I have a calculation that uses the flash bank size. What's there now is the result of a calculation that uses the flash bank size. Change the flash mapping and the result changes. The existing scripts depend on the flash mapping just as much as mine does, if not more.
So how do you handle boards where the flash size is unknown at compile-time?
You're talking about how the eLBC is programmed. That has nothing to do with my patches!
When someone adds code to dynamically program the local bus controller they'll have to figure out what to do.
Probably the same way the CPU boots, by defaulting to an 8MB flash bank and then re-programming it later. Obviously the CPU can't find the size of the flash bank before it boots! Using the wrong bank size doesn't actually make much difference.

They are all the same except for the flash size and some copyright comments.
The combined script assumes a flash bank size of 4 MB, which work for all current platforms. This assumtion is only a problem if:
A) The flash bank is less than 4 MB and it is mapped to a location that not aligned to the top of a 4 MB boundary. E.g., a 1 MB bank mapped to 0xefff0000 is ok, but if it were mapped at 0xeffd0000 then it would be a problem.
B) The U-Boot image is over 4MB in size. The image size for this is from TEXT_BASE to the end of the reset vector. It's not the size of the U-Boot code as there could be a huge gap between the end of the code and the reset vector. The BSS section does not count for this size, as it goes after the reset vector (and it not actually present in the image). This should be the same as the size of the u-boot.bin file.
If someone ever has one of these problems, they can create a custom ld script that overrides the flash bank size and then just include the common mpc85xx script. It would look something like this:
__flash_mask = 2M - 1; /* For a 2MB flash bank */ INCLUDE cpu/mpc85xx/u-boot.lds
Signed-off-by: Trent Piepho tpiepho@freescale.com --- board/freescale/mpc8536ds/u-boot.lds | 144 ----------------------------- board/freescale/mpc8540ads/u-boot.lds | 147 ----------------------------- board/freescale/mpc8541cds/u-boot.lds | 144 ----------------------------- board/freescale/mpc8544ds/u-boot.lds | 145 ----------------------------- board/freescale/mpc8548cds/u-boot.lds | 144 ----------------------------- board/freescale/mpc8555cds/u-boot.lds | 144 ----------------------------- board/freescale/mpc8560ads/u-boot.lds | 147 ----------------------------- board/freescale/mpc8568mds/u-boot.lds | 144 ----------------------------- board/freescale/mpc8572ds/u-boot.lds | 144 ----------------------------- cpu/mpc85xx/config.mk | 3 + cpu/mpc85xx/u-boot.lds | 163 +++++++++++++++++++++++++++++++++ 11 files changed, 166 insertions(+), 1303 deletions(-) delete mode 100644 board/freescale/mpc8536ds/u-boot.lds delete mode 100644 board/freescale/mpc8540ads/u-boot.lds delete mode 100644 board/freescale/mpc8541cds/u-boot.lds delete mode 100644 board/freescale/mpc8544ds/u-boot.lds delete mode 100644 board/freescale/mpc8548cds/u-boot.lds delete mode 100644 board/freescale/mpc8555cds/u-boot.lds delete mode 100644 board/freescale/mpc8560ads/u-boot.lds delete mode 100644 board/freescale/mpc8568mds/u-boot.lds delete mode 100644 board/freescale/mpc8572ds/u-boot.lds create mode 100644 cpu/mpc85xx/u-boot.lds
diff --git a/board/freescale/mpc8536ds/u-boot.lds b/board/freescale/mpc8536ds/u-boot.lds deleted file mode 100644 index 05c8d4d..0000000 --- a/board/freescale/mpc8536ds/u-boot.lds +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright 2008 Freescale Semiconductor, Inc. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -OUTPUT_ARCH(powerpc) -/* Do we need any of these for elf? - __DYNAMIC = 0; */ -PHDRS -{ - text PT_LOAD; - bss PT_LOAD; -} - -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - . = + SIZEOF_HEADERS; - .interp : { *(.interp) } - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .rel.text : { *(.rel.text) } - .rela.text : { *(.rela.text) } - .rel.data : { *(.rel.data) } - .rela.data : { *(.rela.data) } - .rel.rodata : { *(.rel.rodata) } - .rela.rodata : { *(.rela.rodata) } - .rel.got : { *(.rel.got) } - .rela.got : { *(.rela.got) } - .rel.ctors : { *(.rel.ctors) } - .rela.ctors : { *(.rela.ctors) } - .rel.dtors : { *(.rel.dtors) } - .rela.dtors : { *(.rela.dtors) } - .rel.bss : { *(.rel.bss) } - .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .init : { *(.init) } - .plt : { *(.plt) } - .text : - { - *(.text) - *(.fixup) - *(.got1) - } :text - _etext = .; - PROVIDE (etext = .); - .rodata : - { - *(.rodata) - *(.rodata1) - *(.rodata.str1.4) - *(.eh_frame) - } :text - .fini : { *(.fini) } =0 - .ctors : { *(.ctors) } - .dtors : { *(.dtors) } - - /* Read-write section, merged into data segment: */ - . = (. + 0x00FF) & 0xFFFFFF00; - _erotext = .; - PROVIDE (erotext = .); - .reloc : - { - *(.got) - _GOT2_TABLE_ = .; - *(.got2) - _FIXUP_TABLE_ = .; - *(.fixup) - } - __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2; - __fixup_entries = (. - _FIXUP_TABLE_) >> 2; - - .data : - { - *(.data) - *(.data1) - *(.sdata) - *(.sdata2) - *(.dynamic) - CONSTRUCTORS - } - _edata = .; - PROVIDE (edata = .); - - . = .; - __u_boot_cmd_start = .; - .u_boot_cmd : { *(.u_boot_cmd) } - __u_boot_cmd_end = .; - - . = .; - __start___ex_table = .; - __ex_table : { *(__ex_table) } - __stop___ex_table = .; - - . = ALIGN(256); - __init_begin = .; - .text.init : { *(.text.init) } - .data.init : { *(.data.init) } - . = ALIGN(256); - __init_end = .; - - __flash_mask = 128M - 1; - .bootpg (ADDR(.text) & ~(__flash_mask)) | (0xfffff000 & __flash_mask) : - { - cpu/mpc85xx/start.o (.bootpg) - } :text = 0xffff - - .resetvec ADDR(.bootpg) + 0xffc : - { - *(.resetvec) - } :text = 0xffff - - .bss ADDR(.bootpg) + 0x1000 (NOLOAD) : - { - __bss_start = ABSOLUTE(.); - *(.sbss) *(.scommon) - *(.dynbss) - *(.bss) - *(COMMON) - } :bss - - . = ALIGN(4); - _end = . ; - PROVIDE (end = .); -} diff --git a/board/freescale/mpc8540ads/u-boot.lds b/board/freescale/mpc8540ads/u-boot.lds deleted file mode 100644 index 2148e12..0000000 --- a/board/freescale/mpc8540ads/u-boot.lds +++ /dev/null @@ -1,147 +0,0 @@ -/* - * (C) Copyright 2002,2003, Motorola,Inc. - * Xianghua Xiao, X.Xiao@motorola.com. - * - * Copyright 2008 Freescale Semiconductor, Inc. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -OUTPUT_ARCH(powerpc) -/* Do we need any of these for elf? - __DYNAMIC = 0; */ -PHDRS -{ - text PT_LOAD; - bss PT_LOAD; -} - -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - . = + SIZEOF_HEADERS; - .interp : { *(.interp) } - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .rel.text : { *(.rel.text) } - .rela.text : { *(.rela.text) } - .rel.data : { *(.rel.data) } - .rela.data : { *(.rela.data) } - .rel.rodata : { *(.rel.rodata) } - .rela.rodata : { *(.rela.rodata) } - .rel.got : { *(.rel.got) } - .rela.got : { *(.rela.got) } - .rel.ctors : { *(.rel.ctors) } - .rela.ctors : { *(.rela.ctors) } - .rel.dtors : { *(.rel.dtors) } - .rela.dtors : { *(.rela.dtors) } - .rel.bss : { *(.rel.bss) } - .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .init : { *(.init) } - .plt : { *(.plt) } - .text : - { - *(.text) - *(.fixup) - *(.got1) - } :text - _etext = .; - PROVIDE (etext = .); - .rodata : - { - *(.rodata) - *(.rodata1) - *(.rodata.str1.4) - *(.eh_frame) - } :text - .fini : { *(.fini) } =0 - .ctors : { *(.ctors) } - .dtors : { *(.dtors) } - - /* Read-write section, merged into data segment: */ - . = (. + 0x00FF) & 0xFFFFFF00; - _erotext = .; - PROVIDE (erotext = .); - .reloc : - { - *(.got) - _GOT2_TABLE_ = .; - *(.got2) - _FIXUP_TABLE_ = .; - *(.fixup) - } - __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2; - __fixup_entries = (. - _FIXUP_TABLE_) >> 2; - - .data : - { - *(.data) - *(.data1) - *(.sdata) - *(.sdata2) - *(.dynamic) - CONSTRUCTORS - } - _edata = .; - PROVIDE (edata = .); - - . = .; - __u_boot_cmd_start = .; - .u_boot_cmd : { *(.u_boot_cmd) } - __u_boot_cmd_end = .; - - . = .; - __start___ex_table = .; - __ex_table : { *(__ex_table) } - __stop___ex_table = .; - - . = ALIGN(256); - __init_begin = .; - .text.init : { *(.text.init) } - .data.init : { *(.data.init) } - . = ALIGN(256); - __init_end = .; - - __flash_mask = 16M - 1; - .bootpg (ADDR(.text) & ~(__flash_mask)) | (0xfffff000 & __flash_mask) : - { - cpu/mpc85xx/start.o (.bootpg) - } :text = 0xffff - - .resetvec ADDR(.bootpg) + 0xffc : - { - *(.resetvec) - } :text = 0xffff - - .bss ADDR(.bootpg) + 0x1000 (NOLOAD) : - { - __bss_start = ABSOLUTE(.); - *(.sbss) *(.scommon) - *(.dynbss) - *(.bss) - *(COMMON) - } :bss - - . = ALIGN(4); - _end = . ; - PROVIDE (end = .); -} diff --git a/board/freescale/mpc8541cds/u-boot.lds b/board/freescale/mpc8541cds/u-boot.lds deleted file mode 100644 index 13ec8bf..0000000 --- a/board/freescale/mpc8541cds/u-boot.lds +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright 2004, 2008 Freescale Semiconductor. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -OUTPUT_ARCH(powerpc) -/* Do we need any of these for elf? - __DYNAMIC = 0; */ -PHDRS -{ - text PT_LOAD; - bss PT_LOAD; -} - -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - . = + SIZEOF_HEADERS; - .interp : { *(.interp) } - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .rel.text : { *(.rel.text) } - .rela.text : { *(.rela.text) } - .rel.data : { *(.rel.data) } - .rela.data : { *(.rela.data) } - .rel.rodata : { *(.rel.rodata) } - .rela.rodata : { *(.rela.rodata) } - .rel.got : { *(.rel.got) } - .rela.got : { *(.rela.got) } - .rel.ctors : { *(.rel.ctors) } - .rela.ctors : { *(.rela.ctors) } - .rel.dtors : { *(.rel.dtors) } - .rela.dtors : { *(.rela.dtors) } - .rel.bss : { *(.rel.bss) } - .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .init : { *(.init) } - .plt : { *(.plt) } - .text : - { - *(.text) - *(.fixup) - *(.got1) - } :text - _etext = .; - PROVIDE (etext = .); - .rodata : - { - *(.rodata) - *(.rodata1) - *(.rodata.str1.4) - *(.eh_frame) - } :text - .fini : { *(.fini) } =0 - .ctors : { *(.ctors) } - .dtors : { *(.dtors) } - - /* Read-write section, merged into data segment: */ - . = (. + 0x00FF) & 0xFFFFFF00; - _erotext = .; - PROVIDE (erotext = .); - .reloc : - { - *(.got) - _GOT2_TABLE_ = .; - *(.got2) - _FIXUP_TABLE_ = .; - *(.fixup) - } - __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2; - __fixup_entries = (. - _FIXUP_TABLE_) >> 2; - - .data : - { - *(.data) - *(.data1) - *(.sdata) - *(.sdata2) - *(.dynamic) - CONSTRUCTORS - } - _edata = .; - PROVIDE (edata = .); - - . = .; - __u_boot_cmd_start = .; - .u_boot_cmd : { *(.u_boot_cmd) } - __u_boot_cmd_end = .; - - . = .; - __start___ex_table = .; - __ex_table : { *(__ex_table) } - __stop___ex_table = .; - - . = ALIGN(256); - __init_begin = .; - .text.init : { *(.text.init) } - .data.init : { *(.data.init) } - . = ALIGN(256); - __init_end = .; - - __flash_mask = 8M - 1; /* Flash bank is 8 MB */ - .bootpg (ADDR(.text) & ~(__flash_mask)) | (0xfffff000 & __flash_mask) : - { - cpu/mpc85xx/start.o (.bootpg) - } :text = 0xffff - - .resetvec ADDR(.bootpg) + 0xffc : - { - *(.resetvec) - } :text = 0xffff - - .bss ADDR(.bootpg) + 0x1000 (NOLOAD) : - { - __bss_start = ABSOLUTE(.); - *(.sbss) *(.scommon) - *(.dynbss) - *(.bss) - *(COMMON) - } :bss - - . = ALIGN(4); - _end = . ; - PROVIDE (end = .); -} diff --git a/board/freescale/mpc8544ds/u-boot.lds b/board/freescale/mpc8544ds/u-boot.lds deleted file mode 100644 index 10a333b..0000000 --- a/board/freescale/mpc8544ds/u-boot.lds +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright 2007-2008 Freescale Semiconductor, Inc. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -OUTPUT_ARCH(powerpc) -/* Do we need any of these for elf? - __DYNAMIC = 0; */ -PHDRS -{ - text PT_LOAD; - bss PT_LOAD; -} - -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - . = + SIZEOF_HEADERS; - .interp : { *(.interp) } - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .rel.text : { *(.rel.text) } - .rela.text : { *(.rela.text) } - .rel.data : { *(.rel.data) } - .rela.data : { *(.rela.data) } - .rel.rodata : { *(.rel.rodata) } - .rela.rodata : { *(.rela.rodata) } - .rel.got : { *(.rel.got) } - .rela.got : { *(.rela.got) } - .rel.ctors : { *(.rel.ctors) } - .rela.ctors : { *(.rela.ctors) } - .rel.dtors : { *(.rel.dtors) } - .rela.dtors : { *(.rela.dtors) } - .rel.bss : { *(.rel.bss) } - .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .init : { *(.init) } - .plt : { *(.plt) } - .text : - { - *(.text) - *(.fixup) - *(.got1) - } :text - _etext = .; - PROVIDE (etext = .); - .rodata : - { - *(.rodata) - *(.rodata1) - *(.rodata.str1.4) - *(.eh_frame) - } :text - .fini : { *(.fini) } =0 - .ctors : { *(.ctors) } - .dtors : { *(.dtors) } - - /* Read-write section, merged into data segment: */ - . = (. + 0x00FF) & 0xFFFFFF00; - _erotext = .; - PROVIDE (erotext = .); - .reloc : - { - *(.got) - _GOT2_TABLE_ = .; - *(.got2) - _FIXUP_TABLE_ = .; - *(.fixup) - } - __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2; - __fixup_entries = (. - _FIXUP_TABLE_) >> 2; - - .data : - { - *(.data) - *(.data1) - *(.sdata) - *(.sdata2) - *(.dynamic) - CONSTRUCTORS - } - _edata = .; - PROVIDE (edata = .); - - . = .; - __u_boot_cmd_start = .; - .u_boot_cmd : { *(.u_boot_cmd) } - __u_boot_cmd_end = .; - - . = .; - __start___ex_table = .; - __ex_table : { *(__ex_table) } - __stop___ex_table = .; - - . = ALIGN(256); - __init_begin = .; - .text.init : { *(.text.init) } - .data.init : { *(.data.init) } - . = ALIGN(256); - __init_end = .; - - /* Flash blank size is 8M */ - __flash_mask = 8M - 1; - .bootpg (ADDR(.text) & ~(__flash_mask)) | (0xfffff000 & __flash_mask) : - { - cpu/mpc85xx/start.o (.bootpg) - } :text = 0xffff - - .resetvec ADDR(.bootpg) + 0xffc : - { - *(.resetvec) - } :text = 0xffff - - .bss ADDR(.bootpg) + 0x1000 (NOLOAD) : - { - __bss_start = ABSOLUTE(.); - *(.sbss) *(.scommon) - *(.dynbss) - *(.bss) - *(COMMON) - } :bss - - . = ALIGN(4); - _end = . ; - PROVIDE (end = .); -} diff --git a/board/freescale/mpc8548cds/u-boot.lds b/board/freescale/mpc8548cds/u-boot.lds deleted file mode 100644 index 2dca78a..0000000 --- a/board/freescale/mpc8548cds/u-boot.lds +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright 2004, 2007-2008 Freescale Semiconductor, Inc. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -OUTPUT_ARCH(powerpc) -/* Do we need any of these for elf? - __DYNAMIC = 0; */ -PHDRS -{ - text PT_LOAD; - bss PT_LOAD; -} - -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - . = + SIZEOF_HEADERS; - .interp : { *(.interp) } - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .rel.text : { *(.rel.text) } - .rela.text : { *(.rela.text) } - .rel.data : { *(.rel.data) } - .rela.data : { *(.rela.data) } - .rel.rodata : { *(.rel.rodata) } - .rela.rodata : { *(.rela.rodata) } - .rel.got : { *(.rel.got) } - .rela.got : { *(.rela.got) } - .rel.ctors : { *(.rel.ctors) } - .rela.ctors : { *(.rela.ctors) } - .rel.dtors : { *(.rel.dtors) } - .rela.dtors : { *(.rela.dtors) } - .rel.bss : { *(.rel.bss) } - .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .init : { *(.init) } - .plt : { *(.plt) } - .text : - { - *(.text) - *(.fixup) - *(.got1) - } :text - _etext = .; - PROVIDE (etext = .); - .rodata : - { - *(.rodata) - *(.rodata1) - *(.rodata.str1.4) - *(.eh_frame) - } :text - .fini : { *(.fini) } =0 - .ctors : { *(.ctors) } - .dtors : { *(.dtors) } - - /* Read-write section, merged into data segment: */ - . = (. + 0x00FF) & 0xFFFFFF00; - _erotext = .; - PROVIDE (erotext = .); - .reloc : - { - *(.got) - _GOT2_TABLE_ = .; - *(.got2) - _FIXUP_TABLE_ = .; - *(.fixup) - } - __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2; - __fixup_entries = (. - _FIXUP_TABLE_) >> 2; - - .data : - { - *(.data) - *(.data1) - *(.sdata) - *(.sdata2) - *(.dynamic) - CONSTRUCTORS - } - _edata = .; - PROVIDE (edata = .); - - . = .; - __u_boot_cmd_start = .; - .u_boot_cmd : { *(.u_boot_cmd) } - __u_boot_cmd_end = .; - - . = .; - __start___ex_table = .; - __ex_table : { *(__ex_table) } - __stop___ex_table = .; - - . = ALIGN(256); - __init_begin = .; - .text.init : { *(.text.init) } - .data.init : { *(.data.init) } - . = ALIGN(256); - __init_end = .; - - __flash_mask = 8M - 1; /* Flash bank is 8 MB */ - .bootpg (ADDR(.text) & ~(__flash_mask)) | (0xfffff000 & __flash_mask) : - { - cpu/mpc85xx/start.o (.bootpg) - } :text = 0xffff - - .resetvec ADDR(.bootpg) + 0xffc : - { - *(.resetvec) - } :text = 0xffff - - .bss ADDR(.bootpg) + 0x1000 (NOLOAD) : - { - __bss_start = ABSOLUTE(.); - *(.sbss) *(.scommon) - *(.dynbss) - *(.bss) - *(COMMON) - } :bss - - . = ALIGN(4); - _end = . ; - PROVIDE (end = .); -} diff --git a/board/freescale/mpc8555cds/u-boot.lds b/board/freescale/mpc8555cds/u-boot.lds deleted file mode 100644 index 644db2c..0000000 --- a/board/freescale/mpc8555cds/u-boot.lds +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright 2004, 2008 Freescale Semiconductor, Inc. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -OUTPUT_ARCH(powerpc) -/* Do we need any of these for elf? - __DYNAMIC = 0; */ -PHDRS -{ - text PT_LOAD; - bss PT_LOAD; -} - -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - . = + SIZEOF_HEADERS; - .interp : { *(.interp) } - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .rel.text : { *(.rel.text) } - .rela.text : { *(.rela.text) } - .rel.data : { *(.rel.data) } - .rela.data : { *(.rela.data) } - .rel.rodata : { *(.rel.rodata) } - .rela.rodata : { *(.rela.rodata) } - .rel.got : { *(.rel.got) } - .rela.got : { *(.rela.got) } - .rel.ctors : { *(.rel.ctors) } - .rela.ctors : { *(.rela.ctors) } - .rel.dtors : { *(.rel.dtors) } - .rela.dtors : { *(.rela.dtors) } - .rel.bss : { *(.rel.bss) } - .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .init : { *(.init) } - .plt : { *(.plt) } - .text : - { - *(.text) - *(.fixup) - *(.got1) - } :text - _etext = .; - PROVIDE (etext = .); - .rodata : - { - *(.rodata) - *(.rodata1) - *(.rodata.str1.4) - *(.eh_frame) - } :text - .fini : { *(.fini) } =0 - .ctors : { *(.ctors) } - .dtors : { *(.dtors) } - - /* Read-write section, merged into data segment: */ - . = (. + 0x00FF) & 0xFFFFFF00; - _erotext = .; - PROVIDE (erotext = .); - .reloc : - { - *(.got) - _GOT2_TABLE_ = .; - *(.got2) - _FIXUP_TABLE_ = .; - *(.fixup) - } - __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2; - __fixup_entries = (. - _FIXUP_TABLE_) >> 2; - - .data : - { - *(.data) - *(.data1) - *(.sdata) - *(.sdata2) - *(.dynamic) - CONSTRUCTORS - } - _edata = .; - PROVIDE (edata = .); - - . = .; - __u_boot_cmd_start = .; - .u_boot_cmd : { *(.u_boot_cmd) } - __u_boot_cmd_end = .; - - . = .; - __start___ex_table = .; - __ex_table : { *(__ex_table) } - __stop___ex_table = .; - - . = ALIGN(256); - __init_begin = .; - .text.init : { *(.text.init) } - .data.init : { *(.data.init) } - . = ALIGN(256); - __init_end = .; - - __flash_mask = 8M - 1; /* Flash bank is 8 MB */ - .bootpg (ADDR(.text) & ~(__flash_mask)) | (0xfffff000 & __flash_mask) : - { - cpu/mpc85xx/start.o (.bootpg) - } :text = 0xffff - - .resetvec ADDR(.bootpg) + 0xffc : - { - *(.resetvec) - } :text = 0xffff - - .bss ADDR(.bootpg) + 0x1000 (NOLOAD) : - { - __bss_start = ABSOLUTE(.); - *(.sbss) *(.scommon) - *(.dynbss) - *(.bss) - *(COMMON) - } :bss - - . = ALIGN(4); - _end = . ; - PROVIDE (end = .); -} diff --git a/board/freescale/mpc8560ads/u-boot.lds b/board/freescale/mpc8560ads/u-boot.lds deleted file mode 100644 index 2148e12..0000000 --- a/board/freescale/mpc8560ads/u-boot.lds +++ /dev/null @@ -1,147 +0,0 @@ -/* - * (C) Copyright 2002,2003, Motorola,Inc. - * Xianghua Xiao, X.Xiao@motorola.com. - * - * Copyright 2008 Freescale Semiconductor, Inc. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -OUTPUT_ARCH(powerpc) -/* Do we need any of these for elf? - __DYNAMIC = 0; */ -PHDRS -{ - text PT_LOAD; - bss PT_LOAD; -} - -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - . = + SIZEOF_HEADERS; - .interp : { *(.interp) } - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .rel.text : { *(.rel.text) } - .rela.text : { *(.rela.text) } - .rel.data : { *(.rel.data) } - .rela.data : { *(.rela.data) } - .rel.rodata : { *(.rel.rodata) } - .rela.rodata : { *(.rela.rodata) } - .rel.got : { *(.rel.got) } - .rela.got : { *(.rela.got) } - .rel.ctors : { *(.rel.ctors) } - .rela.ctors : { *(.rela.ctors) } - .rel.dtors : { *(.rel.dtors) } - .rela.dtors : { *(.rela.dtors) } - .rel.bss : { *(.rel.bss) } - .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .init : { *(.init) } - .plt : { *(.plt) } - .text : - { - *(.text) - *(.fixup) - *(.got1) - } :text - _etext = .; - PROVIDE (etext = .); - .rodata : - { - *(.rodata) - *(.rodata1) - *(.rodata.str1.4) - *(.eh_frame) - } :text - .fini : { *(.fini) } =0 - .ctors : { *(.ctors) } - .dtors : { *(.dtors) } - - /* Read-write section, merged into data segment: */ - . = (. + 0x00FF) & 0xFFFFFF00; - _erotext = .; - PROVIDE (erotext = .); - .reloc : - { - *(.got) - _GOT2_TABLE_ = .; - *(.got2) - _FIXUP_TABLE_ = .; - *(.fixup) - } - __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2; - __fixup_entries = (. - _FIXUP_TABLE_) >> 2; - - .data : - { - *(.data) - *(.data1) - *(.sdata) - *(.sdata2) - *(.dynamic) - CONSTRUCTORS - } - _edata = .; - PROVIDE (edata = .); - - . = .; - __u_boot_cmd_start = .; - .u_boot_cmd : { *(.u_boot_cmd) } - __u_boot_cmd_end = .; - - . = .; - __start___ex_table = .; - __ex_table : { *(__ex_table) } - __stop___ex_table = .; - - . = ALIGN(256); - __init_begin = .; - .text.init : { *(.text.init) } - .data.init : { *(.data.init) } - . = ALIGN(256); - __init_end = .; - - __flash_mask = 16M - 1; - .bootpg (ADDR(.text) & ~(__flash_mask)) | (0xfffff000 & __flash_mask) : - { - cpu/mpc85xx/start.o (.bootpg) - } :text = 0xffff - - .resetvec ADDR(.bootpg) + 0xffc : - { - *(.resetvec) - } :text = 0xffff - - .bss ADDR(.bootpg) + 0x1000 (NOLOAD) : - { - __bss_start = ABSOLUTE(.); - *(.sbss) *(.scommon) - *(.dynbss) - *(.bss) - *(COMMON) - } :bss - - . = ALIGN(4); - _end = . ; - PROVIDE (end = .); -} diff --git a/board/freescale/mpc8568mds/u-boot.lds b/board/freescale/mpc8568mds/u-boot.lds deleted file mode 100644 index 0c59e8c..0000000 --- a/board/freescale/mpc8568mds/u-boot.lds +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright 2004-2008 Freescale Semiconductor, Inc. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -OUTPUT_ARCH(powerpc) -/* Do we need any of these for elf? - __DYNAMIC = 0; */ -PHDRS -{ - text PT_LOAD; - bss PT_LOAD; -} - -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - . = + SIZEOF_HEADERS; - .interp : { *(.interp) } - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .rel.text : { *(.rel.text) } - .rela.text : { *(.rela.text) } - .rel.data : { *(.rel.data) } - .rela.data : { *(.rela.data) } - .rel.rodata : { *(.rel.rodata) } - .rela.rodata : { *(.rela.rodata) } - .rel.got : { *(.rel.got) } - .rela.got : { *(.rela.got) } - .rel.ctors : { *(.rel.ctors) } - .rela.ctors : { *(.rela.ctors) } - .rel.dtors : { *(.rel.dtors) } - .rela.dtors : { *(.rela.dtors) } - .rel.bss : { *(.rel.bss) } - .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .init : { *(.init) } - .plt : { *(.plt) } - .text : - { - *(.text) - *(.fixup) - *(.got1) - } :text - _etext = .; - PROVIDE (etext = .); - .rodata : - { - *(.rodata) - *(.rodata1) - *(.rodata.str1.4) - *(.eh_frame) - } :text - .fini : { *(.fini) } =0 - .ctors : { *(.ctors) } - .dtors : { *(.dtors) } - - /* Read-write section, merged into data segment: */ - . = (. + 0x00FF) & 0xFFFFFF00; - _erotext = .; - PROVIDE (erotext = .); - .reloc : - { - *(.got) - _GOT2_TABLE_ = .; - *(.got2) - _FIXUP_TABLE_ = .; - *(.fixup) - } - __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2; - __fixup_entries = (. - _FIXUP_TABLE_) >> 2; - - .data : - { - *(.data) - *(.data1) - *(.sdata) - *(.sdata2) - *(.dynamic) - CONSTRUCTORS - } - _edata = .; - PROVIDE (edata = .); - - . = .; - __u_boot_cmd_start = .; - .u_boot_cmd : { *(.u_boot_cmd) } - __u_boot_cmd_end = .; - - . = .; - __start___ex_table = .; - __ex_table : { *(__ex_table) } - __stop___ex_table = .; - - . = ALIGN(256); - __init_begin = .; - .text.init : { *(.text.init) } - .data.init : { *(.data.init) } - . = ALIGN(256); - __init_end = .; - - __flash_mask = 8M - 1; /* Flash bank is 8 MB */ - .bootpg (ADDR(.text) & ~(__flash_mask)) | (0xfffff000 & __flash_mask) : - { - cpu/mpc85xx/start.o (.bootpg) - } :text = 0xffff - - .resetvec ADDR(.bootpg) + 0xffc : - { - *(.resetvec) - } :text = 0xffff - - .bss ADDR(.bootpg) + 0x1000 (NOLOAD) : - { - __bss_start = ABSOLUTE(.); - *(.sbss) *(.scommon) - *(.dynbss) - *(.bss) - *(COMMON) - } :bss - - . = ALIGN(4); - _end = . ; - PROVIDE (end = .); -} diff --git a/board/freescale/mpc8572ds/u-boot.lds b/board/freescale/mpc8572ds/u-boot.lds deleted file mode 100644 index 7ee7d61..0000000 --- a/board/freescale/mpc8572ds/u-boot.lds +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright 2007-2008 Freescale Semiconductor, Inc. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -OUTPUT_ARCH(powerpc) -/* Do we need any of these for elf? - __DYNAMIC = 0; */ -PHDRS -{ - text PT_LOAD; - bss PT_LOAD; -} - -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - . = + SIZEOF_HEADERS; - .interp : { *(.interp) } - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .rel.text : { *(.rel.text) } - .rela.text : { *(.rela.text) } - .rel.data : { *(.rel.data) } - .rela.data : { *(.rela.data) } - .rel.rodata : { *(.rel.rodata) } - .rela.rodata : { *(.rela.rodata) } - .rel.got : { *(.rel.got) } - .rela.got : { *(.rela.got) } - .rel.ctors : { *(.rel.ctors) } - .rela.ctors : { *(.rela.ctors) } - .rel.dtors : { *(.rel.dtors) } - .rela.dtors : { *(.rela.dtors) } - .rel.bss : { *(.rel.bss) } - .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .init : { *(.init) } - .plt : { *(.plt) } - .text : - { - *(.text) - *(.fixup) - *(.got1) - } :text - _etext = .; - PROVIDE (etext = .); - .rodata : - { - *(.rodata) - *(.rodata1) - *(.rodata.str1.4) - *(.eh_frame) - } :text - .fini : { *(.fini) } =0 - .ctors : { *(.ctors) } - .dtors : { *(.dtors) } - - /* Read-write section, merged into data segment: */ - . = (. + 0x00FF) & 0xFFFFFF00; - _erotext = .; - PROVIDE (erotext = .); - .reloc : - { - *(.got) - _GOT2_TABLE_ = .; - *(.got2) - _FIXUP_TABLE_ = .; - *(.fixup) - } - __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2; - __fixup_entries = (. - _FIXUP_TABLE_) >> 2; - - .data : - { - *(.data) - *(.data1) - *(.sdata) - *(.sdata2) - *(.dynamic) - CONSTRUCTORS - } - _edata = .; - PROVIDE (edata = .); - - . = .; - __u_boot_cmd_start = .; - .u_boot_cmd : { *(.u_boot_cmd) } - __u_boot_cmd_end = .; - - . = .; - __start___ex_table = .; - __ex_table : { *(__ex_table) } - __stop___ex_table = .; - - . = ALIGN(256); - __init_begin = .; - .text.init : { *(.text.init) } - .data.init : { *(.data.init) } - . = ALIGN(256); - __init_end = .; - - __flash_mask = 128M - 1; - .bootpg (ADDR(.text) & ~(__flash_mask)) | (0xfffff000 & __flash_mask) : - { - cpu/mpc85xx/start.o (.bootpg) - } :text = 0xffff - - .resetvec ADDR(.bootpg) + 0xffc : - { - *(.resetvec) - } :text = 0xffff - - .bss ADDR(.bootpg) + 0x1000 (NOLOAD) : - { - __bss_start = ABSOLUTE(.); - *(.sbss) *(.scommon) - *(.dynbss) - *(.bss) - *(COMMON) - } :bss - - . = ALIGN(4); - _end = . ; - PROVIDE (end = .); -} diff --git a/cpu/mpc85xx/config.mk b/cpu/mpc85xx/config.mk index 9e574a2..dbf7ddc 100644 --- a/cpu/mpc85xx/config.mk +++ b/cpu/mpc85xx/config.mk @@ -26,3 +26,6 @@ PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi PLATFORM_CPPFLAGS += -DCONFIG_MPC85xx -DCONFIG_E500 -ffixed-r2 \ -Wa,-me500 -msoft-float -mno-string PLATFORM_CPPFLAGS +=$(call cc-option,-mno-spe) + +# Use default linker script. Board port can override in board/*/config.mk +LDSCRIPT := $(SRCTREE)/cpu/mpc85xx/u-boot.lds diff --git a/cpu/mpc85xx/u-boot.lds b/cpu/mpc85xx/u-boot.lds new file mode 100644 index 0000000..404606a --- /dev/null +++ b/cpu/mpc85xx/u-boot.lds @@ -0,0 +1,163 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +/* This file is setup for a flash bank size of 4 MB. This will work for all + * current platforms. It's only a problem if: + * + * A) Your flash bank is less than 4 MB and it is mapped to a location that not + * aligned to the top of a 4 MB boundary. E.g., a 1 MB bank mapped to + * 0xefff0000 is ok, but if it were mapped at 0xeffd0000 then it would be a + * problem. + * + * B) Your U-Boot image is over 4MB in size. The image size for this is from + * TEXT_BASE to the end of the reset vector. It's not the size of the U-Boot + * code as there could be a huge gap between the end of the code and the reset + * vector. The BSS section does not count for this size, as it goes after the + * reset vector (and it not actually present in the image). This should be the + * same as the size of the u-boot.bin file. + * + * If you have such a system, simply create your own boot script that does this: + * __flash_mask = 2M - 1; // For a 2MB flash bank + * INCLUDE cpu/mpc85xx/u-boot.lds + */ + +OUTPUT_ARCH(powerpc) + +PHDRS +{ + text PT_LOAD; + bss PT_LOAD; +} + +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + . = + SIZEOF_HEADERS; + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .rel.text : { *(.rel.text) } + .rela.text : { *(.rela.text) } + .rel.data : { *(.rel.data) } + .rela.data : { *(.rela.data) } + .rel.rodata : { *(.rel.rodata) } + .rela.rodata : { *(.rela.rodata) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.bss : { *(.rel.bss) } + .rela.bss : { *(.rela.bss) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + .init : { *(.init) } + .plt : { *(.plt) } + .text : + { + *(.text) + *(.fixup) + *(.got1) + } :text + _etext = .; + PROVIDE (etext = .); + .rodata : + { + *(.rodata) + *(.rodata1) + *(.rodata.str1.4) + *(.eh_frame) + } :text + .fini : { *(.fini) } =0 + .ctors : { *(.ctors) } + .dtors : { *(.dtors) } + + /* Read-write section, merged into data segment: */ + . = (. + 0x00FF) & 0xFFFFFF00; + _erotext = .; + PROVIDE (erotext = .); + .reloc : + { + *(.got) + _GOT2_TABLE_ = .; + *(.got2) + _FIXUP_TABLE_ = .; + *(.fixup) + } + __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2; + __fixup_entries = (. - _FIXUP_TABLE_) >> 2; + + .data : + { + *(.data) + *(.data1) + *(.sdata) + *(.sdata2) + *(.dynamic) + CONSTRUCTORS + } + _edata = .; + PROVIDE (edata = .); + + . = .; + __u_boot_cmd_start = .; + .u_boot_cmd : { *(.u_boot_cmd) } + __u_boot_cmd_end = .; + + . = .; + __start___ex_table = .; + __ex_table : { *(__ex_table) } + __stop___ex_table = .; + + . = ALIGN(256); + __init_begin = .; + .text.init : { *(.text.init) } + .data.init : { *(.data.init) } + . = ALIGN(256); + __init_end = .; + + PROVIDE(__flash_mask = 4M - 1); + .bootpg (ADDR(.text) & ~(__flash_mask)) | (0xfffff000 & __flash_mask) : + { + *(.bootpg) + } :text = 0xffff + + .resetvec ADDR(.bootpg) + 0xffc : + { + *(.resetvec) + } :text = 0xffff + + .bss ADDR(.bootpg) + 0x1000 (NOLOAD) : + { + __bss_start = ABSOLUTE(.); + *(.sbss) *(.scommon) + *(.dynbss) + *(.bss) + *(COMMON) + } :bss + + . = ALIGN(4); + _end = . ; + PROVIDE (end = .); +}

Dear Trent Piepho,
In message 1223941151-13969-2-git-send-email-tpiepho@freescale.com you wrote:
B) The U-Boot image is over 4MB in size. The image size for this is from TEXT_BASE to the end of the reset vector. It's not the size of the U-Boot code as there could be a huge gap between the end of the code and the reset vector. The BSS section does not count for this size, as it goes after the reset vector (and it not actually present in the image). This should be the same as the size of the u-boot.bin file.
Where is bss then, if you try to locate it beyond the end of physical memory? To the best of my understanding there are two possibilities: tool chains running on a 32 bit host will simply wrapr addresses around, i. e. start placing bss at physical address 0, which is not wrong. I don't remember eacty what you get on 64 bit hosts, but the result is not correct either.
Have you actually tested this code? Didn't you run into such problems?
Best regards,
Wolfgang Denk

On Tue, 14 Oct 2008, Wolfgang Denk wrote:
Dear Trent Piepho,
In message 1223941151-13969-2-git-send-email-tpiepho@freescale.com you wrote:
B) The U-Boot image is over 4MB in size. The image size for this is from TEXT_BASE to the end of the reset vector. It's not the size of the U-Boot code as there could be a huge gap between the end of the code and the reset vector. The BSS section does not count for this size, as it goes after the reset vector (and it not actually present in the image). This should be the same as the size of the u-boot.bin file.
Where is bss then, if you try to locate it beyond the end of physical memory? To the best of my understanding there are two possibilities: tool chains running on a 32 bit host will simply wrapr addresses around, i. e. start placing bss at physical address 0, which is not wrong. I don't remember eacty what you get on 64 bit hosts, but the result is not correct either.
This is where bss goes when u-boot is linked. It gets relocated to a different address in ram.
What the linker scripts *were* doing is putting bss at ADDR(.text) + 0x80000, which ends up being 0 for most boards and 0xf0000000 for some others.
Unless you try to make a non 512K image. Then bss might end up at 0x40000 when it should still be at 0. You could hard code the address 0, there are linker scripts that have done that. But that doesn't work on mpc8572ds for example, which should be 0xf0000000.
The way I'm finding the location to link bss works for all mpc85xx system and for all images sizes. This lets them share the same linker script.
Have you actually tested this code? Didn't you run into such problems?
The resulting u-boot binary is exactly the same. This produces the same binaries as before using one linker script for all 85xx instead of a different one for each board.

Dear Trent,
In message Pine.LNX.4.64.0810140859340.3443@t2.domain.actdsltmp you wrote:
Where is bss then, if you try to locate it beyond the end of physical memory? To the best of my understanding there are two possibilities: tool chains running on a 32 bit host will simply wrapr addresses around, i. e. start placing bss at physical address 0, which is not wrong. I don't remember eacty what you get on 64 bit hosts, but the result is not correct either.
This is where bss goes when u-boot is linked. It gets relocated to a different address in ram.
Where is defined which address it is, then?
Note that this added complexity of image layout is not shared by other architectures.
What the linker scripts *were* doing is putting bss at ADDR(.text) + 0x80000, which ends up being 0 for most boards and 0xf0000000 for some others.
Let's be careful here in our terminology. Your "most boards" is most probably not my "most boards". From the global point of view, "most boards" have a very simple layout like this:
... . = ALIGN(256); __init_begin = .; .text.init : { *(.text.init) } .data.init : { *(.data.init) } . = ALIGN(256); __init_end = .;
__bss_start = .; .bss (NOLOAD) : { *(.sbss) *(.scommon) *(.dynbss) *(.bss) *(COMMON) } _end = . ; PROVIDE (end = .); ...
BTW - this example is from a MPC85xx system...
Unless you try to make a non 512K image. Then bss might end up at 0x40000 when it should still be at 0. You could hard code the address 0, there are
The bss must NEVER, never ever be loated at 0.
The way I'm finding the location to link bss works for all mpc85xx system and for all images sizes. This lets them share the same linker script.
Are you really talking about *all* MPC85xx systems, oronlyu about the FSL boards?
And where is bss in your design at run-time, after relocation?
Have you actually tested this code? Didn't you run into such problems?
The resulting u-boot binary is exactly the same. This produces the same binaries as before using one linker script for all 85xx instead of a different one for each board.
Please define "all 85xx". I tend to doubt that.
Best regards,
Wolfgang Denk

On Tue, 14 Oct 2008, Wolfgang Denk wrote:
In message Pine.LNX.4.64.0810140859340.3443@t2.domain.actdsltmp you wrote:
This is where bss goes when u-boot is linked. It gets relocated to a different address in ram.
Where is defined which address it is, then?
It is determined at run time. Look in cpu/mpc85xx/start.S at relocate_code.
But this has nothing to do with my patch. I'm not touching those files or changing how they work.
Note that this added complexity of image layout is not shared by other architectures.
I suppose locating the reset vector at the bottom instead of the top makes that easier.
What the linker scripts *were* doing is putting bss at ADDR(.text) + 0x80000, which ends up being 0 for most boards and 0xf0000000 for some others.
Let's be careful here in our terminology. Your "most boards" is most probably not my "most boards". From the global point of view, "most boards" have a very simple layout like this:
My most boards is most 85xx boards.
__init_end = .;
__bss_start = .; .bss (NOLOAD) :
BTW - this example is from a MPC85xx system...
This wastes space in the u-boot image. bss is consuming address space between the end of the data section and the boot page that it doesn't need to.
All the Freescale mpc85xx boards have been changed to no longer do this, since this patch:
commit f0ff885ca64655bee6540eb8a25eed90b1152686 Author: Kumar Gala galak@kernel.crashing.org Date: Wed Jul 30 14:13:30 2008 -0500
mpc85xx: Update linker scripts for Freescale boards
* Move to using absolute addressing always. Makes the scripts a bit more portable and common * Moved .bss after the end of the image. These allows us to have more room in the resulting binary image for code and data. ....
It looks like you're looking at something like mpc8540eval, which could probably benefit from this change as well if the maintainer of that board feels like doing it.
BTW, if you continue to look at the mpc8540eval script, just past were you cut it off, you'll see: . = (. & 0xFFF80000) + 0x0007F000; .bootpg :
That 0xFFF80000 comes a flask bank size of 8MB! If __flash_mask = 8M - 1, then ~(__flash_mask) == 0xFFF80000. So don't say I'm *adding* the flash bank size to the linker script. It's already there! I'm just doing it in a better way.
Unless you try to make a non 512K image. Then bss might end up at 0x40000 when it should still be at 0. You could hard code the address 0, there are
The bss must NEVER, never ever be loated at 0.
Seems to be working fine since Jul 30th. This is without my patchs applied, though they don't make any difference.
$ make MPC8548CDS_config && make $ grep ^.bss u-boot.map .bss 0x00000000 0x69b8
OMFG, bss is at zero! Fasten your seatbelts, 'cause we're all gonna crash!
The way I'm finding the location to link bss works for all mpc85xx system and for all images sizes. This lets them share the same linker script.
Are you really talking about *all* MPC85xx systems, oronlyu about the FSL boards?
All the FSL boards, but all the other mpc85xx system could probably do it the same way and use the same linker script that I've made the FSL boards use.
And where is bss in your design at run-time, after relocation?
It's not "my" design. The code's been there since before *I* ever looked at it. And I'm not changing this design either.
Have you actually tested this code? Didn't you run into such problems?
The resulting u-boot binary is exactly the same. This produces the same binaries as before using one linker script for all 85xx instead of a different one for each board.
Please define "all 85xx". I tend to doubt that.
How about this, ALL boards. Every single last one of them. Either my patches don't touch them or they use the new common linker script and get linked in the same way they were before. Go ahead and try applying my first two patches and do a before and after comparison on the u-boot.map file. It's nothing but cosmetic changes, all the code is at the same place.
$ make MPC8548CDS_config && make $ cp u-boot.map u-boot.map.old $ stg push abs-boot && stg push mpc85xx-single-ld-script $ make clean && make $ diff -u u-boot.map.old u-boot.map --- u-boot.map.old 2008-10-14 16:13:59.000000000 -0700 +++ u-boot.map 2008-10-14 16:15:38.000000000 -0700 @@ -1735,19 +1735,19 @@ *(.data.init) 0xfffb3c00 . = ALIGN (0x100) 0xfffb3c00 __init_end = . + 0x003fffff PROVIDE (__flash_mask, 0x3fffff)
.bootpg 0xfffff000 0x1cc - cpu/mpc85xx/start.o(.bootpg) + *(.bootpg) .bootpg 0xfffff000 0x1cc cpu/mpc85xx/start.o 0xfffff000 _start_e500
.resetvec 0xfffffffc 0x4 *(.resetvec) .resetvec 0xfffffffc 0x4 cpu/mpc85xx/resetvec.o - 0x00000000 . = (ADDR (.text) + 0x80000) - 0x00000000 __bss_start = .
.bss 0x00000000 0x69b8 + 0x00000000 __bss_start = <code 345> (.) *(.sbss) .sbss 0x00000000 0x0 cpu/mpc85xx/start.o .sbss 0x00000000 0x8 cpu/mpc85xx/libmpc85xx.a(traps.o)
It's nothing but cosmetic differences. All the objects have the same size and same location as they did pre-patch.

On Tue, 14 Oct 2008, Wolfgang Denk wrote:
In message 1223941151-13969-2-git-send-email-tpiepho@freescale.com you wrote:
B) The U-Boot image is over 4MB in size. The image size for this is from TEXT_BASE to the end of the reset vector. It's not the size of the U-Boot code as there could be a huge gap between the end of the code and the reset vector. The BSS section does not count for this size, as it goes after the reset vector (and it not actually present in the image). This should be the same as the size of the u-boot.bin file.
Where is bss then, if you try to locate it beyond the end of physical memory? To the best of my understanding there are two possibilities: tool chains running on a 32 bit host will simply wrapr addresses around, i. e. start placing bss at physical address 0, which is not wrong. I don't remember eacty what you get on 64 bit hosts, but the result is not correct either.
Have you actually tested this code? Didn't you run into such problems?
It's locate the same place it is now! I'm telling you, these patches don't change the resulting u-boot binaries. How could the same binary stop working because a better build process was used to make it?
And yes I tested the code.
The u-boot image doesn't contain bss. The code is linked to expect bss at a certain location, relative to the rest of the code (because it's compiled PIC). But in the image, and when u-boot is executing from flash, bss doesn't exist. There was a bug in Timur's speed setting patch to the FSL I2C code because of that: it tried to write to bss while running out of flash. When u-boot gets moved from flash to ram, the bss section is created at the new location.
For instance, suppose u-boot is linked at 0xfff8_0000 and bss placed at 0x0000_0000. That how most 85xx platforms work now. After ram is enabled, u-boot is moved to ram at say 0x0010_0000. The bss segment will be created (space in ram set aside and zeroed) at 0x0018_0000. All the PIC code in u-boot that uses variables in bss will use this region starting at 0x0018_0000, because the relative position of 0x0018_0000 vs 0x0010_0000 is the same as 0xfff8_0000 vs 0x0000_0000. Yes, the calculations in the relocation code handle the wrap around correctly. If they didn't nothing would work now.

A recent gcc added a new unaligned rodata section called '.rodata.str1.1' and that needs to be added the the linker script.
Rather than just add that one section, instead use '*(.rodata*)' to catch that section and any future rodata sections.
'*(.rodata*)' by itself will result in sub-optimal section ordering. The section will be sorted by object file, which causes extra padding between the unaligned rodata.str.1.1 of one object file and the aligned rotdata of the next object file. This is easy to fix by using the SORT_BY_ALIGNMENT command.
Signed-off-by: Trent Piepho tpiepho@freescale.com --- cpu/mpc85xx/u-boot.lds | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/cpu/mpc85xx/u-boot.lds b/cpu/mpc85xx/u-boot.lds index 404606a..f7aedc0 100644 --- a/cpu/mpc85xx/u-boot.lds +++ b/cpu/mpc85xx/u-boot.lds @@ -84,10 +84,8 @@ SECTIONS PROVIDE (etext = .); .rodata : { - *(.rodata) - *(.rodata1) - *(.rodata.str1.4) *(.eh_frame) + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } :text .fini : { *(.fini) } =0 .ctors : { *(.ctors) }

Dear Trent Piepho,
In message 1223941151-13969-3-git-send-email-tpiepho@freescale.com you wrote:
A recent gcc added a new unaligned rodata section called '.rodata.str1.1' and that needs to be added the the linker script.
Rather than just add that one section, instead use '*(.rodata*)' to catch that section and any future rodata sections.
This affects *all* boards and should therefore be implemented for *all* boards, not only for 85xx.
Best regards,
Wolfgang Denk

On Tue, 14 Oct 2008, Wolfgang Denk wrote:
Dear Trent Piepho,
In message 1223941151-13969-3-git-send-email-tpiepho@freescale.com you wrote:
A recent gcc added a new unaligned rodata section called '.rodata.str1.1' and that needs to be added the the linker script.
Rather than just add that one section, instead use '*(.rodata*)' to catch that section and any future rodata sections.
This affects *all* boards and should therefore be implemented for *all* boards, not only for 85xx.
The other board's linker scripts are somewhat different. Maybe someone who maintains them and knows them better should do it to make sure it's correct.
In fact, there's already patches that do this for other boards out there.

Dear Trent,
In message Pine.LNX.4.64.0810141354110.3705@t2.domain.actdsltmp you wrote:
This affects *all* boards and should therefore be implemented for *all* boards, not only for 85xx.
The other board's linker scripts are somewhat different. Maybe someone who maintains them and knows them better should do it to make sure it's correct.
I would like to see this in one commit, though, or a small series of connectred commits.
In fact, there's already patches that do this for other boards out there.
Are there? I'm not aware of this. Do you have a link for me?
Best regards,
Wolfgang Denk

On Tue, 14 Oct 2008, Wolfgang Denk wrote:
In message Pine.LNX.4.64.0810141354110.3705@t2.domain.actdsltmp you wrote:
This affects *all* boards and should therefore be implemented for *all* boards, not only for 85xx.
The other board's linker scripts are somewhat different. Maybe someone who maintains them and knows them better should do it to make sure it's correct.
I would like to see this in one commit, though, or a small series of connectred commits.
In fact, there's already patches that do this for other boards out there.
Are there? I'm not aware of this. Do you have a link for me?
I've seen them posted internally at Freescale for a couple months now. Some BSPs are using them. I don't think anyone, besides me, has tried to get any rodata fixes committed upstream. Maybe the thought of fixing 500 other boards they know nothing about is scaring them away? Some links:
http://www.bitshrine.org/gpp/u-boot-1.1.3-mpc832x-rodata-str-1.patch http://www.bitshrine.org/gpp/u-boot-1.1.3-mpc8349itx-rodata-str-1.patch http://www.bitshrine.org/gpp/u-boot-1.3.2-mpc8272ads-rodata-str-1.patch
IMHO, the way I've done it is better.

It wasn't used in one instance where the end of the rotext section is aligned to 256 bytes.
Maybe this alignment isn't necessary? I have to wonder about the alignment of the .data.init and .text.init sections too, since they don't appear to even exist.
Signed-off-by: Trent Piepho tpiepho@freescale.com --- cpu/mpc85xx/u-boot.lds | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/cpu/mpc85xx/u-boot.lds b/cpu/mpc85xx/u-boot.lds index f7aedc0..8af35da 100644 --- a/cpu/mpc85xx/u-boot.lds +++ b/cpu/mpc85xx/u-boot.lds @@ -92,7 +92,7 @@ SECTIONS .dtors : { *(.dtors) }
/* Read-write section, merged into data segment: */ - . = (. + 0x00FF) & 0xFFFFFF00; + . = ALIGN(0x100); _erotext = .; PROVIDE (erotext = .); .reloc :
participants (2)
-
Trent Piepho
-
Wolfgang Denk