Difference between revisions of "Arduino"
From Steak Wiki
Jump to navigationJump to searchLine 17: | Line 17: | ||
While you are at it also do, | While you are at it also do, | ||
− | <pre> | + | <pre> |
+ | #!/bin/bash | ||
+ | #run this script from /tmp/arduino_build_#### folder | ||
+ | #$0 will be this script. $1 will be the .ino file to parse. | ||
+ | #omit the .elf part | ||
+ | #e.g. ./gen_debug.sh shiftin_try6_wLED.ino | ||
+ | DIR=debug_files | ||
+ | mkdir $DIR | ||
+ | avr-objdump -S $1.elf | c++filt > ./$DIR/$1.ASM | ||
+ | readelf -a $1.elf > ./$DIR/$1.READELF | ||
+ | #note: sometimes strings needs to be adjusted when rev engineering. | ||
+ | strings $1.elf > ./$DIR/$1.STRINGS | ||
+ | file $1.elf > ./$DIR/$1.FILE | ||
+ | #nm, could potentially be used for object files in build/libraries folder | ||
+ | nm ./sketch/$1.cpp.o | c++filt > ./$DIR/$1.NM | ||
+ | # cpp.d has directory paths. might be useful in 10 years when you try to build again. | ||
+ | cp ./sketch/$1.cpp.d ./$DIR/. | ||
+ | |||
+ | #reference: The IDA Pro Book, by Chris Eagle | ||
+ | #and https://forum.arduino.cc/index.php?topic=50169.0 | ||
+ | |||
+ | # that's all for now | ||
</pre> | </pre> |
Revision as of 03:17, 25 August 2020
Arduino is a software library for AVR microcontrollers (and others). It is aimed at fast prototyping, sometimes at the cost of performance. It has extensive libraries and software for many popular ICs. Elitists will hate on Arduino, but that's mostly because they don't want you to be successful.
Convert Uno code to ASM
apt-get install binutils-avr
compile program in IDE. find .elf file (was in deb 9 /tmp/arduino-build.#####/) (can look at verbose arduino compile window)
avr-objdump -S code.ino.elf > output.asm
See gas sensor, or ph sensor in 2019 projects for more details
Ref: https://forum.arduino.cc/index.php?topic=50169.0
While you are at it also do,
#!/bin/bash #run this script from /tmp/arduino_build_#### folder #$0 will be this script. $1 will be the .ino file to parse. #omit the .elf part #e.g. ./gen_debug.sh shiftin_try6_wLED.ino DIR=debug_files mkdir $DIR avr-objdump -S $1.elf | c++filt > ./$DIR/$1.ASM readelf -a $1.elf > ./$DIR/$1.READELF #note: sometimes strings needs to be adjusted when rev engineering. strings $1.elf > ./$DIR/$1.STRINGS file $1.elf > ./$DIR/$1.FILE #nm, could potentially be used for object files in build/libraries folder nm ./sketch/$1.cpp.o | c++filt > ./$DIR/$1.NM # cpp.d has directory paths. might be useful in 10 years when you try to build again. cp ./sketch/$1.cpp.d ./$DIR/. #reference: The IDA Pro Book, by Chris Eagle #and https://forum.arduino.cc/index.php?topic=50169.0 # that's all for now