I am creating a .elf file from Arduino for MK20DX256VLH7 and when burning through Ulink2 via SWD mode using Keil Uversion5 its getting downloaded properly but not getting expected result.
As I know Keil burns .axf file but .axf is also ELF format. Below is the link kindly verify. http://www.keil.com/support/docs/1774.htm
Kindly let me know where I am going wrong or what steps I need to take to get the expected output.
Even I have .hex file from Arduino if in case it needed.
I'm not exactly sure what you are trying to achieve, and with what exactly.
If I was trying to trouble-shoot a problem where the same .ELF programmed differently between two tools, I'd look at the data that ended up on the device in both cases, see what was different, and then examine/analyze the .ELF to understand if the structures contained there-in were in error or conflict with how each of the tool chains normally generates their output.
That it "doesn't work" at this level doesn't tell me much about what is not working, or why. Stepping through the code and seeing what it does/doesn't do would be far more illuminating.
The Keil chain provides a SAVE function within it's debugger to save the device content to a .HEX, and it also has a FromELF tool to examine .ELF/.AXF files.
just I am compiling Code for teensy 3.2 which is based on MK20DX256VLH7 in Teensyduino and trying to burn generated .elf file through Keil via Ulink2.
Ok, and what is precluding you from stepping through the executing code once you download it, and figuring out why it is deviating from your expectations?
May be if all you are using Keil for is the ULink downloader, then you need to discuss/review the problem with PJRC, and on their forum.
Review the .ELF file, and its contents, with respect to what the processor is expecting in terms of code, and code placement.