Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 10 months ago.
Off-line ARM-GCC build of eCompass example fails
Off-line ARM-GCC build of eCompass example fails
I use Mbed-cli to import locally (includes eCompass_Lib_V3.ar file)
mbed import https://os.mbed.com/users/JimCarver/code/KL46_eCompass/ -v
And use the online compiler export function the get the makefile (toolchain vscode_gcc_arm)
I build the program using GNU Tools ARM Embedded version 7 2017-q4-major and receive the following errors during linking
link error
link: KL46_eCompass.elf eCompass_Lib/eCompass_Lib.o: In function `eCompass::eCompass()': eCompass_Lib.cpp:(.text._ZN8eCompassC2Ev+0x4): undefined reference to `init_eCompass' eCompass_Lib/eCompass_Lib.o: In function `eCompass::run(MotionSensorDataCounts&, MotionSensorDataCounts&)': eCompass_Lib.cpp:(.text._ZN8eCompass3runER22MotionSensorDataCountsS1_+0xd2): undefined reference to `run_eCompass' eCompass_Lib/eCompass_Lib.o: In function `eCompass::calibrate()': eCompass_Lib.cpp:(.text._ZN8eCompass9calibrateEv+0x2): undefined reference to `calibrate_eCompass' collect2.exe: error: ld returned 1 exit status make[1]: *** [/cygdrive/e/Dvm/ARM/KL46_eCompass/Makefile:267: KL46_eCompass.elf] Error 1
makefile elf rule
265 $(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS) $(PROJECT).link_script.ld 266 +@echo "link: $(notdir $@)" 267 @$(LD) $(LD_FLAGS) -T $(filter-out %.o, $^) $(LIBRARY_PATHS) --output $@ $(filter %.o, $^) $(LIBRARIES) $(LD_SYS_LIBS)
Adding the .ar file to line 267
updated makefile
@$(LD) $(LD_FLAGS) -T $(filter-out %.o, $^) $(LIBRARY_PATHS) --output $@ $(filter %.o, $^) $(LIBRARIES) $(LD_SYS_LIBS) .././eCompass_Lib/eCompass_Lib_V3.ar
results in the following errors
link error
link: KL46_eCompass.elf c:/.../arm-none-eabi/bin/ld.exe: error: .././eCompass_Lib/eCompass_Lib_V3.ar(sensor_algorithms.o): Conflicting CPU architectures 12/0 c:/.../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file .././eCompass_Lib/eCompass_Lib_V3.ar(sensor_algorithms.o) c:/.../arm-none-eabi/bin/ld.exe: error: .././eCompass_Lib/eCompass_Lib_V3.ar(magnetic.o): Conflicting CPU architectures 12/0 c:/.../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file .././eCompass_Lib/eCompass_Lib_V3.ar(magnetic.o) c:/.../arm-none-eabi/bin/ld.exe: error: .././eCompass_Lib/eCompass_Lib_V3.ar(matrix.o): Conflicting CPU architectures 12/0 c:/.../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file .././eCompass_Lib/eCompass_Lib_V3.ar(matrix.o) c:/.../arm-none-eabi/bin/ld.exe: error: .././eCompass_Lib/eCompass_Lib_V3.ar(orientation.o): Conflicting CPU architectures 12/0 c:/.../arm-none-eabi/bin/ld.exe: failed to merge target specific data of file .././eCompass_Lib/eCompass_Lib_V3.ar(orientation.o) c:/.../arm-none-eabi/bin/ld.exe: Dwarf Error: Could not find abbrev number 10.
Am I going about this the wrong way or is the original eCompass_Lib_V3 library just not compatible with GCC because it was build using ARMCC?
1 Answer
6 years, 10 months ago.
Jun,
Why are you importing offline and then exporting from the online compiler? Why not just 'mbed import' and then 'mbed compile' or if you really want make files use 'mbed export' on the command line.
You are correc that the online compiler uses ARMCC, so you really cant mix and match. You can however use ARMCC locally, just like you can use IARCC or GCC with mbed CLI.