1

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: $@'
    @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. 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?

DrJohn
  • 86
  • 1
  • 8

1 Answers1

0

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: $@'
    @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: $@'
levif
  • 2,156
  • 16
  • 14