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
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:
Step 3 - Test
Use Sketch -> Export compiled Binary after compiling your code. You should find an .objdump file in your sketch folder then.
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
Code:
%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:
Code:
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"
recipe.output.tmp_file={build.project_name}.objdump
recipe.output.save_file={build.project_name}.{build.board}.objdump
Step 3 - Test
Use Sketch -> Export compiled Binary after compiling your code. You should find an .objdump file in your sketch folder then.