05-03-2012 06:31 AM
Hi, Xilinx User Community!
It's a little problem with data2mem utility.
I want to place my program for PowerPC440 (Virtex-5FXT) in the last 16K of BRAM.
So, the ".text" section starts from 0xFFFFC000:
[yurig@yurig startup]$ powerpc-eabi-objdump -D startup.elf | head -n 15
startup.elf: file format elf32-powerpc
Disassembly of section .text:
ffffc000 <main0>:
ffffc000: 94 21 ff e0 stwu r1,-32(r1)
ffffc004: 93 e1 00 1c stw r31,28(r1)
ffffc008: 7c 3f 0b 78 mr r31,r1
ffffc00c: 7c 00 04 ac sync
ffffc010: 39 20 00 00 li r9,0
ffffc014: 3c 00 aa aa lis r0,-21846
ffffc018: 60 00 aa aa ori r0,r0,43690
ffffc01c: 90 09 00 00 stw r0,0(r9)
My startup.elf file has the next program headers:
[yurig@yurig startup]$ powerpc-eabi-readelf -l startup.elf
Elf file type is EXEC (Executable file)
Entry point 0xfffffffc
There are 3 program headers, starting at offset 52
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x000000 0xffff0000 0xffff0000 0x0c290 0x0c4a8 RWE 0x10000
LOAD 0x00f000 0xfffff000 0xfffff000 0x005fc 0x005fc R E 0x10000
LOAD 0x00fffc 0xfffffffc 0xfffffffc 0x00004 0x00004 R E 0x10000
Section to Segment mapping:
Segment Sections...
00 .text .bss
01 .vectors .ppcinit .tlbtable
02 .boot
I use data2mem utility to initialize BRAM memory and I think, data2mem makes it wrong, because there is incorrect dump of my *.elf file:
[yurig@yurig data2mem]$ data2mem -bd ../startup.elf -d
Data2MEM ELF file dump.
File = "../startup.elf".
Program header record #0, Size = 0x290, Alignment = 0x10000.
FFFFC000: 7F 45 4C 46 01 02 01 00 00 00 00 00 00 00 00 00 .ELF............
FFFFC010: 02 00 14 00 01 00 00 00 FC FF FF FF 34 00 00 00 ............4...
FFFFC020: 20 06 01 00 00 00 00 00 34 00 20 00 03 00 28 00 .......4. ...(.
FFFFC030: 16 00 13 00 01 00 00 00 00 00 00 00 00 00 FF FF ................
FFFFC040: 00 00 FF FF 90 C2 00 00 A8 C4 00 00 07 00 00 00 ................
FFFFC050: 00 00 01 00 00 00 00 01 00 00 F0 00 FF FF F0 00 ................
FFFFC060: FF FF F0 00 00 00 05 FC 00 00 05 FC 00 00 00 05 ................
FFFFC070: 00 01 00 00 00 00 00 01 00 00 FF FC FF FF FF FC ................
FFFFC080: FF FF FF FC 00 00 00 04 00 00 00 04 00 00 00 05 ................
FFFFC090: 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
P.S. I think, the problem is in the program segment start address and alignment, because for the program starts from 0xFFFF0000 data2mem produce correct dump.
05-06-2012 01:37 AM
the data2mem will dump the contents based on how you have described your BRAM in the BMM file In the dump file from data2mem, the address will only be relevant to the BRAM and not the application address space.
See the AR below for more inofrmation here:
05-10-2012 02:42 AM
The main problem I have is that data2mem can't generate proper *.mem files with contents of *.elf file. If program headers in the *.elf file starts from 0xFFFF0000 (64K-aligned) data2mem works fine. For program started from 0xFFFFC000 or 0xFFFFF000 it doesn't work (bram is initialized to zero values).
The indirect problem is that data2mem produce incorrect dump for file started from 0xFFFFC000 (and correct for 0xFFFF0000).
To dump the elf file contents it's not necessary to specify bmm file, because data2mem read program headers and section headers tables from the *.elf file.
Another issue:
If I use -r key in data2mem ("data2mem -bd ../startup.elf -dr" instead of "data2mem -bd ../startup.elf -d") I have the right output:
[yurig@yurig data2mem]$ data2mem -bd ../startup.elf -dr
Data2MEM ELF file dump.
File = "../startup.elf".
Program header record #0, Size = 0xC290, Alignment = 0x10000.
FFFF0000: 7F 45 4C 46 01 02 01 00 00 00 00 00 00 00 00 00 .ELF............
FFFF0010: 02 00 14 00 01 00 00 00 FC FF FF FF 34 00 00 00 ............4...
FFFF0020: 20 06 01 00 00 00 00 00 34 00 20 00 03 00 28 00 .......4. ...(.
FFFF0030: 16 00 13 00 01 00 00 00 00 00 00 00 00 00 FF FF ................
...
...
FFFFC000: 94 21 FF E0 93 E1 00 1C 7C 3F 0B 78 7C 00 04 AC .!......|?.x|...
FFFFC010: 39 20 00 00 3C 00 AA AA 60 00 AA AA 90 09 00 00 9 ..<...`.......
FFFFC020: 7C 00 04 AC 39 20 12 34 3C 00 12 34 60 00 56 78 |...9 .4<..4`.Vx
FFFFC030: 90 09 00 00 7C 00 04 AC 3C 00 00 FF 60 09 FF FC ....|...<...`...
FFFFC040: 3C 00 55 55 60 00 55 55 90 09 00 00 7C 00 04 AC <.UU`.UU....|...
FFFFC050: 39 20 00 00 80 09 00 00 90 1F 00 08 7C 00 04 AC 9 ..........|...
Does anyone use data2mem for initializing memory? Could you try to do it with program started from 0xFFFFF000?