当前位置: 动力学知识库 > 问答 > 编程问答 >

c - 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.

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:

# All Target

all: main.exe

# Tool invocations

main.exe: $(OBJS) $(USER_OBJS)

@echo 'Building target: [email protected]'

@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: [email protected]'

@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: [email protected]'

@echo ' '

main.siz: main.exe

@echo 'Invoking: Cross ARM GNU Print Size'

arm-none-eabi-size --format=berkeley "main.exe"

@echo 'Finished building: [email protected]'

@echo ' '

But the last two commands are not performed and no .bin is created. 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.

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):

all: main.bin

main.exe: $(OBJS) $(USER_OBJS)
    @echo 'Building target: [email protected]'
    @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 "[email protected]" $(OBJS) $(USER_OBJS) $(LIBS)
    arm-none-eabi-size --format=berkeley "[email protected]"
    @echo 'Finished building target: [email protected]'

main.bin: main.exe
    @echo 'Invoking: Cross ARM GNU Create Flash Image'
    arm-none-eabi-objcopy -O binary "$<" "[email protected]"
    @echo 'Finished building: [email protected]'
分享给朋友:
您可能感兴趣的文章:
随机阅读: