xxxajk / Arduino_Makefile_master

Use make on macos Darwin or linux instead of arduino IDE.
15 stars 4 forks source link

Linker error for arduino due and arduino 1.5.8 #13

Open chrta opened 9 years ago

chrta commented 9 years ago

Hello,

i am trying to use the Makefile in Linux (fedora 21). Compilation works fine, but linking fails:

Building "build/arduino_due_x_dbg/libAuser_.a"... 
cp build/arduino_due_x_dbg/core_/libAcore_.a build/arduino_due_x_dbg/core_/libarduino_core.a
"/opt/arduino-1.5.8/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/arm-none-eabi-gcc" -Os -Wl,--gc-sections -mcpu=cortex-m3 "-T/opt/arduino-1.5.8/hardware/arduino/sam/variants/arduino_due_x/linker_scripts/gcc/flash.ld" "-Wl,-Map,build/arduino_due_x_dbg/Blink.map" -Wl,--relax -Lbuild/arduino_due_x_dbg/core_  -o "build/arduino_due_x_dbg/Blink.elf" "-Lbuild/arduino_due_x_dbg" -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group "build/arduino_due_x_dbg/syscalls_sam3.c.o" build/arduino_due_x_dbg/Blink_ino.o  -lAuser_   "/opt/arduino-1.5.8/hardware/arduino/sam/variants/arduino_due_x/libsam_sam3x8e_gcc_rel.a" "build/arduino_due_x_dbg/core_/libarduino_core.a" -Wl,--end-group -lm -gcc
arm-none-eabi-gcc: error: build/arduino_due_x_dbg/syscalls_sam3.c.o: No such file or directory
_Makefile.master:1181: recipe for target 'build/arduino_due_x_dbg/Blink.hex' failed
make: *** [build/arduino_due_x_dbg/Blink.hex] Error 1

I use the simple blink example and added include "Arduino.h"

My Makefile looks like this:

BOARD=arduino_due_x_dbg
PORT=/dev/ACM0
ARD_HOME=/opt/arduino-1.5.8
MAKE_QUIET_LINK=

include _Makefile.master

The file build/arduino_due_x_dbg/syscalls_sam3.c.o does not exist, but ./build/arduino_due_xdbg/core/syscalls_sam3_c.o exists.

The file ./hardware/arduino/sam/platform.txt in arduino 1.5.8 contains this:

## Combine gc-sections, archives, and objects
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mcpu={build.mcu} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" "-L{build.path}" -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group "{build.path}/syscalls_sam3.c.o" {object_files} "{build.variant.path}/{build.variant_system_lib}" "{build.path}/{archive_file}" -Wl,--end-group -lm -gcc
chrta commented 9 years ago

Here is a temporary (and ugly) workaround for this:

recipe_aDjOkT_c_aDjOkT_combine_aDjOkT_pattern_2 =$(subst /syscalls_sam3_aDjOkT_c_aDjOkT_o,/core_/syscalls_sam3_c_aDjOkT_o,$(recipe_aDjOkT_c_aDjOkT_combine_aDjOkT_pattern))
GO_LINK =$(recipe_aDjOkT_c_aDjOkT_combine_aDjOkT_pattern_2)