Forum Discussion

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

Assembly code

i would like to see the assembly code generate after building project

but i think it's not possible

I tryed to search everywhere but witout result

what do you think about ?

ciao

6 Replies

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

    elf filw is the executable code

    i try to open but inside there are cripted caracters .

    Anyway there are strange letters

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

    Hi,

    the easiest way to view the disassembly of your programm is:

    - start the Nios2 IDE.

    - make sure the generation of a objdump file is enabled.

    (In Nios2 IDE check Window->Preferences->Nios II->Generate objdump file)

    - compile your project

    - after that in the folder <your project directory>/Debug there should be a file called <your_program>.elf.objdump. This file contains (among other things) a disassembly of your executable

    Note that this call disassembles ALL your sections, including the sections containing your initialized data. Don&#39;t be confused by this.

    I hope this helps.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    yes now i see

    uncredible, it&#39;s better C/C++ language

    http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/rolleyes.gif

    but i think that for the future will be good to write

    some function called in Nios II ide , written in assembly code

    The problem is understand how to do , because in the documentation

    there are not examples.

    for example if i&#39;d like write something about this i have to

    declare asm(" instruction

    " instruction

    );

    end_asm

    or something about this

    thanks

    ciao

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

    <div class='quotetop'>QUOTE </div>

    --- Quote Start ---

    yes now i see

    uncredible, it&#39;s better C/C++ language[/b]

    --- Quote End ---

    Note that the disassembly is intermixed with your c code.

    The objdump utility makes use of the debugging information in your .elf file and prints your code at the appropriate places.

    <div class='quotetop'>QUOTE </div>

    --- Quote Start ---

    for example if i&#39;d like write something about this i have to

    declare asm(" instruction

    " instruction

    );

    end_asm[/b]

    --- Quote End ---

    If you want to write inline assembly code (assembly embedded into c code), you should check the gcc documentation at http://gcc.gnu.org/onlinedocs (http://gcc.gnu.org/onlinedocs) , as the Nios2 IDE is a "frontend" for the gcc compiler.