[U-Boot-Users] .bss section problem

Paolo Broggini pbroggini at softool.ch
Thu Sep 2 08:51:03 CEST 2004


Hi there,

I'm working on the port of U-Boot to a new custom board based on the i.MX1
(ARM920T). I noticed that
in the start.S the code in which the .bss will be cleared, loops until
_bss_start != _bss_end i.e.

clear_bss:
	ldr	r0, _bss_start	/* find start of bss segment        */
	add	r0, r0, #4		/* start at first byte of bss       */
	ldr	r1, _bss_end	/* stop here                        */
	mov 	r2, #0x00000000	/* clear                            */

clbss_l:str	r2, [r0]		/* clear loop...                    */
	add	r0, r0, #4
	cmp	r0, r1
	bne	clbss_l

So, when _bss_end is not forced to be .ALIGNED(4) like the _bss_start is,
the code may loops till
it crashs :-(  This is what actually happened in my case.
Now to fix the problem on my port I changed my u-boot.lds as:

	. = ALIGN(4);
	__bss_start = .;
	.bss : { *(.bss) }
	_end = ALIGN(4);

and to be consistent I replaced the 'bne clbss_1' with 'ble clbss_1'
instruction.

I was wondering if I'm missing something on the linker directives or indeed
it is small bug.

Thanks for your suggestions,
-Paolo Broggini





More information about the U-Boot mailing list