简体   繁体   English

在makefile完成之前,GNU make会在没有错误的情况下停止

[英]GNU make stops without error before makefile is finished

Good morning, I am trying to cross-compile for an Atmel AT92SAM using Eclipse with the GNU-Arm toolchain under Windows 7. 早上好,我正在尝试使用Eclipse与Windows 7下的GNU-Arm工具链交叉编译Atmel AT92SAM。

My Problem is, that the building process stops after the linker finished, although it should also create a raw binary and print the size. 我的问题是,链接器完成后构建过程停止,尽管它也应该创建一个原始二进制文件并打印大小。 Here is an excerpt from the makefile eclipse created: 以下是创建的makefile eclipse的摘录:

# All Target
all: main.exe

# Tool invocations
main.exe: $(OBJS) $(USER_OBJS)
    @echo 'Building target: $@'
    @echo 'Invoking: Cross ARM C Linker'
    arm-none-eabi-gcc -mcpu=arm7tdmi -mthumb -O0 -fsigned-char -ffunction-sections  -g -Xlinker --gc-sections -Wl,-Map,"main.map" --entry=0x00000000 -o "main.exe" $(OBJS) $(USER_OBJS) $(LIBS)
    @echo 'Finished building target: $@'
    @echo ' '

main.bin: main.exe
    @echo 'Invoking: Cross ARM GNU Create Flash Image'
    arm-none-eabi-objcopy -O binary "main.exe"  "main.bin"
    @echo 'Finished building: $@'
    @echo ' '

main.siz: main.exe
    @echo 'Invoking: Cross ARM GNU Print Size'
    arm-none-eabi-size --format=berkeley "main.exe"
    @echo 'Finished building: $@'
    @echo ' '

But the last two commands are not performed and no .bin is created. 但是最后两个命令没有执行,也没有创建.bin。 The Commandline Output is 命令行输出是

...
Finished building: ../src/main.c

Building file: ../.metadata/.plugins/org.eclipse.cdt.managedbuilder.core/spec.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=arm7tdmi -mthumb -O0 -fsigned-char -ffunction-sections  -g -DTRACE_LEVEL=4 -Dflash -Dat91sam7x512  -I"[My includes] -std=gnu99 -MMD -MP -MF".metadata/.plugins/org.eclipse.cdt.managedbuilder.core/spec.d" -MT".metadata/.plugins/org.eclipse.cdt.managedbuilder.core/spec.o" -c -o ".metadata/.plugins/org.eclipse.cdt.managedbuilder.core/spec.o" "../.metadata/.plugins/org.eclipse.cdt.managedbuilder.core/spec.c"
Finished building: ../.metadata/.plugins/org.eclipse.cdt.managedbuilder.core/spec.c

Building file: ../.metadata/.plugins/org.eclipse.cdt.make.core/specs.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=arm7tdmi -mthumb -O0 -fsigned-char -ffunction-sections  -g -DTRACE_LEVEL=4 -Dflash -Dat91sam7x512 -I"[my includes]" -std=gnu99 -MMD -MP -MF".metadata/.plugins/org.eclipse.cdt.make.core/specs.d" -MT".metadata/.plugins/org.eclipse.cdt.make.core/specs.o" -c -o ".metadata/.plugins/org.eclipse.cdt.make.core/specs.o" "../.metadata/.plugins/org.eclipse.cdt.make.core/specs.c"
Finished building: ../.metadata/.plugins/org.eclipse.cdt.make.core/specs.c

Building target: main.exe
Invoking: Cross ARM C Linker
arm-none-eabi-gcc -mcpu=arm7tdmi -mthumb -O0 -fsigned-char -ffunction-sections  -g -Xlinker --gc-sections -Wl,-Map,"main.map" --entry=0x00000000 -o "main.exe"  [my object files]  ./.metadata/.plugins/org.eclipse.cdt.managedbuilder.core/spec.o  ./.metadata/.plugins/org.eclipse.cdt.make.core/specs.o   -lm
Finished building target: main.exe


08:31:22 Build Finished (took 10s.91ms)

As you see, the objcopy and size commands are not called. 如您所见,不会调用objcopy和size命令。 Any Ideas? 有任何想法吗?

You may directly add the size inside main.exe recipe as main.siz is not a real output file (which should be .PHONY ): 您可以直接在main.exe配方中添加大小,因为main.siz不是真正的输出文件(应该是.PHONY ):

all: main.bin

main.exe: $(OBJS) $(USER_OBJS)
    @echo 'Building target: $@'
    @echo 'Invoking: Cross ARM C Linker'
    arm-none-eabi-gcc -mcpu=arm7tdmi -mthumb -O0 -fsigned-char -ffunction-sections  -g -Xlinker --gc-sections -Wl,-Map,"main.map" --entry=0x00000000 -o "$@" $(OBJS) $(USER_OBJS) $(LIBS)
    arm-none-eabi-size --format=berkeley "$@"
    @echo 'Finished building target: $@'

main.bin: main.exe
    @echo 'Invoking: Cross ARM GNU Create Flash Image'
    arm-none-eabi-objcopy -O binary "$<" "$@"
    @echo 'Finished building: $@'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM