[英]build assembler file using makefile with iar compiler
All the C code builds and links without error.所有 C 代码构建和链接均无错误。 My assembly file is cstartup.s I now need it to build the assembly file as well
我的程序集文件是 cstartup.s 我现在也需要它来构建程序集文件
In the makefile (cutdown a lot here, but remember it builds C code fine) I have this:在 makefile 中(这里减少了很多,但请记住它构建 C 代码很好)我有这个:
PROJ_SRC = $(SRC_DIR)/plsi2c_riscv.c \
…
$(SRC_DIR)/cstartup.s \
OBJ_FILES = $(addprefix $(BUILD_FOLDER)/,$(PROJ_SRC:.c=.o))
OBJ_FILES += $(addprefix $(BUILD_FOLDER)/,$(PROJ_SRC:.s=.o))
#compile C code
$(BUILD_FOLDER)/%.o: %.c
#Create the folder structure for the output file
@mkdir -p $(dir $@)
$(RISCV_IARCC) $(RISCV_CFLAGS) $< -o $@
#compile .s code
$(BUILD_FOLDER)/%.o: %.s
$(RISCV_IARCC) $(RISCV_CFLAGS) $< -o $@
#link
CC = $(RISCV_IARLINK)
$(BUILD_FOLDER)/twowire: $(OBJ_FILES)
mkdir -p $(dir $@)
@echo Linking $(notdir $@)
$(CC) $(RISCV_LDFLAGS) $^ $(LDLIBS)
I always get this error: make: *** No rule to make target '/c/BitBucket/riscv/src/release//c/BitBucket/riscv/src/cstartup.s' Although cstartup.s is definitely in c/BitBucket/riscv/src (it is there with the file plsi2c_riscv.c)我总是得到这个错误: make: *** No rule to make target '/c/BitBucket/riscv/src/release//c/BitBucket/riscv/src/cstartup.s' 虽然 cstartup.s 肯定在 c/ BitBucket/riscv/src(它与文件 plsi2c_riscv.c 一起存在)
Is there a way to do this?有没有办法做到这一点?
The solution was to put the assembly code file string in another group eg PROJ_ASM解决方案是将汇编代码文件字符串放在另一个组中,例如 PROJ_ASM
PROJ_SRC = $(SRC_DIR)/plsi2c_riscv.c \
…etc
PROJ_ASM = $(SRC_DIR)/cstartup.s \
OBJ_FILES = $(addprefix $(BUILD_FOLDER)/,$(PROJ_SRC:.c=.o))
OBJ_FILES += $(addprefix $(BUILD_FOLDER)/,$(PROJ_ASM:.s=.o))
#compile C code
$(BUILD_FOLDER)/%.o: %.c
#Create the folder structure for the output file
@mkdir -p $(dir $@)
$(RISCV_IARCC) $(RISCV_CFLAGS) $< -o $@
#compile .s code
$(BUILD_FOLDER)/%.o: %.s
$(RISCV_IARASM) $(RISCV_ASMFLAGS) $< -o $@
#link
CC = $(RISCV_IARLINK)
$(BUILD_FOLDER)/twowire: $(OBJ_FILES)
mkdir -p $(dir $@)
@echo Linking $(notdir $@)
$(CC) $(RISCV_LDFLAGS) $^ $(LDLIBS)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.