我正在学习并尝试为基于皮质的 Holtek 芯片编写 makefile。我打算以STM32为模板修改cubemx生成的makefile,但是我对GCC和make工具不是特别熟悉。
现在我正在研究这部分。
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
我不知道参数 -Wa
、-a
、-ad
和 alms
的含义。我查了GCC手册,但只找到了描述-Wa 的 >:
-Wa,选项
将选项作为选项传递给汇编器。如果选项包含
逗号,以逗号分隔为多个选项。
而且我无法从这个描述中理解它的真正功能。
它们是什么意思?
需要在Holtek芯片的makefile中修改吗?
I am learning and trying to write a makefile for a cortex based Holtek's chip. I intend to modify the makefile generated by cubemx for STM32 as a template, but I am not particularly familiar with GCC and make tools.
Now I'm studying this part.
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) lt; -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.
And I can't understand its real function from this description.
What do they mean?
Should I modify it in the makefile of Holtek chip?
发布评论
评论(1)
正如 Tom V 提到的,第一个参数
-Wa
用于将后续参数-a,-ad,-alms
发送到汇编编译器 (GAS)。参数
-a
、-ad
和-alms
用于生成列表文件(这些.lst
文件您可以在编译期间在构建输出目录中找到。列出文件对于了解编译后的代码的低级详细信息很有用。
您可以在此处找到有关这些选项(和其他选项)的更多详细信息:
https://ftp.gnu.org/old-gnu/Manuals/gas-2.9.1/html_chapter/as_2.html#SEC10
和这里:
https://www.systutorials.com/generate-a-mixed-source-and-assemble-listing-using-gcc/
无需更改,但如果您想编译得更快一点,则可以省略这些参数(在我的设置中并没有太大区别)。
As mentioned by Tom V, the first parameter
-Wa
is used to send the subsequent parameters-a,-ad,-alms
to the assembler compiler (GAS).The arguments
-a
,-ad
, and-alms
are used to generate listing files (those.lst
files you find in build output directory) during compilation.Listing files are useful to understand low-level details of your code after being compiled.
You can find more details about these options (and others)here:
https://ftp.gnu.org/old-gnu/Manuals/gas-2.9.1/html_chapter/as_2.html#SEC10
and here:
https://www.systutorials.com/generate-a-mixed-source-and-assembly-listing-using-gcc/
No need to change, but you can omit these parameters if you want to compile a bit faster (not really a great difference in my setup).