How to make a disassemble list with C source code ?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to make a disassemble list with C source code ?

1,399件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by noritan_org on Fri Jan 22 01:13:46 MST 2010
It is available to see a disassemble list during DEBUG with the "Disassembly" View like following.
0x00000194 <main+56>: bl   0x1b0 <SysTick_Config>
        i++;                            // dummy count.
0x00000198 <main+60>: ldr  r3, [pc, #16]    (0x1ac <main+80>)
0x0000019a <main+62>: ldr  r3, [r3, #0]
0x0000019c <main+64>: adds r2, r3, #1
0x0000019e <main+66>: ldr  r3, [pc, #12]    (0x1ac <main+80>)
0x000001a0 <main+68>: str  r2, [r3, #0]
0x000001a2 <main+70>: b.n  0x198 <main+60>
The list includes a corresponding source code "i++;"

It is also available to make a disassemble file with "dis" extension when selecting a menu item "Binary Utilities -> Disassemble" from the context menu of a binary file like "main.o" But the created ".dis" file does not include source code like following.

  36:    1c18          adds    r0, r3, #0
  38:    f7ff fffe     bl    0 <main>
            38: R_ARM_THM_CALL    SysTick_Config
  3c:    4b04          ldr    r3, [pc, #16]    (50 <main+0x50>)
  3e:    681b          ldr    r3, [r3, #0]
  40:    1c5a          adds    r2, r3, #1
  42:    4b03          ldr    r3, [pc, #12]    (50 <main+0x50>)
  44:    601a          str    r2, [r3, #0]
  46:    e7f9          b.n    3c <main+0x3c>
  48:    00000000     .word    0x00000000
My question is very simple.  Are there any option to include the source code in the ".dis" file ?  I would like to confirm the compiled codes.

--
noritan.org  http://noritan.org/  _@"  _@"  _@"
0 件の賞賛
返信
6 返答(返信)

1,376件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mfph on Tue May 31 19:40:00 MST 2011

Quote: larryvc
It works for me.

See this:  http://support.code-red-tech.com/CodeRedWiki/DisassObsjExes



Thanks for the link! This reveals the bit of information missing in the original post
" In the context sensitive menu that is then displayed, highlight "Binary Utilities->Disassemble" "

I wasn't sure if igorsk's approach was showing what was truely being compiled because of an unexplained timing problem I've been having but now this method reveals the same listing...
0 件の賞賛
返信

1,376件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by larryvc on Tue May 31 19:06:29 MST 2011

Quote: mfph
This does not work. Where do I find the output .dis file / how do I run this 'utility'?



It works for me.

See this:  http://support.code-red-tech.com/CodeRedWiki/DisassObsjExes
0 件の賞賛
返信

1,376件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mfph on Tue May 31 13:57:22 MST 2011
This does not work. Where do I find the output .dis file / how do I run this 'utility'?


Quote: CodeRedSupport
Hi,

This is a simple change.

Windows->Preferences
   LPCXpresso
     Utilities

and add -S to the 'disassemble command'.

However, be warned that for each level of optimization beyond -O0, then the link between assembler and C source becomes more and more tenuous as the compiler will remove code, reorder it and otherwise optimize it.

0 件の賞賛
返信

1,376件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by noritan_org on Fri Jan 22 03:18:59 MST 2010
Thanks for your quick reply.
Both solutions are working well as I expected.
0 件の賞賛
返信

1,376件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by igorsk on Fri Jan 22 03:01:35 MST 2010
Here's another option. Go to project properties, C/C++ Build, Settings, expand MCU C Compiler, Miscellaneous and add the following into the flag field:
-Wa,-ahlnds=${OutputFileBaseName}.asm
This will generate the asm file during compilation, so it will contain more information from the source, even for optimized builds.
0 件の賞賛
返信

1,376件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Fri Jan 22 02:24:20 MST 2010
Hi,

This is a simple change.

Windows->Preferences
   LPCXpresso
     Utilities

and add -S to the 'disassemble command'.

However, be warned that for each level of optimization beyond -O0, then the link between assembler and C source becomes more and more tenuous as the compiler will remove code, reorder it and otherwise optimize it.
0 件の賞賛
返信