Arduino Forum

Development => Suggestions for the Arduino Project => Topic started by: danadak on Mar 21, 2019, 08:42 pm

Title: ASM lst file generation
Post by: danadak on Mar 21, 2019, 08:42 pm
I would like to see classic list file that shows user C/C++ interleaved and the generated
ASM code.

My reasons are to investigate code behavior not documented in manual.
My example is using mBlock, it will take a float for delay, so my question
that came up two fold, what is minimum delay achievable, its accuracy, and same
for maximum delay. Not in any manual I am aware of.

Using a list file, knowing clock rate I can determine that. Which is not documented.

Its a good all around tool for a slightly deeper dive into Arduino Compiler.

Just a checkoff option in preferences.

And a link window either where to put listing or where it is, eg. to be able to open its
folder location.

Regards, Dana.
Title: Re: ASM lst file generation
Post by: pert on Mar 22, 2019, 02:13 pm
We added this functionality to ATTinyCore a little while ago using build hooks (https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification#pre-and-post-build-hooks-since-ide-165):
https://github.com/SpenceKonde/ATTinyCore#assembler-listing-generation (https://github.com/SpenceKonde/ATTinyCore#assembler-listing-generation)

https://github.com/SpenceKonde/ATTinyCore/blob/master/avr/platform.txt#L90-L97 (https://github.com/SpenceKonde/ATTinyCore/blob/master/avr/platform.txt#L90-L97)

I'm not sure how much use it gets, but I think it's a pretty nifty addition to the project.
It actually saves the .lst file to the temporary build folder on every compilation, but copies the file to the sketch folder when you do Sketch > Export Compiled Binary to make it easier to find.


I occasionally find a disassembly to be useful. A while ago, I made a batch file that automates the disassembly process on Windows, which was especially cumbersome to do manually at that time because an issue with the Arduino compilation process was requiring that you specify the full path to the sketch to avr-objdump in order to get interleaved source:
https://github.com/per1234/ArduinoDisassembly (https://github.com/per1234/ArduinoDisassembly)
That sketch path issue has since been fixed.

I don't think the average Arduino user will have any use for a lst file. For this reason, I don't think it would be worth adding extra complexity to the preferences GUI for this feature. However, I would support adding it as a preference that is enabled by editing preferences.txt. This is how many of the options for advanced users are implemented.