how to see file result of preprocess

Go To Last Post
24 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,
I'm new of C language and of atmel studio ide,
it is about a month that I started to program in ansi C language and I am using the ATMEL STUDIO platform, my need is to have the preprocessor result in order to know which real source is going to be compiled.
Unfortunately I have not been able to find the way to get this file anyway, from my research i realized it is a file that has extension ".i" so i did search on disk but I did not find track of this file type .
Does anyone tell me how to get this file?
 

This topic has a solution.
Last Edited: Thu. Nov 30, 2017 - 11:30 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Go to: Project / Properties / Toolchain / (C and/or C++)Compiler  / Miscellaneous

Check the "Do not delete temporary files" box

The preprocessed files will be in the Debug directory as a ".i" (or ".ii" for C++) file

I usually go to the end of the file and then look back to find the information of interest...

David (aka frog_jr)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Tank you for the answer, but io go, see the picture in the attachement, and i don't find "Do not delete temporary files", i try to see using standard profile and advanced profile too but don't show the check of interest, what it can be?

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't think you can do this with -pipe ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ulisseavrfreaks wrote:
i don't find "Do not delete temporary files"

 

I believe you have two options:

 

  1. Under ToolchainARM/GNU C Compiler, Preprocessor tick the Preprocess Only (-E) checkbox.
  2. Under ToolchainARM/GNU C CompilerMiscellaneous add -save-temps to Other flags.

 

As awneil says, you might need to remove the -pipe option.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:
you might need to remove the -pipe option.

I can't remember if you actually need to remove it, or if it will just moan at you to say it's not compatible with -save-temps ...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:
two options:  

  1. Under Toolchain, ARM/GNU C Compiler, Preprocessor tick the Preprocess Only (-E) checkbox.
  2. Under Toolchain, ARM/GNU C Compiler, Miscellaneous add -save-temps to Other flags.  

IIRC, -E means that it just does the preprocessing, then stops; while -save-temps does go on to complete the build ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, that is what I think too. Selecting -E or -save-temps depends on the requirements of the OP. He has said little more than that he needs to "have the preprocessor result" so I gave both options and leave it to the OP to decide.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Also note that if you select -E in Atmel Studio, due to how our makefile is, we will write the preprocessed output to <filename>.o and then try to link it (i.e building with the -E flag in Studio leads to a strange error from the linker). Just ignore the error and open the .o file in a text editor to see it. (yes, already logged this bug).

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

frog_jr wrote:

Go to: Project / Properties / Toolchain / (C and/or C++)Compiler  / Miscellaneous

Check the "Do not delete temporary files" box

The preprocessed files will be in the Debug directory as a ".i" (or ".ii" for C++) file

I usually go to the end of the file and then look back to find the information of interest...

if i change project and use an atmega 2560 (arduino mega) it is true what frog say and in the attachement the picture ......
But in a previous project that was an ARM with ATSAM3X8E (arduino2 board) i cannot find that check

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If i remove -pipe option I dont find the .i file
If  i check -E and add - save -temp to other flag option i read some errors watch the attachement

Attachment(s): 

Last Edited: Thu. Nov 30, 2017 - 08:28 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ulisseavrfreaks wrote:
add - save -temp

Space before first hyphen (to separate it from other arguments), then no other spaces " -save-temps"

Edit: typo

David (aka frog_jr)

Last Edited: Thu. Nov 30, 2017 - 08:27 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

in the picture what happen if i cancel -save -temp  and check only -E. i cancel -pipe and i don't remember were it was

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

oops

 

 

 

Last Edited: Thu. Nov 30, 2017 - 08:31 PM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If  i check -E

 

This is, as I said, expected. The preprocessed files are in the .o files in the debug folder in your project. Open them in a text editor... 

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

frog_jr wrote:

ulisseavrfreaks wrote:
add - save -temp

Space before first hyphen (to separate it from other arguments), then no other spaces " -save-temps"

Edit: typo

yes i do it in every mode, if i write without space i get an error that understand it was necessary the space

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

meolsen wrote:

If  i check -E

 

This is, as I said, expected. The preprocessed files are in the .o files in the debug folder in your project. Open them in a text editor... 

Tank you to all,
yes, it work, but i cancel -pipe and i don't write agein because i cannot remember were it was, however do someone know why this different behaviors?

Attachment(s): 

Last Edited: Thu. Nov 30, 2017 - 08:43 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

then in final it means that i can look *.i file for avr microcontroller and *.o for like arm microcontroller?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Atmel Studio 7.9.1645

 

E70

 

Added -save-temps to Compiler Miscellaneous.

 

I get in the Debug directory *.i files, but no *.o file.

 

Last Edited: Fri. Dec 1, 2017 - 02:59 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

fpr me is different, it don't work

Last Edited: Thu. Nov 30, 2017 - 11:21 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:

I don't think you can do this with -pipe ?

me too

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

-pipe is ok, compiler just complains.   Ulisseavrfreaks typed "-save -temp"  which is incorrect.  Should be "-save-temps"  no space in the middle "-" and an "s" on the end of temp.

 

I see that in my earlier post  I typed "-save-temp"  I will go edit it now.  Sorry for the error.

Last Edited: Fri. Dec 1, 2017 - 02:59 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jstampfl wrote:

-pipe is ok, compiler just complains.   Ulisseavrfreaks typed "-save -temp"  which is incorrect.  Should be "-save-temps"  no space in the middle "-" and an "s" on the end of temp.

 

I see that in my earlier post  I typed "-save-temp"  I will go edit it now.  Sorry for the error.

OK ok , now it work Ii write -save-temps and work!

Last Edited: Fri. Dec 1, 2017 - 09:44 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

ulisseavrfreaks wrote:

frog_jr wrote:

ulisseavrfreaks wrote:
add - save -temp

Space before first hyphen (to separate it from other arguments), then no other spaces " -save-temps"

Edit: typo

yes i do it in every mode, if i write without space i get an error that understand it was necessary the space

Yes, you need spaces between options. I.e. there needs to be a space before every hyphen that is the start of an option. But that does not mean that there must be a space before every hyphen. If the hyphen is part of the option name, as in "save-temps" there must be no space.

If you put a space in there the compiler will try to interpret it as two individual options, one named "-save" and another one named "-temps". It has no two such options. It has an option, named "-save-temps".

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]