cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
4t4t
Visitor
Visitor
8,463 Views
Registered: ‎05-25-2010

Merge 2 .elf files, how I do??

I have an XPS Project, 1 general bitstream(hardware Project) and 2 .elf files(software projects) : my linux image and the .elf of an x software(c coded, with xilinx libraries).

 As i mentioned above, my unique bitstream is working very well for both of it in a stand alone way, but the problem is that files are “separated” in two elf files,   i want to “merge” the pair of files,  the target is execute the x software inside the linux  embedded system  shell as a normal program execution 

 

I tried this problem in a lot of different ways,

+ tried the emulation of powerpc 405 in a linux with Qemu, but I cant compile the software in a regular image emulation,

+ the recompile outside of XPS for the file, for only obtain the object(-c compiler option) without the linking work  an .elf    contains

 + the recompile of the linux kernel with a manipulation of the ramdisk to pass the .elf, in this last step, I run the .elf from the       command line in the virtex and it says:

 

    Killed

 

It doesn`t run, and this last chance, was the more closer of the success I was…

 

Questions:

 

1.   can I do it with linker  script configuration??? and if  yes, how to make  the linker script??

2.  when I recompile but not link (-c parameter of compiler) it  makes an file without errors, is there a way for linking and          make the linux normal executable, without create the .elf  linking?????

3. the .elf files are really executable??? if yes why the response is "Killed"  it could be because the structure of the .elf files(as I suspect)??????????

4. do you have a different idea of how to do it???

 

 

Im too… “HASTA LA MADRE” and i want to know if you can help me please, please…..???

 

 

Thanks a LOT

 

Víctor

 

PD Using Virtex4-ml403fx12 with xilinx EDK 10.1 and ISE 10.1

0 Kudos
Reply
6 Replies
linnj
Xilinx Employee
Xilinx Employee
8,449 Views
Registered: ‎09-10-2008

I'm not clear why you're needing to merge the elfs.

 

It almost sounds like your not putting a linux application on the ramdisk as you should, but maybe I'm confused.

 

If I wanted to merge elfs, I'd start looking at objcopy utility.

 

Thanks.

0 Kudos
Reply
4t4t
Visitor
Visitor
8,434 Views
Registered: ‎05-25-2010

Hi john, 

 

The basic idea is run linux, inside linux run the another file, by using the same hardware bitstream, but with the advantages of my operating system.....

 

Respect of the ramdisk the same file I put on the image, I download to the target board and it doesnt have problems to run.... it runs perfectly, 

 

I follow the instructions of:  http://xilinx.wikidot.com/expanding-file-system to make the new ramdisk file...

 

 

 how I do to run a .elf file?? maybe I dont know how to do it...

why is killed,another idea ....  it can be because use of the GPR`s of the PPC405 are used for it and at the same time are used for the  X software???????

 

 

 OBJCOPY, I will check this, 

 

I know that an .elf have some important sections,what is the parts of file that I must copy, for only copy the exec code...?

 

and after that? I simply execute?  re link it?? it return us to one of my first questions...

 

There is a way to compile the file, to generate an (no .elf) normal linux executable file ????

 

 

 i need find the solution anyway....

 

thanks for your help...

 

Víctor

 

 

 

 

 

 

0 Kudos
Reply
linnj
Xilinx Employee
Xilinx Employee
8,421 Views
Registered: ‎09-10-2008

If I understand what you mean, you can't do that.

 

It sounds like you want to run a stand alone application from Linux and you can't do that.

 

Applications must be Linux applications, not stand alone.

 

But maybe I'm still confused.

0 Kudos
Reply
4t4t
Visitor
Visitor
8,418 Views
Registered: ‎05-25-2010

 


@linnj wrote:

 

 

Applications must be Linux applications, not stand alone.

 


Hi john

 

YES, is exactly that... im only want to generate a linux normal application( with my c code), thats` all!!

 

but the powerpc-gcc-eabi makes me a .elf file.... and it doesn`t  run inside the linux... its why I need generate a normal application, you aren`t too confused... (I dont want conserve the stand alone code and work with it)

 

 

and its why i need to "merge" or generate an elf that runs linux and after these c routine   OR

 

generate a linux application and put it on a ramdisk for execute the app code  on my embedded system...

 

 

Thanks

 

 

Víctor

 

I ´ve been reading a bit more of the "KILLED" statement, and anothers said that is because its trying to assign memory(malloc), its probably because the .elf tries to initialize the system from the bootloop...  (bRams??)

 

what do you think about it...?

 

 

 

0 Kudos
Reply
linnj
Xilinx Employee
Xilinx Employee
8,415 Views
Registered: ‎09-10-2008

You're using the wrong tools.

 

You need to be using a set of Linux tools to generate a Linux application, like the ELDK from denx.

 

The EDK tools generate stand alone apps (no OS) which will not run in Linux.

 

The GNU tools must be glibc based to use for Linux applications.  The EDK tools are newlib based.

 

Thanks.

0 Kudos
Reply
4t4t
Visitor
Visitor
8,397 Views
Registered: ‎05-25-2010

OK, OK,  thanks

 

I understand my error at this moment

 

because I tried to compile before post in eldk too, but with the headers of xilinx, cause of my error !!!!

 

But its my next question...

 

if I have  my code as follows: 

 

 


volatile Xint32 __attribute__ ((aligned (32))) src[4] = {214,49,-3,20};
volatile Xint32 __attribute__ ((aligned (32))) dst[4] = {-1,-1,-1,-1};

#define stdfcmx(rn, base, adr)    __asm__ __volatile__(\
                                   "stdfcmx " #rn ",%0,%1\n"\
                                   : : "b" (base), "r" (adr)\
                                 )
volatile Xint32 __attribute__ ((aligned (32))) src[4] = {214,49,-3,20};
volatile Xint32 __attribute__ ((aligned (32))) dst[4] = {-1,-1,-1,-1};
  XCache_EnableDCache(0x80000001);
  XCache_EnableICache(0x80000001);
  mtmsr(XREG_MSR_APU_AVAILABLE);

how i do to translate  the instructions above to standard C code??
I tried to recompile newly my c code, but i obtain an error in xpseudo_asm_gcc.c
can i replace this library with a standard c library for create it...??
the volatile xint32 i want to change by arrays what do you think
thanks a LOT!!!
is there a light at the end of tunnel......
Víctor

 

0 Kudos
Reply