Forum Discussion

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

Compiler Setting in NIOSII IDE

Hi,

I am looking for a compiler setting to create an assembler output file from C-source. I didn't found this topic in the GNU-Compiler discribtion. I always like to have a closer look at the compiled code.

Thanks for help

3 Replies

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

    If you type nios2-elf-gcc --help in a Nios II SDK Shell window that will give you the options

    The option

    -S Compile only; do not assemble or link

    sounds like what you're after
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I tried the option -c "compile and assemble but do not link" in NIOS II IDE. That doesn't work.

    I changed the C/C++ build properties , compiler flags = -c

    See the following screenshot :

    make -s all

    Compiling MAIN.c...

    Compiling alt_irq_register.c...

    Compiling alt_main.c...

    Linking IRQ_CHECK.elf...

    nios2-elf-g++: cannot specify -o with -c or -S and multiple compilations

    make: *** [IRQ_CHECK.elf] Error 1

    Build completed

    I really don't think that option :

    S Compile only; do not assemble or link

    is the rigth one - I'd like to see whats the assembled output of my C-source.

    I think it is even a problem to change this under NIOS IDE II ?

    Thank for help.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    ots_dev,

    The __gcc__ option "-S" is correct (that's uppercase 'S'). With this option

    gcc stops after compiling and the output is an assembler file.

    When you use "-s" (lowercase) as a __make__ option, you're telling make

    to run in silent mode.

    You can always use objdump to view the actual object file as well with

    the -D option :

    nios2-elf-objdump -D foo.o

    Regards,

    --Scott