Forum Discussion

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

Mixed source / Assembly listing

Is this possible, so I can get a fair idea on how the code for this is distributed?

0000413c <uart_irq_1>:
    413c:    01421204  movi    r5,2120
    4140:    29000037  ldwio    r4,0(r5)
    4144:    28000035  stwio    zero,0(r5)
    4148:    2006d1fa  srli    r3,r4,7
    414c:    1880004c  andi    r2,r3,1
    4150:    10000226  beq    r2,zero,415c <uart_irq_1+0x20>
    4154:    01821004  movi    r6,2112
    4158:    30c00037  ldwio    r3,0(r6)
    415c:    200ed1ba  srli    r7,r4,6
    4160:    3900004c  andi    r4,r7,1
    4164:    20001026  beq    r4,zero,41a8 <uart_irq_1+0x6c>
    4168:    d16003c3  ldbu    r5,-32753(gp)
    416c:    d2200383  ldbu    r8,-32754(gp)
    4170:    02800034  movhi    r10,0
    4174:    52840444  addi    r10,r10,4113
    4178:    2a403fcc  andi    r9,r5,255
    417c:    4a85883a  add    r2,r9,r10
    4180:    4a00062e  bgeu    r9,r8,419c <uart_irq_1+0x60>
    4184:    13400003  ldbu    r13,0(r2)
    4188:    03021104  movi    r12,2116
    418c:    63400035  stwio    r13,0(r12)
    4190:    2ac00044  addi    r11,r5,1
    4194:    d2e003c5  stb    r11,-32753(gp)
    4198:    f800283a  ret
    419c:    03c02004  movi    r15,128
    41a0:    03821304  movi    r14,2124
    41a4:    73c00035  stwio    r15,0(r14)
    41a8:    f800283a  ret

6 Replies

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

    Hi Scott.

    It looks as though the -S option is already used:

    "OBJDUMP = nios2-elf-objdump -D -S -x"

    in the file C:\altera\kits\nios2_v5\components\altera_nios2\HAL\src\component.mk

    I suspect I need to turn on a "debug info" option, or to specify the "source dirs"

    By adding the -l option (line numbers), i.e.

    "OBJDUMP = nios2-elf-objdump -D -S -x -l"

    ...I was able to produce a list of line numbers in a few code sections only:

    e.g. C:\altera\kits\nios2_v5\bin\nios2-gnutools\src\gcc\gcc\config\nios2\lib2-divmod.c

    - not the HAL nor project source files.

    So there must be something really simple I&#39;ve overlooked......
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Ahaa!

    The mixed source appears in the DEBUG configuration, but not in the RELEASE.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Jason,

    Yep, you need to make sure the -g option is passed to the compiler.

    And don&#39;t strip the elf ;-)

    Regards,

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

    Hey,Scott!

    I have a question maybe seems silly to you.You said mixed listing can be seen by using the objdump -s option,

    but where can I set this option in NiosII IDE?

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

    Hi yancharles,

    > where can I set this option in NiosII IDE?

    I don&#39;t think I can help you with this one since I&#39;m an old command-line fogey ;-)

    and I always run objdump from the shell.

    You should however enable debugging information using the &#39;-g&#39; option. You can do this

    in your project properties under C/C++ Build, Debug level.

    Regards,

    --Scott