Skip to contentSkip to conversation

bss section initialization on s3c44b0

U-Boot New Ming-Dien Chang 3 participants 5 messages Apr 1, 2009 – Jun 2, 2009 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

I had a problem of unreasonable value of variable 'top_pad' which should be zero.
After reading .../cpu/s3c44b0/start.S, it seems that .bss section is not been initialized
to zero. Every thing goes fine after patching the .bss initialization. Is it a bug ? Or I missed something ?

Best regards,

Morgan Chang

#1 lore raw

Dear Ming-Dien Chang,

Quoted 7 lines · In message <[email protected]> you wrote:

I had a problem of unreasonable value of variable 'top_pad' which should be zero.
After reading .../cpu/s3c44b0/start.S, it seems that .bss section is not been initialized
to zero. Every thing goes fine after patching the .bss initialization. Is it a bug ? Or I missed something ?

Please submit your patch, so we can discuss it.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
[Doctors and Bartenders], We both get the same two kinds of customers
-- the living and the dying.
	-- Dr. Boyce, "The Menagerie" ("The Cage"), stardate unknown

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

Dear Ming-Dien Chang,

Quoted 26 lines · In message <[email protected]> you wrote:

Sorry for unfamiliar with git diff.
The following snippet is the diff of u-boot 1.3.1 and my working.

Index: Z:/u-boot/u-boot/cpu/s3c44b0/start.S
===================================================================

u-boot/u-boot/cpu/s3c44b0/start.S (revision 9) renamed from u-boot/u-boot/cpu/s3c44b0/start.S (revision 8) +13 -0
@@ -154,6 +154,26 @@
     ble    vector_copy_loop
 #endif    /* CONFIG_SKIP_RELOCATE_UBOOT */
 
+    /*
+     * Initialize .bss section.
+     */
+    mov     r2, #0
+    mov     r3, #0
+    mov     r4, #0
+    mov     r5, #0
+    mov     r6, #0
+    mov     r7, #0
+    mov     r8, #0
+    mov     r9, #0
+    mov     r10, #0
+    ldr     r0, _bss_start

u-boot/u-boot/cpu/s3c44b0/start.S (revision 9) line 179

Quoted 10 lines
u-boot/u-boot/cpu/s3c44b0/start.S (revision 9) renamed from u-boot/u-boot/cpu/s3c44b0/start.S (revision 8) +7 -0
+    ldr     r1, _bss_end
+zerolize:
+    stmia   r0!, {r2-r10}
+    cmp     r0, r1
+    blt     zerolize
+
+
     /* Set up the stack                            */
 stack_setup:
     ldr    r0, _TEXT_BASE        /* upper 128 KiB: relocated uboot   */

This looks good to me. Can you please resubmit this with a proper commit message and your signed-off-by: line added? Please see
http://www.denx.de/wiki/U-Boot/Patches for details.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"And it should be the law: If you use  the  word  `paradigm'  without
knowing  what  the  dictionary  says  it  means,  you  go to jail. No
exceptions."                     - David Jones @ Megatest Corporation
#4 lore raw

PATCH 1/1 bss section initialization on s3c44b0

Clear the .BSS section for S3C44B0 to get a zero-filled .BSS section.

cpu/s3c44b0/start.S +19 -0
index f5a3d3a..a6d27aa 100644
@@ -154,6 +154,25 @@ vector_copy_loop:
        ble     vector_copy_loop
 #endif /* CONFIG_SKIP_RELOCATE_UBOOT */
 
+       /*
+        * Initialize .bss section.
+        */
+       mov     r2, #0
+       mov     r3, #0
+       mov     r4, #0
+       mov     r5, #0
+       mov     r6, #0
+       mov     r7, #0
+       mov     r8, #0
+       mov     r9, #0
+       mov     r10, #0
+       ldr     r0, _bss_start
+       ldr     r1, _bss_end
+zerolize:
+       stmia   r0!, {r2-r10}
+       cmp     r0, r1
+       blt     zerolize
+
        /* Set up the stack                                                 */
 stack_setup:
        ldr     r0, _TEXT_BASE          /* upper 128 KiB: relocated uboot   */
#5 lore raw

PATCH 1/1 bss section initialization on s3c44b0

Quoted 22 lines · Ming-Dien Chang

Clear the .BSS section for S3C44B0 to get a zero-filled .BSS section.

cpu/s3c44b0/start.S +9 -0
index f5a3d3a..a6d27aa 100644
@@ -154,6 +154,25 @@ vector_copy_loop:
        ble     vector_copy_loop
 #endif /* CONFIG_SKIP_RELOCATE_UBOOT */
 
+       /*
+        * Initialize .bss section.
+        */
+       mov     r2, #0
+       mov     r3, #0
+       mov     r4, #0
+       mov     r5, #0
+       mov     r6, #0
+       mov     r7, #0

cpu/s3c44b0/start.S vector_copy_loop: · line 175

Quoted 10 lines
cpu/s3c44b0/start.S +10 -0
+       mov     r8, #0
+       mov     r9, #0
+       mov     r10, #0
+       ldr     r0, _bss_start
+       ldr     r1, _bss_end
+zerolize:
+       stmia   r0!, {r2-r10}
+       cmp     r0, r1
+       blt     zerolize
+

please use the same code as other arm cpu start.S

as example cpu/arm926ejs/start.S

Best Regards,
J.