My latest endaevor has me cross compiling a stand alone application for MPC8548 PPC for a U-Boot Based target. There is no Operating System to run on the target to speak of, just my application. I'm building the application in Code Warrior using an 8548_init.S hardware intialization file.
1) My first thought was that this should be as simple as using the .ELF image that codewarrior produces, right? So I build a simple hello_world application and sent it down to my target. U-Boot recognizes it as an ELF image, sets up the segements, and tries to run it! But then low and behold, the U-Boot flash image comes up again.
=> bootelf 400000
Loading .init @ 0x00002000 (972 bytes)
Loading .text @ 0x000023d0 (7624 bytes)
Loading .rodata @ 0x00004198 (256 bytes)
Loading .ctors @ 0x00004298 (8 bytes)
Loading .dtors @ 0x000042a0 (8 bytes)
Loading extab @ 0x000042a8 (16 bytes)
Loading extabindex @ 0x000042b8 (72 bytes)
Loading .data @ 0x00004300 (1024 bytes)
Loading .sdata @ 0x00004700 (44 bytes)
Clearing .sbss @ 0x00004730 (28 bytes)
Clearing .bss @ 0x00004750 (784 bytes)
Loading .abs.00000c00 @ 0x00000c00 (244 bytes)
## Starting application at 0x00002044 ...
U-Boot 1.3.0 (Jul 21 2008 - 12:20:51)
CPU: 8548_E, Version: 2.1, (0x80390021)
Core: E500, Version: 2.2, (0x80210022)
Clock Configuration:
2) My next thought was to try and wrap it as a stand alone application image using "mkimage" Ok, Great To no avail....
$ mkimage -A ppc -O u-boot -T standalone -C none -a 2000 -e 2044 -n "Hiya stranger" -d debug.bin uDebug.bin
## Total Size = 0x00003ea0 = 16032 Bytes
=> bootm 400000
## Booting image at 00400000 ...
Image Name: Hiya stranger
Image Type: PowerPC U-Boot Standalone Program (uncompressed)
Data Size: 15968 Bytes = 15.6 kB
Load Address: 00002000
Entry Point: 00002044
Verifying Checksum ... OK
OK
NIP: 00000000 XER: 20000000 LR: 0FFD6378 REGS: 0ff9dc98 TRAP: 0700 DAR: 00000000
MSR: 00021200 EE: 0 PR: 0 FP: 0 ME: 1 IR/DR: 00
GPR00: 0FFD634C 0FF9DD88 00000200 00000001 0FFA048C 00000000 00005E5C 00000000
GPR08: 00000000 0FF9E00C 00000170 0FFD398C 0FF9DB70 0000C700 0FFF9A00 10040000
GPR16: 00000000 0FFEC9B4 00000000 00400040 00000001 00400000 00000000 00000001
GPR24: 0FFF52F8 0FFA0488 00000002 00002044 00400040 0FF9DF80 0FFFA2AC 00400000
** Illegal Instruction **
Call backtrace:
0FFD634C 0FFE3790 0FFE28E4 0FFE2D54 0FFD4600 0FFCABC8 0FFC162C
Program Check Exception
NIP: 0
How do I go about exporting my code warrior application so that I can run it as stand-alone on a U-Boot based target? I'm not concerned with preserving the U-Boot libraries, I simply want to launch my own executable image.
Thanks everyone