Skip to contentSkip to conversation

hello_world crashes U-Boot

U-Boot-Users Andrew Wozniak 1 participant 2 messages Apr 17, 2005

lore
Share & tools
lore
#0 lore raw

Hi,

I still need to investigate this further, but figured that a post might encourage some suggestions about this interesting issue.

hello_word was built with the default Makefile for the PPC440GX and it runs just fine. But when it is modified so that "no" stdio is used and a structure init is attempted, it crashed U-Boot (see attachment) when hello_world returns.

int hello_world (int argc, char *argv[])

{
         struct pci_controller thehose = {0};

	app_startup(argv);
	return (0);
}

The interesting part is that when one or more stdio functions is added, printf() for example, there is no crash.

I was hoping that someone else might be able to reproduce this crash.

My current U-Boot image has about 8 exported functions in addition to the default ones. hello_world was built against this image to insure ABI compatibility.

Thanks for any suggestions, Andrew
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: crash.txt
Url: http://lists.denx.de/pipermail/u-boot/attachments/20050417/d734cf83/attachment.txt

#1 lore raw

Hi, I spent more time invstigating and found that when I use {3} as init data, U-Boot no longer hangs.

I also captured the hello_world .bin and .map files for the two (OK,BAD) cases and found these binary difference:

OK: 00000000: 00 01 82 50 94 21 FF E0 7C 08 02 A6 BF 81 00 10 BAD:00000000: 94 21 FF E0 7C 08 02 A6 BF 81 00 10 90 01 00 24

Interesting that the "entry" location has shifted.

Also, the BAD .map file is missing the following entries:

<snip>
*(.rodata.rodata.*.gnu.linkonce.r.*)
.rodata 0x00040260 0x8 hello_world.o

...

*(.got2)
.got2 0x00050268 0x4 hello_world.o
<snip>

Could all of this be a GCC bug? I am running ppc_405-gcc version 3.2.1

Thanks again for any suggestions.

Quoted 54 lines · Andrew Wozniak

Hi,

I still need to investigate this further, but figured that a post might encourage some suggestions about this interesting issue.

hello_word was built with the default Makefile for the PPC440GX and it runs just fine. But when it is modified so that "no" stdio is used and a structure init is attempted, it crashed U-Boot (see attachment) when hello_world returns.

int hello_world (int argc, char *argv[])

{
        struct pci_controller thehose = {0};

    app_startup(argv);
    return (0);
}

The interesting part is that when one or more stdio functions is added, printf() for example, there is no crash.

I was hoping that someone else might be able to reproduce this crash.

My current U-Boot image has about 8 exported functions in addition to the default ones. hello_world was built against this image to insure ABI compatibility.

Thanks for any suggestions, Andrew

------------------------------------------------------------------------

=> go 40004
## Starting application at 0x00040004 ...
## Application terminated, rc = 0x0
NIP: 00000000 XER: 00000000 LR: 00000000 REGS: 00365c20 TRAP: 0700 DAR: 00000000
MSR: 00029000 EE: 1 PR: 0 FP: 0 ME: 1 IR/DR: 00

GPR00: 00000000 00365D10 0000FFFF 00000000 0000000A 00000001 00000001 8D3F9F08
GPR08: 003D0900 00000001 877832C6 00000005 00000000 21000000 003F3100 00446000
GPR16: 80050000 00028100 00000000 80000002 00009000 00365AF8 00000000 00000001
GPR24: 00365E28 00000000 00365DF8 003C819C 0EFB0311 00000001 003D08FC 00365DF8 ** Illegal Instruction **
Call backtrace:
00000000 03000000
Program Check Exception
NIP: 00000000 XER: 00000000 LR: 00000000 REGS: 00365c20 TRAP: 0700 DAR: 00000000
MSR: 00029000 EE: 1 PR: 0 FP: 0 ME: 1 IR/DR: 00

GPR00: 00000000 00365D10 0000FFFF 00000000 0000000A 00000001 00000001 8D3F9F08
GPR08: 003D0900 00000001 877832C6 00000005 00000000 21000000 003F3100 00446000
GPR16: 80050000 00028100 00000000 80000002 00009000 00365AF8 00000000 00000001
GPR24: 00365E28 00000000 00365DF8 003C819C 0EFB0311 00000001 003D08FC 00365DF8 ** Illegal Instruction **