cancel
Showing results for 
Search instead for 
Did you mean: 

What do these parameters mean in the makeifle that generated by cubemx?

YWeih.1
Associate II

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.

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

-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.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

4 REPLIES 4
TDK
Guru

-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.

If you feel a post has answered your question, please click "Accept as Solution".

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)?

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.

If you feel a post has answered your question, please click "Accept as Solution".

My question is also just mainly about their different effects, it's good to know that they are equivalent.

Thanks again.