Tutorial on how to disasm / objdump via Arduino "Export compiled binary" menu


New member
Tutorial on how to disasm / objdump via Arduino "Export compiled binary" menu

Arduino 1.6.5+ includes an option to export the binary (.hex) file to your source directory via Sketch -> Export compiled Binary. This is a short tutorial on how to change it to output the disassembly / object dump of the file for an ARM based teensy.

Step 1 - Create objdump stub
As the objdump just writes to the console output (and I couldn't find any other way to redirect that) we first create a simple objdump stub by putting this
%1\arm-none-eabi-objdump -S %2 >%3

into a batch file in a separate folder, e.g C:\arduinotools\arm-none-eabi-objdump_redirect.bat

Step 2 - Add recipe
Add the objdump recipe at the bottom of the platform text file located in your %arduinopath%\hardware\teensy\avr\ folder:
recipe.hooks.savehex.presavehex.1.pattern="C:/arduinotools/arm-none-eabi-objdump_redirect.bat" "{compiler.path}{build.toolchain}" "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.objdump"

Step 3 - Test
Use Sketch -> Export compiled Binary after compiling your code. You should find an .objdump file in your sketch folder then.
Yes, looks great, thank you.
I've added it to my patches (a set of *.diff -files - i use windows-ports of the linux diff/patch tools - very handy, and it's possible to apply all patches automatically for new versions of teensyduino)