[U-Boot] Most ARM CPU's have buggy clear_bss?

Alexander Holler
2010-10-29T14:37:04Z

Hello,

I don't quote the rest, just read the mails before. ;)

Here is the what I've done with the current head and the resulting output:
------------------------------------------------------------------------
dockstar2 u-boot.git # vim drivers/mtd/nand/nand.c (adding printf)
dockstar2 u-boot.git # vim arch/arm/lib/board.c (adding #define DEBUG)
dockstar2 u-boot.git # make distclean
awk '(NF && $1 !~ /^#/) { print $1 ": " $1 "_config; $(MAKE)" }'
boards.cfg > .boards.depend
Generating include/autoconf.mk
dockstar2 u-boot.git # make sheevaplug_config
awk '(NF && $1 !~ /^#/) { print $1 ": " $1 "_config; $(MAKE)" }'
boards.cfg > .boards.depend
Configuring for sheevaplug board...
dockstar2 u-boot.git # make u-boot.bin
Generating include/autoconf.mk
Generating include/autoconf.mk.dep
...
make[1]: Entering directory `/usr/src/u-boot.git/drivers/mtd/nand'
gcc -g -Os -fno-common -ffixed-r8 -msoft-float -D__KERNEL__
-DCONFIG_SYS_TEXT_BASE=0x00700000 -I/usr/src/u-boot.git/include
-fno-builtin -ffreestanding -nostdinc -isystem
/usr/lib/gcc/armv5tel-softfloat-linux-gnueabi/4.5.1/include -pipe
-DCONFIG_ARM -D__ARM__ -marm -mabi=aapcs-linux -mno-thumb-interwork
-march=armv5te -Wall -Wstrict-prototypes -fno-stack-protector \
-o nand.o nand.c -c
...
------------------------------------------------------------------------

Output (I've changed CONFIG_SYS_TEXT_BASE to 0x00700000 along with some
other patches neccessary for my board like different RAM size) to test
u-boot through chainloading):
------------------------------------------------------------------------
Hit any key to stop autoboot: 0
Marvell>> tftpboot 0x700000 u-boot.bin
Using egiga0 device
TFTP from server 192.168.207.1; our IP address is 192.168.207.25
Filename 'u-boot.bin'.
Load address: 0x700000
Loading: ##########################
done
Bytes transferred = 369168 (5a210 hex)
Marvell>> g 0x700000
## Starting application at 0x00700000 ...

U-Boot 2010.12-rc1-00009-g27b7641-dirty (Oct 29 2010 - 15:58:59)
Seagate-DockStar

U-Boot code: 00700000 -> 0075A210 BSS: -> 007A0300
SoC: Kirkwood 88F6281_A0
monitor len: 000A0300
ramsize: 08000000
TLB table at: 07ff0000
Top of RAM usable for U-Boot at: 07ff0000
Reserving 640k for U-Boot at: 07f4f000
Reserving 1152k for malloc() at: 07e2f000
Reserving 48 Bytes for Board Info at: 07e2efd0
Reserving 92 Bytes for Global Data at: 07e2ef74
New Stack Pointer is: 07e2ef70
RAM Configuration:
Bank #0: 00000000 128 MiB
Bank #1: 00000000 0 Bytes
Bank #2: e7dfe27e 4 GiB
Bank #3: 7fdbe1ce 2.7 GiB
relocation Offset is: 0784f000
monitor flash len: 0005A210
Now running in RAM - U-Boot at: 07f4f000
NAND: nand_chip: 0075d198 (this is &nand_chip[0])
(nothing else => killed through calling chip->cmdfunc)
------------------------------------------------------------------------

Output after adding -fPIC:
------------------------------------------------------------------------
Hit any key to stop autoboot: 0
Marvell>> tftpboot 0x700000 u-boot.bin
Using egiga0 device
TFTP from server 192.168.207.1; our IP address is 192.168.207.25
Filename 'u-boot.bin'.
Load address: 0x700000
Loading: ##########################
done
Bytes transferred = 377360 (5c210 hex)
Marvell>> g 0x700000
## Starting application at 0x00700000 ...

U-Boot 2010.12-rc1-00009-g27b7641-dirty (Oct 29 2010 - 16:17:01)
Seagate-DockStar

U-Boot code: 00700000 -> 0075C210 BSS: -> 007A2300
SoC: Kirkwood 88F6281_A0
monitor len: 000A2300
ramsize: 08000000
TLB table at: 07ff0000
Top of RAM usable for U-Boot at: 07ff0000
Reserving 648k for U-Boot at: 07f4d000
Reserving 1152k for malloc() at: 07e2d000
Reserving 48 Bytes for Board Info at: 07e2cfd0
Reserving 92 Bytes for Global Data at: 07e2cf74
New Stack Pointer is: 07e2cf70
RAM Configuration:
Bank #0: 00000000 128 MiB
Bank #1: 00000000 0 Bytes
Bank #2: 0197f8ff 3.3 GiB
Bank #3: 0f0c0cab 3.5 GiB
relocation Offset is: 0784d000
monitor flash len: 0005C210
Now running in RAM - U-Boot at: 07f4d000
NAND: nand_chip: 07fac198 (this is &nand_chip[0])
256 MiB
nand_scan_bbt: Out of memory
ERROR: Cannot import environment: errno = 0

at env_common.c:221/env_import()
*** Warning - import failed, using default environment

ERROR: Environment import failed: errno = 12

at env_common.c:192/set_default_env()
------------------------------------------------------------------------

Up to now I haven't found the time to checked the error I'm getting
here, but at least the output from the printf looks correct. Just ignore
the wrong DRAM sizes, this is already fixed but I haven't that for these
two tests.

The two nand.s are available at my server:

http://ahsoftware.de/nand.s.notworking.gcc.4.5.1_without-fpic

generated with:

gcc -g -Os -fno-common -ffixed-r8 -msoft-float -D__KERNEL__
-DCONFIG_SYS_TEXT_BASE=0x00700000 -I/usr/src/u-boot.git/include
-fno-builtin -ffreestanding -nostdinc -isystem
/usr/lib/gcc/armv5tel-softfloat-linux-gnueabi/4.5.1/include -pipe
-DCONFIG_ARM -D__ARM__ -marm -mabi=aapcs-linux -mno-thumb-interwork
-march=armv5te -Wall -Wstrict-prototypes -fno-stack-protector -S nand.c

http://ahsoftware.de/nand.s.working.gcc.4.5.1_with-fpic

generated with

gcc -g -Os -fno-common -ffixed-r8 -msoft-float -fPIC -D__KERNEL__
-DCONFIG_SYS_TEXT_BASE=0x00700000 -I/usr/src/u-boot.git/include
-fno-builtin -ffreestanding -nostdinc -isystem
/usr/lib/gcc/armv5tel-softfloat-linux-gnueabi/4.5.1/include -pipe
-DCONFIG_ARM -D__ARM__ -marm -mabi=aapcs-linux -mno-thumb-interwork
-march=armv5te -Wall -Wstrict-prototypes -fno-stack-protector -S nand.c

Regards,

Alexander