Where does teensyduino put .lst, .o, .hex files?

Status
Not open for further replies.
OK, I give up. I've been searching and searching how to generate (and find) the compiler output files. I use on Windows, but I even installed on Linux just so I could have better tools to search and find them. For the life of me, I can't find where these files go.

I want to generate a list file (.lst) output. I'm more comfortable looking at assembly listings than debugging C code when it goes wrong. So that's the question: 1) How do I generate .lst files, and 2) Where do I find them?

BTW, I browsed through the preferences.txt file and other options. Didn't find anything. And of course I used a few different search options on the forum. So I apologize if it's in a FAQ somewhere or in another posting.

I'm using teensyduino gui on both Windows and Linux.
 
On my Linux system, the Arduino IDE seems to create a directory of the form /tmp/build<number>.tmp. In the past, I would just do delete all of the /tmp/build*.tmp directories before starting the IDE when I wanted to to look at a specific build. You can edit the boards.txt to add the -save-temps switch (for AVR) or -save-temps=obj (for ARM) option, and it will leave <file>.ii and <file>.s files around after the compile. The <file>.s file is the assembler file produced by the compiler.

Or if you compile adding the -Wa,-al -g options, it will tell the assembler to make a listing to standard output (i.e. the IDE scroll window, what out, it will be a lot of output), and -al and -g will work together to show you the text followed by the code generated. This doesn't work too when when high levels of optimization are done, and the code is fairly scattered.
 
Thanks to both of you. Paul, that got me half way there and at least told how to find the output directory. Next, I'd like to auto-generate some .lst files ala something like this: -Wa,-adhlns=xxx.lst.

Michael thanks to you as well. I'm not sure how to add the -save-temps=obj to build.txt. When I look at build.txt, I see a file format like this:

teensy31.build.mcu=mk20dx256
teensy31.build.cpu=cortex-m4
teensy31.build.option1=-mthumb
teensy31.build.option2=-nostdlib
teensy31.build.option3=-D__MK20DX256__
teensy31.build.option4=-DTEENSYDUINO=118
teensy31.build.cppoption1=-fno-rtti

I'm thinking of adding -Wa,-adhlns=xxx.lst to option1 or option2. Any advice is greatly appreciated, and sorry for the n00b questions.
 
I would imagine you could add it to any of the 4 option lines (with a space followed by the command), or just add a new option5 line.

Note, if you have the object file, you do arm-none-eabi-objdump -dwx <file>.o to disassemble it.
 
I would imagine you could add it to any of the 4 option lines (with a space followed by the command), or just add a new option5 line.

Note, if you have the object file, you do arm-none-eabi-objdump -dwx <file>.o to disassemble it.

Thanks, I figured as much on the objdump. I wasn't sure of the arm compiler generated .o's retain debug information like line numbers (wanted source reference), so wanted to go the .a or .lst file approach. But I'm still curious about -save-temps=obj. Are you saying add that to the option list? I will try this stuff when I get home tonight.
 
When I started working on GCC in 1988 (on the Motorola 88000 port at Data General), one of the things I did in that time period was add the -save-temps switch. What -save-temps does is keep a copy of the preprocessed file (.i suffix for C files, .ii suffix for C++ files) and the assembler file (.s suffix) in the directory you are running in. Rather than running the compiler in the debugger to get to the point of failure, you can just do a normal build, and you will have the preprocessed input and an assembler file to look at. In addition, I could use the assembler files to do easy counts of the various types of instructions generated.

Later in 2009, when I am working at IBM, and I'm starting to do builds on machines with many more cores and processors, and I tend to use -j40 on the make file when building Spec 2006 runs, it became apparent that some builds were breaking when you use -save-temps. This is due to the structure of one of the Spec builds, in that there are several subdirectories, and in the subdirectories are files with the same name. The large makefile builds each of these files with an -o option to write the object into the directory the source is running at. If you are running with high -j values, eventually you will compile two of these files with the same base name at the same time. Because the preprocessed file is fed into the compiler proper, and the assembler file is fed into the assembler, the two parallel compiles will overwrite the files and cause the assembler to say Huh? Even if you don't overwrite the files, one of the files will be deleted, which means any static instruction counts that you do will be inaccurate. So I added the -save-temps=obj variant to put the file into the subdirectory where the -o option is using, and to use the name of the object file, changing the suffix.

Now, in the Arduino IDE environment, it does build objects in subdirectories (if they are in libraries), so you might possibly have the same name in 2 different libraries. However, I don't believe the IDE uses the -j option, so if you use -save-temps instead of -save-temps=obj, you might be missing an assembler file. Note, I believe the AVR compiler used for the Teensy 2.0 is so old it does not support -save-temps=obj.

Now, you can try to make an assembler listing instead, but you may run into the problem of having to use a fixed name for the output, and you might not get the listing you want. An alternative is to do a verbose build, and then find the line compiling the file you are interested in, and from a command line shell, issue that command, adding whatever options you want.
 
Status
Not open for further replies.
Back
Top