Reputation: 51
All the C code builds and links without error. My assembly file is cstartup.s I now need it to build the assembly file as well
In the makefile (cutdown a lot here, but remember it builds C code fine) I have this:
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)
Is there a way to do this ?
Upvotes: 1
Views: 215
Reputation: 51
The solution was to put the assembly code file string in another group eg 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)
Upvotes: 1