arm: fix incorrect monitor protection region in FLASH
authorPo-Yu Chuang <ratbert@faraday-tech.com>
Tue, 1 Mar 2011 23:02:04 +0000 (23:02 +0000)
committerAlbert Aribaud <albert.aribaud@free.fr>
Sun, 27 Mar 2011 17:18:52 +0000 (19:18 +0200)
Monitor protection region in FLASH did not cover .rel.dyn
and .dynsym sections, because it uses __bss_start to compute
monitor_flash_len. Use _end instead.

Add _end to linker scripts for end of u-boot image
Add _end_ofs to all the start.S.

Signed-off-by: Po-Yu Chuang <ratbert@faraday-tech.com>
31 files changed:
arch/arm/cpu/arm1136/start.S
arch/arm/cpu/arm1136/u-boot.lds
arch/arm/cpu/arm1176/start.S
arch/arm/cpu/arm1176/u-boot.lds
arch/arm/cpu/arm720t/start.S
arch/arm/cpu/arm720t/u-boot.lds
arch/arm/cpu/arm920t/ep93xx/u-boot.lds
arch/arm/cpu/arm920t/start.S
arch/arm/cpu/arm920t/u-boot.lds
arch/arm/cpu/arm925t/start.S
arch/arm/cpu/arm925t/u-boot.lds
arch/arm/cpu/arm926ejs/start.S
arch/arm/cpu/arm926ejs/u-boot.lds
arch/arm/cpu/arm946es/start.S
arch/arm/cpu/arm946es/u-boot.lds
arch/arm/cpu/arm_intcm/start.S
arch/arm/cpu/arm_intcm/u-boot.lds
arch/arm/cpu/armv7/start.S
arch/arm/cpu/armv7/u-boot.lds
arch/arm/cpu/ixp/start.S
arch/arm/cpu/ixp/u-boot.lds
arch/arm/cpu/lh7a40x/start.S
arch/arm/cpu/lh7a40x/u-boot.lds
arch/arm/cpu/pxa/start.S
arch/arm/cpu/pxa/u-boot.lds
arch/arm/cpu/s3c44b0/start.S
arch/arm/cpu/s3c44b0/u-boot.lds
arch/arm/cpu/sa1100/start.S
arch/arm/cpu/sa1100/u-boot.lds
arch/arm/include/asm/u-boot-arm.h
arch/arm/lib/board.c

index 64426fa2a8483459bddee915c0b6caa08d687e7c..3c5f3ef5fab1ca6f5bb2bce45070487f7cd302d5 100644 (file)
@@ -104,6 +104,10 @@ _bss_start_ofs:
 _bss_end_ofs:
        .word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+       .word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
index 1e0e90b4afebeee45ec535b902c31d750b106152..d1e28518ad80b5a83c90e2198711628d936b9719 100644 (file)
@@ -72,6 +72,8 @@ SECTIONS
                *(.dynsym)
        }
 
+       _end = .;
+
        .bss __rel_dyn_start (OVERLAY) : {
                __bss_start = .;
                *(.bss)
index c1302df6535efce7f9f7c305dfa655603ebd8708..6ae118ac45a67c46501e659ffc9365868e1e91b1 100644 (file)
@@ -123,6 +123,10 @@ _bss_start_ofs:
 _bss_end_ofs:
        .word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+       .word _end - _start
+
 /* IRQ stack memory (calculated at run-time) + 8 bytes */
 .globl IRQ_STACK_START_IN
 IRQ_STACK_START_IN:
index 170e516550824f968994af59acfabeffee15e1f8..27d66380bdfca839b8440a747b9662c7da936ffc 100644 (file)
@@ -61,6 +61,8 @@ SECTIONS
                *(.dynsym)
        }
 
+       _end = .;
+
        .bss __rel_dyn_start (OVERLAY) : {
                __bss_start = .;
                *(.bss)
index c521753f3bb22b1bf31919bf9774cea06387f1c8..e774c3ff678cf0a8d726e4630534684d61edfd0f 100644 (file)
@@ -93,6 +93,10 @@ _bss_start_ofs:
 _bss_end_ofs:
        .word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+       .word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
index deda9fb0db1184b25ebca069e1c4b9dd3b1b4e4f..9370fadcf5c5a5f69be29afa42e7ed3b4e69eae9 100644 (file)
@@ -62,6 +62,8 @@ SECTIONS
                *(.dynsym)
        }
 
