SpenceKonde / megaTinyCore

Arduino core for the tinyAVR 0/1/2-series - Ones's digit 2,4,5,7 (pincount, 8,14,20,24), tens digit 0, 1, or 2 (featureset), preceded by flash in kb. Library maintainers: porting help available!
Other
542 stars 140 forks source link

[question]: How to disassemble compiled binaries? #1097

Closed okawo80085 closed 1 month ago

okawo80085 commented 1 month ago

I need to disassemble my compiled binary to check if some optimizations compiled correctly, I tried using the included avr-objdump, but it doesn't show avrxmega3 architecture as supported and plugin doesn't work, am i missing something or is that just not supported at the moment?

okawo80085 commented 1 month ago

Supported architectures i see with avr-objdump

> ~/.arduino15/packages/DxCore/tools/avr-gcc/7.3.0-atmel3.6.1-azduino6/bin/avr-objdump -H

~/.arduino15/packages/DxCore/tools/avr-gcc/7.3.0-atmel3.6.1-azduino6/bin/avr-objdump: supported targets: elf32-avr elf32-little elf32-big plugin srec symbolsrec verilog tekhex binary ihex
~/.arduino15/packages/DxCore/tools/avr-gcc/7.3.0-atmel3.6.1-azduino6/bin/avr-objdump: supported architectures: avr avr:1 avr:2 avr:25 avr:3 avr:31 avr:35 avr:4 avr:5 avr:51 avr:6 avr:100 avr:101 avr:102 avr:103 avr:104 avr:105 avr:106 avr:107 plugin
MX682X commented 1 month ago

The mTC and DxCore usually generate an .lst file that already has the decopmiled code. It is in the same folder as the .elf File (the Path can be found in the compiler logs)

okawo80085 commented 1 month ago

Thats exactly the info that i needed! The flags that i was missing were this (if anyone other than me ever needs it):

~/.arduino15/packages/DxCore/tools/avr-gcc/7.3.0-atmel3.6.1-azduino6/bin/avr-objdump --disassemble --source --line-numbers --demangle --section=.text <elf file> >  disassembled.lst

Thank you for the info @MX682X !