2016-11-04 18 views
1

早上好, 我試圖爲愛特梅爾AT92SAM使用Eclipse和GNU-臂工具鏈交叉編譯的Windows 7GNU使沒有錯誤停止前的makefile結束

我的問題是下,該建築物進程在鏈接器完成後停止,但它也應該創建一個原始二進制文件並打印大小。 下面是生成文件的摘錄日食創建:

# 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 ' ' 

但不執行的最後兩個命令不創建的.bin。命令行輸出是

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

如您所見,objcopy和size命令未被調用。 任何想法?

+1

你只是援引「製造」或「讓所有」?如果是這樣,它正在做你的「全部」目標告訴它...... – Notlikethat

+2

'all:main.bin main.siz' – user657267

+0

你是對的..顯然,eclipse選項沒有設置正確。 – DrJohn

回答

0

您可以直接在main.exe配方添加尺寸main.siz是不是一個真正的輸出文件(應爲.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]'