Makefile无法创建我正在创建的汇编代码

时间:2018-11-05 14:27:37

标签: assembly makefile armv6

我一直在按照本教程为树莓派here做一个简单的操作系统。尽管我不得不换用WinGW而不是yagarto来运行,但它一直运行良好,因为yagarto停止了正常工作,但是当我尝试制作该文件时,它突然开始出现错误,即使我做了一点工作也是如此曾经工作过的代码,所以非常混乱。我有名为gpio.s,main.s和systemTimer.s的文件。这是我的makefile:

###############################################################################
#   makefile
#    by Alex Chadwick
#
#   A makefile script for generation of raspberry pi kernel images.
###############################################################################

# The toolchain to use. arm-none-eabi works, but there does exist 
# arm-bcm2708-linux-gnueabi.
ARMGNU ?= arm-none-eabi

# The intermediate directory for compiled object files.
BUILD = build/

# The directory in which source files are stored.
SOURCE = source/

# The name of the output file to generate.
TARGET = kernel.img

# The name of the assembler listing file to generate.
LIST = kernel.list

# The name of the map file to generate.
MAP = kernel.map

# The name of the linker script to use.
LINKER = kernel.ld

# The names of all object files that must be generated. Deduced from the 
# assembly code files in source.
OBJECTS := $(patsubst $(SOURCE)%.s,$(BUILD)%.o,$(wildcard $(SOURCE)*.s))

# Rule to make everything.
all: $(TARGET) $(LIST)

# Rule to remake everything. Does not include clean.
rebuild: all

# Rule to make the listing file.
$(LIST) : $(BUILD)output.elf
    $(ARMGNU)-objdump -d $(BUILD)output.elf > $(LIST)

# Rule to make the image file.
$(TARGET) : $(BUILD)output.elf
    $(ARMGNU)-objcopy $(BUILD)output.elf -O binary $(TARGET) 

# Rule to make the elf file.
$(BUILD)output.elf : $(OBJECTS) $(LINKER)
    $(ARMGNU)-ld --no-undefined $(OBJECTS) -Map $(MAP) -o $(BUILD)output.elf -T $(LINKER)

# Rule to make the object files.
$(BUILD)%.o: $(SOURCE)%.s $(BUILD)
    $(ARMGNU)-as -I $(SOURCE) $< -o $@

$(BUILD):
    mkdir $(@:/=)

# Rule to clean files.
clean : 
    -rm -rf $(BUILD)
    -rm -f $(TARGET)
    -rm -f $(LIST)
    -rm -f $(MAP)

如果我通过调用make.exe来运行它,则会引发此错误:

process_begin: CreateProcess(NULL, arm-none-eabi-as -I source/ source/main.s -o build/main.o, ...) failed.
make (e=2): The system cannot find the file specified.
Makefile:54: recipe for target 'build/main.o' failed
make: *** [build/main.o] Error 2

它过去运行时没有错误,而且我很确定自己没有做任何事情,所以我正在尝试找出问题所在。任何帮助将不胜感激。

0 个答案:

没有答案