
dear wolfgang,
On Fri, 25 Mar 2011, Wolfgang Denk wrote:
Add ENTRY() command to the linker script so that entry point is correctly marked in the final ELF file.
Which exact problem are you trying to fix?
i'm sorry, i probably should have been more verbose in the changelog.
when cross-compiling u-boot for the avnet virtex-4 minimodule (make fx12mm_config; make, with SYS_TEXT_BASE=0x02000000) i end up with a u-boot.lds linker script that has no ENTRY() command.
this will result in an incorrect ELF file: the entry point in the ELF header points to the first byte of the first loadable segment (which is ~the version string at 0x02000004: "U-Boot 2011..") instead of the first instruction to be executed at _start (at 0x02002100 in this case).
powerpc-405-linux-gnu-readelf -e u-boot:
ELF Header: Magic: 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, big endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: PowerPC Version: 0x1 Entry point address: 0x2000000 ..
powerpc-405-linux-gnu-objdump -d u-boot:
Disassembly of section .text:
02000000 <version_string-0x4>: 2000000: 27 05 19 56 dozi r24,r5,6486
02000004 <version_string>: 2000004: 55 2d 42 6f rlwinm. r13,r9,8,9,23 2000008: 6f 74 20 32 xoris r20,r27,8242 200000c: 30 31 31 2e addic r1,r17,12590 2000010: 30 33 2d 72 addic r1,r19,11634 ...
02002100 <_start>: 2002100: 38 80 00 00 li r4,0 2002104: 7c 99 eb a6 mtpmc1 r4 2002108: 7c 9a eb a6 mtdcwr r4 200210c: 7c 94 f3 a6 mtesr r4 2002110: 7c 9a f3 a6 mttcr r4 ...
anything trying to load and run this ELF file (eg xilinx's XMD debugger, or a bootloader stored in the FPGA fabric) will fail to do so because the processor will jump to 0x02000000 and try to execute the version string.
best regards,