Sorry slutarius, don't want to hijack your post, but my doubt needs to be discussed here, as per ads-ee's comment.
The elf file is a text file, so why would you need to change it from elf to hex?
Because a hex file can be looked upon easily as an instruction memory by a processor that can be read by VHDL and Verilog.
An elf file is a standard binary format made up of one ELF header, followed by file data. Sure it is in text format. But it might be my ignorance or less experience, I have not see any processor reading directly an elf file.
A couple of years ago, I was working on the instruction set modification of a 32bit x86 based processor. For testing the uP core interfaces (SPI, IIC), I was writing simple C codes, which was intended to serve as fodder for the instruction memory of the uP. This is uP was implemented on Spartan6 and blocks RAMs were serving as the instruction memory.
Custom tool chains and Makefiles were provided using which were used to first convert my C code/s to elf/bin and then to hex format. The top-level Verilog file would just read-in the hex file and execute the instructions there in. This was all done for the simulation.
Xilinx provides SDK, which simplifies all these tool-chain usage, generates a bit file from a C file which can be directly associated with the uB using the Viv main GUI menus. So for someone using a uB based design, his headache for simulation is significantly reduced if the Xilinx Viv simulator is used.
A search that I did seems to indicate that the tools will generate the initialization code for a .mem file and data2mem can be used to convert from an elf to a mem file.
Exactly, but here the OP is only talking about simu (Modelsim).
For implementation, Xilinx tools were already there for embedding the elf into the bit file.