# How to disassemble ESP8266 code written in Arduino IDE?

I want to see the assembly code of my code written in the Arduino IDE. What I've tried is:

Sketch > Export compiled binary

Then, I found that I have a gcc toolset in my ESP8266 directory in:

Documents\ArduinoData\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506\bin>

And there I have a xtensa-lx106-elf-objdump.exe

So I tried to run this objdump on the outputted compiled binary, but I got:

PS> xtensa-lx106-elf-objdump.exe -D <path/to/binfile>
file format not recognized

• What was the cmdline you typed to get that error? Aug 11, 2021 at 6:37
• By binary, do you mean literally the .bin output, or .hex or .elf? Aug 11, 2021 at 6:46
• Well, when you click on the "Export compiled binary" in the IDE, you get a .bin file Aug 11, 2021 at 6:48
• How do you expect objdump to understand what the binary file contains? How would it know what is code or data in the binary and where they are located? Try giving it an executable, an .elf file which does contain that information. Or maybe force the linking stage to produce an assembly listing of the executable, so you don't even have to disassemble anything? Aug 11, 2021 at 8:32
• @Justme, I don't know much about the low-level details of these. My guess was that this bin file was compiled using this toolchain (i.e. xtensa-lx106-elf-g++.exe and xtensa...ld.exe) so that the objdump tool (provided by the same toolchain) would know about the structure of the produced file. Aug 11, 2021 at 8:40