+       _end = .;
+
        .bss __rel_dyn_start (OVERLAY) : {
                __bss_start = .;
                *(.bss)
index 4cc82a54b1871ffb2c3042fd658053d4937b7bbd..dc6ba34082ecd33e58e8b989f83e82b84a3fe6f2 100644 (file)
@@ -56,4 +56,6 @@ SECTIONS
        __bss_start = .;
        .bss : { *(.bss) }
        __bss_end__ = .;
+
+       _end = .;
 }
index 6db61c215c515c458d2ef494d937356cca81d126..a7476b0550b99e9cbfa265bd5a830d418a60f297 100644 (file)
@@ -89,6 +89,10 @@ _bss_start_ofs:
 _bss_end_ofs:
        .word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+       .word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
index d6dc21c55ddbe2247dea556e62fad2c03d7064ee..17ba60423ba22cb59a79752343eb4e7e8ab90d5d 100644 (file)
@@ -71,6 +71,8 @@ SECTIONS
                *(.dynsym)
        }
 
+       _end = .;
+
        .bss __rel_dyn_start (OVERLAY) : {
                __bss_start = .;
                *(.bss)
index b89cf4ae813cfede5094529f17c80c41016dbd81..39f2e997d29100f2a455bec1c647ddca1943da2a 100644 (file)
@@ -99,6 +99,10 @@ _bss_start_ofs:
 _bss_end_ofs:
        .word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+       .word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
index 4ad1f8ed075529503070655dd521fc1e39a33406..64e76f55e361de44e2830239cfb61150e2f5c296 100644 (file)
@@ -66,6 +66,8 @@ SECTIONS
                *(.dynsym)
        }
 
+       _end = .;
+
        .bss __rel_dyn_start (OVERLAY) : {
                __bss_start = .;
                *(.bss)
index 7798ef82a9e3e738cb11d9b90d7be6120dfbafad..fefcfa2f886819d9e07c21a435c5fdd2db2870e6 100644 (file)
@@ -133,6 +133,10 @@ _bss_start_ofs:
 _bss_end_ofs:
        .word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+       .word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
index b7a5b9e66f0247dc6580b32b866a3d0b1a77bcd5..1480e0c960f0d6ded8a973beec20d8739a5c426b 100644 (file)
@@ -63,6 +63,8 @@ SECTIONS
                *(.dynsym)
        }
 
+       _end = .;
+
        .bss __rel_dyn_start (OVERLAY) : {
                __bss_start = .;
                *(.bss)
index 1b6b188516cf8d3ebed632ecd617945fceee1b18..00914f42e9cde5829426cb21f1a6eff66acf2889 100644 (file)
@@ -105,6 +105,10 @@ _bss_start_ofs:
 _bss_end_ofs:
        .word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+       .word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
index fe4a646dfdd45ec1b1681cf44fb34cd6b6ab0683..ff938e44d8ff9b364d70dcd6262005eeedd7a6db 100644 (file)
@@ -63,6 +63,8 @@ SECTIONS
                *(.dynsym)
        }
 
+       _end = .;
+
        .bss __rel_dyn_start (OVERLAY) : {
                __bss_start = .;
                *(.bss)
index da2c265fcbbacf352233261360ddb4b8a159a02b..2fd3b9a05a38cfc990003e752af77220f0a559bf 100644 (file)
@@ -101,6 +101,10 @@ _bss_start_ofs:
 _bss_end_ofs:
        .word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+       .word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
index 899fab06ff7b845e0aeef051a213be59e67b6178..f4a146c9a811bab0d491d04548e2f46ffe87d523 100644 (file)
@@ -63,6 +63,8 @@ SECTIONS
                *(.dynsym)
        }
 
+       _end = .;
+
        .bss __rel_dyn_start (OVERLAY) : {
                __bss_start = .;
                *(.bss)
index bc7bae85c02a49af463079510be8ed41952f2305..d83d50183796ed29e509cb2e2695d529a095f6b6 100644 (file)
@@ -81,6 +81,10 @@ _bss_start_ofs:
 _bss_end_ofs:
        .word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+       .word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
index de8024459dd19f1c1391646f929bf261019e32cb..dbae54d4f8a340076d894608688e8b77bdab8af9 100644 (file)
@@ -66,6 +66,8 @@ SECTIONS
                *(.dynsym)
        }
 
+       _end = .;
+
        .bss __rel_dyn_start (OVERLAY) : {
                __bss_start = .;
                *(.bss)
index f8bfed7cc61074962f53389d2d4b4437e639b44c..561c1f4795d7cacff637c603f4af23e8e28f9a43 100644 (file)
@@ -112,6 +112,10 @@ _bss_start_ofs:
 _bss_end_ofs:
        .word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+       .word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
index 7029c6c7d9c1a543d46a86fcc836b0f07533f579..3587f8aa6bee87c4c6641efff9aced1d129415d2 100644 (file)
@@ -63,6 +63,8 @@ SECTIONS
                *(.dynsym)
        }
 
+       _end = .;
+
        .bss __rel_dyn_start (OVERLAY) : {
                __bss_start = .;
                *(.bss)
index bd821a270d9e7683d3ac013d13876d317bd838d5..81242b1ed489d9120ada649b87e1e59c5e0f7176 100644 (file)
@@ -89,6 +89,10 @@ _bss_start_ofs:
 _bss_end_ofs:
        .word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+       .word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
index b15ab1e572cf88cc6eac8916d1fd4185586a090a..30934ff3e3d9321c952685b15a631c794a0e4904 100644 (file)
@@ -63,6 +63,8 @@ SECTIONS
                *(.dynsym)
        }
 
+       _end = .;
+
        .bss __rel_dyn_start (OVERLAY) : {
                __bss_start = .;
                *(.bss)
index ca072c474492303f19bbb77243306b1899ab936c..f1dbc3b35d638819f6434e981bb32db7d3d1e0bc 100644 (file)
@@ -106,6 +106,10 @@ _bss_start_ofs:
 _bss_end_ofs:
        .word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+       .word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
index dfb9b77535b908aad051cf4e77d091267f7205e2..e163369bc3464f97fa9439cd9c305b6364af7d0e 100644 (file)
@@ -63,6 +63,8 @@ SECTIONS
                *(.dynsym)
        }
 
+       _end = .;
+
        .bss __rel_dyn_start (OVERLAY) : {
                __bss_start = .;
                *(.bss)
index ac1c4fb58e62c51e1bafd512aa4ce72410e192d3..10f5284d457da053e83cd2f4577ac7c62fa3eb08 100644 (file)
@@ -80,6 +80,10 @@ _bss_start_ofs:
 _bss_end_ofs:
        .word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+       .word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
index 797edbc9438fcc563a795461042eb1e1715871a2..74a259c0d573bc48f35d94b18aed0f84450c56cb 100644 (file)
@@ -63,6 +63,8 @@ SECTIONS
                *(.dynsym)
        }
 
+       _end = .;
+
        .bss __rel_dyn_start (OVERLAY) : {
                __bss_start = .;
                *(.bss)
index 5cfe19bcc59e12bcc96971462cfa4ff38d7c471d..b27e9701528cb9ff3528e3cc3e80ced9b2234ff5 100644 (file)
@@ -90,6 +90,10 @@ _bss_start_ofs:
 _bss_end_ofs:
        .word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+       .word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
index 0ac13296b91639fa317755e98a20198c7ba64ccd..e6381dacf6df4638e52e65cdc1357ed1e8bfe130 100644 (file)
@@ -66,6 +66,8 @@ SECTIONS
                *(.dynsym)
        }
 
+       _end = .;
+
        .bss __rel_dyn_start (OVERLAY) : {
                __bss_start = .;
                *(.bss)
index 33973a32e0b029ce61fb201d9cd3ea7e5b801221..3904027016e69bb31e6579b72f6133d74b8d89ee 100644 (file)
@@ -32,6 +32,7 @@
 /* for the following variables, see start.S */
 extern ulong _bss_start_ofs;   /* BSS start relative to _start */
 extern ulong _bss_end_ofs;             /* BSS end relative to _start */
+extern ulong _end_ofs;         /* end of image relative to _start */
 extern ulong IRQ_STACK_START;  /* top of IRQ stack */
 extern ulong FIQ_STACK_START;  /* top of FIQ stack */
 extern ulong _TEXT_BASE;       /* code start */
index c620d2c200616f0e6a04a49fab2a90876e0be2d7..dc46e21dba521a532af1ac2a6dd83e28bfccc626 100644 (file)
@@ -459,7 +459,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
        gd->flags |= GD_FLG_RELOC;      /* tell others: relocation done */
 
-       monitor_flash_len = _bss_start_ofs;
+       monitor_flash_len = _end_ofs;
        debug ("monitor flash len: %08lX\n", monitor_flash_len);
        board_init();   /* Setup chipselects */