In message
1.the file u create in editor is saved as ".c" file
2. this '.s' file is then PREPROCESSED for compilation .
3. the preprocessed file undergoes compilation to generate a
'.asm' (assembly file) or '.s' or '.src' file.
4. this source file is assembled to generate a '.obj' file
5. this .obj file is combined with other '.obj' or '.lib' files to
generate an executable file.
1 You write text (C source) in to a TEXT editor. Often the editor in an
IDE
2 You "Compile" the source.
These days this will give you an object file for linking.
Under the hood there are several steps
2.1 The pre-processor does a *textual* replacement of macros and
defines. This is why it is often required that macros have ( ) around
them when they are defined.
2.2 the now expanded text file is compiled. At one time this could be
up to THREE passes and the command "CC file.c" actually fed file.c to a
batch file called cc that called the three parts of the compiler. This
would turn our assembler code in a text file. You then needed to
assemble the text file to object code.
Modern compilers are "single pass" which means they hide all the
messing about and go from the source code text to object files in "one
pass" and do not generate assembler code. Thus a separate assembler is
not needed. In reality there is usually a pre-proccessor phase and the
compiler will generate intermediate files and tables.
These days there is more memory. In the Good old Days you use to have to
swap floppy disks for compile, assemble and link phases
(and 8inch
floppies at that
)))
3 linking. This links the various program object files and the library
files
linking needs to sort out all the extern function and data calls between
modules and the library. It knits the modules together in one object
file
In some cases years ago where there is only a single file and no calls
to the library the object file from the assembler or compiler could run
without linking.
The out put from the linker can be further processed to give S-Rec,
Intel Hex or other files for downloading to eprom/flash programmers.