<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>LPCXpresso IDE FAQsのトピックRe: Disassembling objects and executables</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE-FAQs/Disassembling-objects-and-executables/m-p/1561542#M202</link>
    <description>&lt;P&gt;Is there any documentation on how to read the generated .asm file, or what the -ahlnds means? (I couldn't find this command mentioned in the GCC documentation).&lt;/P&gt;</description>
    <pubDate>Tue, 29 Nov 2022 21:02:54 GMT</pubDate>
    <dc:creator>aberger</dc:creator>
    <dc:date>2022-11-29T21:02:54Z</dc:date>
    <item>
      <title>Disassembling objects and executables</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE-FAQs/Disassembling-objects-and-executables/m-p/469411#M40</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is sometime useful to be able to view the assembly instructions generated by the compilation tools. There are a number of ways of doing this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;&lt;SPAN style="color: #eb7a3d;"&gt;Disassembling using the GUI&lt;/SPAN&gt;&lt;/H2&gt;&lt;P&gt;&lt;/P&gt;&lt;HR style="color: #646464; font-family: Arial, sans-serif; font-size: 12px;" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all open out the project within the Project Explorer, so that you can see the files and directories within it. Assuming a default project structure, and that a build has alread occured,&amp;nbsp; two of these directories will be Debug and Release - matching the project's build configurations. Navigate into the directory matching the build configuration you are currently using.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now if you want to disassemble the complete executable, look for the file with the .axf file extension (Arm eXecutable File), and right click over it. In the context sensitive menu that is then displayed, highlight "Binary Utilities-&amp;gt;Disassemble". The GUI will then invoke the GNU objdump utility to generate a disassembly file, which will be launched into the editor view.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to disassemble a particular source file, rather than the whole executable, open the "src" subdirectory of the Debug (or Release) directory of your project, and right click over the appropriate .o file, and then highlight "Binary Utilities-&amp;gt;Disassemble".&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #eb7a3d;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;H2&gt;&lt;SPAN style="color: #eb7a3d;"&gt;Including source information&lt;/SPAN&gt;&lt;/H2&gt;&lt;P&gt;&lt;/P&gt;&lt;HR style="color: #646464; font-family: Arial, sans-serif; font-size: 12px;" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is possible to change the default options used by the disassembler so that the assembly instructions are interleaved with the source statements. To do this,&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Go to Window-&amp;gt;Preferences&lt;/LI&gt;&lt;LI&gt;Select LPCXpresso&lt;/LI&gt;&lt;LI&gt;Select Utilities.&lt;/LI&gt;&lt;LI&gt;Add &lt;TT&gt;-S&lt;/TT&gt; to the 'disassemble command'.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;However, be warned that for each level of optimization beyond -O0, then the link between assembler and C source becomes more tenuous as the compiler will remove, reorder and optimize the generated code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;&lt;SPAN style="color: #eb7a3d;"&gt;Automatically disassembling every build&lt;/SPAN&gt;&lt;/H2&gt;&lt;P&gt;&lt;/P&gt;&lt;HR style="color: #646464; font-family: Arial, sans-serif; font-size: 12px;" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is also possible to automatically create a disassembly of your application every time you carry out a (successful) build (with source information included if required). Details of how to do this can be found in the FAQ &lt;A _jive_internal="true" data-containerid="11529" data-containertype="14" data-objectid="389116" data-objecttype="1" href="https://community.nxp.com/thread/389116"&gt;Post-processing your linked application&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;&lt;SPAN style="color: #eb7a3d;"&gt;Automatically disassembling every object file&lt;/SPAN&gt;&lt;/H2&gt;&lt;P&gt;&lt;/P&gt;&lt;HR style="color: #646464; font-family: Arial, sans-serif; font-size: 12px;" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sometimes you may want to create a disassembly of each generated object file each time that you carry out a build. To do this...&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Go to Project Properties&lt;/LI&gt;&lt;LI&gt;Select C/C++ Build - Settings&lt;/LI&gt;&lt;LI&gt;Select MCU C Compiler - Miscellaneous&lt;/LI&gt;&lt;LI&gt;Add the following into the flag field:&lt;UL&gt;&lt;LI&gt;&lt;TT&gt;-Wa,-ahlnds=${OutputFileBaseName}.asm&lt;/TT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will then generate the interleaved source/asm file during the build for each source file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Note&lt;/STRONG&gt; that the "," (comma) character is required. The &lt;TT&gt;-Wa&lt;/TT&gt; is an option to the compiler which tells it to pass the following command to the assembler (the &lt;TT&gt;-ahlnds&lt;/TT&gt;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternatively, you can add the &lt;TT&gt;-save-temps&lt;/TT&gt; to the miscellaneous compiler options. This will cause the compiler to leave the temporary .i (preprocessed source) and .s (assembler listing) files that it creates during a build in your build directory.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #eb7a3d;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;H2&gt;&lt;SPAN style="color: #eb7a3d;"&gt;Disassembly during debugging&lt;/SPAN&gt;&lt;/H2&gt;&lt;P&gt;&lt;/P&gt;&lt;HR style="color: #646464; font-family: Arial, sans-serif; font-size: 12px;" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is also possible to see the disassembly of your code whilst debugging. For more details see:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A _jive_internal="true" data-containerid="11529" data-containertype="14" data-objectid="388996" data-objecttype="1" href="https://community.nxp.com/thread/388996"&gt;Disassembly View and instruction level debugging&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Mar 2016 18:10:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE-FAQs/Disassembling-objects-and-executables/m-p/469411#M40</guid>
      <dc:creator>lpcware-support</dc:creator>
      <dc:date>2016-03-31T18:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: Disassembling objects and executables</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE-FAQs/Disassembling-objects-and-executables/m-p/1561542#M202</link>
      <description>&lt;P&gt;Is there any documentation on how to read the generated .asm file, or what the -ahlnds means? (I couldn't find this command mentioned in the GCC documentation).&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2022 21:02:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE-FAQs/Disassembling-objects-and-executables/m-p/1561542#M202</guid>
      <dc:creator>aberger</dc:creator>
      <dc:date>2022-11-29T21:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: Disassembling objects and executables</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE-FAQs/Disassembling-objects-and-executables/m-p/1563488#M203</link>
      <description>&lt;P&gt;See &lt;A href="https://mcuoneclipse.com/2018/07/08/creating-disassembly-listings-with-gnu-tools-and-eclipse/," target="_blank"&gt;https://mcuoneclipse.com/2018/07/08/creating-disassembly-listings-with-gnu-tools-and-eclipse/,&lt;/A&gt; it explains the -a option and has a link to the GNU gcc documentation.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2022 12:20:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE-FAQs/Disassembling-objects-and-executables/m-p/1563488#M203</guid>
      <dc:creator>ErichStyger</dc:creator>
      <dc:date>2022-12-02T12:20:54Z</dc:date>
    </item>
  </channel>
</rss>

