Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

Is there a disassembler for Nios II ELF files?

I'd like to be able to examine the ELF file that the compiler generates so I can see exactly which instructions are being used. I have the Nios II Processor reference document which shows the opcodes, but I haven't seen anything about a dissassembler.

Also where can I read about what exactly goes in each section of the ELF file? For instance, what goes in the .exceptions section? From looking at the program headers it seems like this should be executable code but it doesn't look like executable code in a hex editor.

5 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi bkucera,

    > but I haven't seen anything about a dissassembler.

    Use objdump with the -D option.

    > Also where can I read about what exactly goes in each section of the ELF file?

    > For instance, what goes in the .exceptions section?

    Take a look at your linker command file, use objdump ... and you might want to

    generate a map file as well.

    Regards,

    --Scott
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by smcnutt@Dec 13 2005, 05:14 PM

    hi bkucera,

    take a look at your linker command file, use objdump ... and you might want to

    generate a map file as well.

    --- Quote End ---

    Great, objdump is what I was looking for. Where is my linker command file, and how do I generate a map file? Thanks!
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    > Where is my linker command file,

    Look in your system library path. E.g. for a debug build:

    xxx\Debug\system_description\generated.x

    > and how do I generate a map file?

    Pass the -Map option to the linker:

    $ nios2-elf-ld [OTHER OPTIONS] -Map app.map

    Use -Wl,-Map -Wl,app.map for gcc.

    Regards,

    --Scott
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    There is another possibility:

    If you are looking for a debugger which directly reads in the ELF file than we can provide a commercial product. This debugger shows besides the opcode and the corresponding disassembled mnemonics also the program flow and cycle count information (per instruction or accumulated over time), and many more features.

    You can download this product from www.adveda.com, you can use it for two weeks (license is time limited).

    Regards,