DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Debug Like a Pro in 2025: 10 New Eclipse Java Debugger Features to Enhance Your Productivity (With Spring Boot Examples)
  • Introducing Graph Concepts in Java With Eclipse JNoSQL, Part 3: Understanding Janus
  • Introducing Graph Concepts in Java With Eclipse JNoSQL, Part 2: Understanding Neo4j
  • Introducing Graph Concepts in Java With Eclipse JNoSQL

Trending

  • Your AI Agent Tests Are Passing, But Your Agent Is Still Broken
  • Feature Flag Debt: Performance Impact in Enterprise Applications
  • Build a GitHub Slack Bot With AWS Bedrock and MCP, Part 2
  • OpenAPI From Code With Spring and Java: A Recipe for Your CI
  1. DZone
  2. Coding
  3. Frameworks
  4. Creating Disassembly Listings With GNU Tools and Eclipse

Creating Disassembly Listings With GNU Tools and Eclipse

Let's take a look at how to use the assembly code generated by a compiler for IoT applications in MCUXpresso.

By 
Erich Styger user avatar
Erich Styger
·
Jul. 11, 18 · Tutorial
Likes (1)
Comment
Save
Tweet
Share
8.3K Views

Join the DZone community and get the full member experience.

Join For Free

In many cases, it is very useful to see the generated assembly code produced by the compiler. One obvious way to see the assembly code is to use the Disassembly view in Eclipse:

Disassembly View

Disassembly View

But, this requires a debug session. An easier way is to use the command line options to generate the listing file(s).

-a: Generating an Assembly Listing File for Each File Compiled/Assembled

One way is to add the following to the GCC compiler command line. For this, I usually use the following:

-Wa,-adhlns="[email protected]"


The -Wa is an option for the assembler (which is staged after the compiler). The options passed to the assembler follow right after with the comma (,). For a description of the assembler -a option, see https://sourceware.org/binutils/docs/as/a.html#a.

In MCUXpresso IDE 10.2, I add it to the ‘Miscellaneous’ compiler options:

Disassembly Options

Disassembly Options

With this, for every source file compiled, it will place the listing file into the same output folder as the object file:

Generated Listing File

Generated Listing File

Then, I can open it with a text editor:

Open with text editor

Open with text editor

Then, this opens a text view in Eclipse:

disassembly Listing

Disassembly Listing

Objdump: Generating an Assembly Listing From the Object File

Another way is to generate the listing file from the compiler output object file. For this, I can use the GNU objdump utility:

arm-none-eabi-objdump -d test.o >test.o.lst


Then, this writes the disassembly listing to a file:

Listing file created with objdump

Listing file created with objdump

MCUXpresso IDE: Binary Utilities

With the MCUXpresso IDE 10.2 (Eclipse Oxygen based), NXP has added an extension with the ‘Binary Utilities’ menu that I can use on an object (or ELF/Dwarf) file:

Disassemble menu action in MCUXpresso IDE

This again calls the objdump utility and creates the listing file:

Disassembly File CreatedDisassembly File Created

In summary, there are many ways to create the assembly listing file.

Happy Disassembling!

Some Helpful Links

  • GNU assembler (as) options: https://sourceware.org/binutils/docs/as/Invoking.html#Invoking
  • GNU objdump options: https://sourceware.org/binutils/docs/binutils/objdump.html
  • MCUXpresso IDE download: http://www.nxp.com/mcuxpresso/ide
GNU Listing (computer) Object file Eclipse

Published at DZone with permission of Erich Styger. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Debug Like a Pro in 2025: 10 New Eclipse Java Debugger Features to Enhance Your Productivity (With Spring Boot Examples)
  • Introducing Graph Concepts in Java With Eclipse JNoSQL, Part 3: Understanding Janus
  • Introducing Graph Concepts in Java With Eclipse JNoSQL, Part 2: Understanding Neo4j
  • Introducing Graph Concepts in Java With Eclipse JNoSQL

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook