2022-03-04 04:00 AM
I'm learning the makefile that generated by cubeMX, but there are some parameters I can't understand.
In the part that called "build the application", I saw:
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
I don't know what the parameters `-Wa` , `-a` , `-ad` and `-alms` mean. I checked the GCC manual, but only found the description of -Wa:
-Wa,option
Pass option as an option to the assembler. If option contains commas, it is split into multiple options at the commas.
These cant help of my question.
I realy want to know what do these four parameters mean.
Solved! Go to Solution.
2022-03-04 05:30 AM
-Wa passes the next parameters to the assembly compiler.
The documentation for that compiler will show what those flags do:
-a[cdghlmns]
Turn on listings, in any of a variety of ways:
-ac omit false conditionals
-ad omit debugging directives
-ag include general information, like as version and options passed
-ah include high-level source
-al include assembly
-am include macro expansions
-an omit forms processing
-as include symbols
=file
set the name of the listing file
You may combine these options; for example, use -aln for assembly listing without forms processing. The
=file option, if used, must be the last one. By itself, -a defaults to -ahls.
2022-03-04 05:30 AM
-Wa passes the next parameters to the assembly compiler.
The documentation for that compiler will show what those flags do:
-a[cdghlmns]
Turn on listings, in any of a variety of ways:
-ac omit false conditionals
-ad omit debugging directives
-ag include general information, like as version and options passed
-ah include high-level source
-al include assembly
-am include macro expansions
-an omit forms processing
-as include symbols
=file
set the name of the listing file
You may combine these options; for example, use -aln for assembly listing without forms processing. The
=file option, if used, must be the last one. By itself, -a defaults to -ahls.
2022-03-04 06:01 AM
Thanks for your reply, that really helpful, but there is still one more question:
Through your answer, I know the meaning of alms mean of -Wa , -a(means -ahsl) and -alms, but why use -ad alone here? According to my understanding, it can be written as -adlms(together with -alms).
And why there used -ad twice (in -a and -alms)?
2022-03-04 01:20 PM
Both ways seem equivalent to me as well, but we're pretty deep in the weeds here and I'm not an expert in the assembly compiler flags.
There are often multiple ways to do things. If they both work, which one to use is academic. You'd need to ask the person who wrote it why they did what they did.
2022-03-04 10:15 PM
My question is also just mainly about their different effects, it's good to know that they are equivalent.
Thanks again.