[U-Boot] [PATCH 06/22] arm: new labels in the linker script file

Po-Yu Chuang ratbert.chuang at gmail.com
Tue Mar 8 11:12:40 CET 2011


Hi Aneesh,

On Mon, Feb 28, 2011 at 7:46 PM, Aneesh V <aneesh at ti.com> wrote:
> _bss_start_ofs is used in start.S to indicate end of copied
> image. This may not be correct when we have a discontiguous
> memory map. For instance, .bss may be placed in SDRAM for
> some SPLS while rest of the image is placed in SRAM.
>
> Define a new label in linker script to indicate the end of the
> image copied during relocation and use it appropriately in
> start.S.
>
> Also, add a new label to indicate the end of flash image.
> This will be useful in identifying the size of flash image
>
> Signed-off-by: Aneesh V <aneesh at ti.com>
> ---
>  arch/arm/cpu/armv7/start.S    |    6 +++++-
>  arch/arm/cpu/armv7/u-boot.lds |    4 ++++
>  2 files changed, 9 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S
> index 3618190..8215d26 100644
> --- a/arch/arm/cpu/armv7/start.S
> +++ b/arch/arm/cpu/armv7/start.S
> @@ -77,6 +77,10 @@ _TEXT_BASE:
>  _bss_start_ofs:
>        .word __bss_start - _start
>
> +.global        _image_copy_end_ofs
> +_image_copy_end_ofs:
> +       .word   __image_copy_end - _start
> +
>  .globl _bss_end_ofs
>  _bss_end_ofs:
>        .word _end - _start
> @@ -172,7 +176,7 @@ stack_setup:
>        beq     clear_bss               /* skip relocation */
>  #endif
>        mov     r1, r6                  /* r1 <- scratch for copy_loop */
> -       ldr     r3, _bss_start_ofs
> +       ldr     r3, _image_copy_end_ofs
>        add     r2, r0, r3              /* r2 <- source end address         */
>
>  copy_loop:
> diff --git a/arch/arm/cpu/armv7/u-boot.lds b/arch/arm/cpu/armv7/u-boot.lds
> index 5725c30..c3ad587 100644
> --- a/arch/arm/cpu/armv7/u-boot.lds
> +++ b/arch/arm/cpu/armv7/u-boot.lds
> @@ -55,6 +55,8 @@ SECTIONS
>
>        . = ALIGN(4);
>
> +       __image_copy_end = .;
> +
>        .rel.dyn : {
>                __rel_dyn_start = .;
>                *(.rel*)
> @@ -66,6 +68,8 @@ SECTIONS
>                *(.dynsym)
>        }
>
> +       __flash_image_end = .;
> +
>        .bss __rel_dyn_start (OVERLAY) : {
>                __bss_start = .;
>                *(.bss)

There is a patch series which makes _end as end of image and
has been applied to arm branch.

[U-Boot] [PATCH 1/2 v2] rename _end to __bss_end__
http://lists.denx.de/pipermail/u-boot/2011-March/088166.html

[U-Boot] [PATCH 2/2 v2] arm: fix incorrect monitor protection	region in FLASH
http://lists.denx.de/pipermail/u-boot/2011-March/088139.html

You can use the newly added symbol _end_ofs to replace your
__flash_image_end here.

best regards,
Po-Yu Chuang


More information about the U-Boot mailing list