using default linker and removing the emulator_pre.o & emulator_post.o from emulator.mk leaves errors which had to be solved: *g++ -m32 -L/usr/lib32 -march=i386 -m32 -o sketch main.o sketch.o ellduino.o "-L." "-L../variants/ellduino" "-lstm32f0" -lstdc++ ../variants/ellduino/libstm32f0.a(system_init.o): In function `SystemInitPeripherals':/home/asif/Ell-i/Runtime/stm32/build/../system/stm32/src/system_init.c:111: undefined reference to `__peripheral_start'/home/asif/Ell-i/Runtime/stm32/build/../system/stm32/src/system_init.c:111: undefined reference to `__peripheral_end'* *you have to create a new linker script, and either copy to it or include to it the default gcc 4.7 linker file for Linux.* I tried my best to find the default script file ... I couldn't ... the only way to see it was "ld --verbose". *> Is it possible, so that we link manually, calling the ld-script written/(copied from default) ourselves e.g. emulator/ld/linux.ld for the emulator objects? Any idea how to call this ld script from emulator make file? Putting the things above together, you should pass the following options to gcc: -Xlinker -T -Xlinker your-linker-script.ld* I tried copying the default linker file content to emulator/ld/linux.ld and then tried making emulator which left me with following errors: Note here that, I have already installed g++-multilib, c++-multilib, build-essentials, ia32-lib, etc Also, I tired to put paths to LD_LIBRARY_PATH and LD_INCLUDE_PATH through export command. You may not know the Linux related problems, but ... you might give a general idea what's wrong now over here. g++ -m32 -L/usr/lib32 -march=i386 -m32 -T/home/asif/Ell-i/Runtime/stm32/emulator/ld/linux.ld -o sketch main.o sketch.o ellduino.o "-L." "-L../variants/ellduino" "-lstm32f0" -lstdc++ /usr/bin/ld: skipping incompatible ../variants/ellduino/libstm32f0.a when searching for -lstm32f0 /usr/bin/ld: cannot find -lstm32f0 /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/32/libstdc++.so when searching for -lstdc++ /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/32/libstdc++.a when searching for -lstdc++ /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/32/libstdc++.so when searching for -lstdc++ /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/32/libstdc++.a when searching for -lstdc++ /usr/bin/ld: skipping incompatible /usr/lib32/libm.so when searching for -lm /usr/bin/ld: skipping incompatible /usr/lib32/libm.a when searching for -lm /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../i386-linux-gnu/libm.so when searching for -lm /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../i386-linux-gnu/libm.a when searching for -lm /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib32/libm.so when searching for -lm /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib32/libm.a when searching for -lm /usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu/libm.so when searching for -lm /usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu/libm.a when searching for -lm /usr/bin/ld: skipping incompatible /usr/lib/../lib32/libm.so when searching for -lm /usr/bin/ld: skipping incompatible /usr/lib/../lib32/libm.a when searching for -lm /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../i386-linux-gnu/libm.so when searching for -lm /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../i386-linux-gnu/libm.a when searching for -lm /usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu/libm.so when searching for -lm /usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu/libm.a when searching for -lm /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/32/libgcc_s.so when searching for -lgcc_s /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/32/libgcc.a when searching for -lgcc /usr/bin/ld: skipping incompatible /usr/lib32/libc.so when searching for -lc /usr/bin/ld: skipping incompatible /usr/lib32/libc.a when searching for -lc /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../i386-linux-gnu/libc.so when searching for -lc /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../i386-linux-gnu/libc.a when searching for -lc /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib32/libc.so when searching for -lc /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib32/libc.a when searching for -lc /usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu/libc.so when searching for -lc /usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu/libc.a when searching for -lc /usr/bin/ld: skipping incompatible /usr/lib/../lib32/libc.so when searching for -lc /usr/bin/ld: skipping incompatible /usr/lib/../lib32/libc.a when searching for -lc /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../i386-linux-gnu/libc.so when searching for -lc /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../i386-linux-gnu/libc.a when searching for -lc /usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu/libc.so when searching for -lc /usr/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu/libc.a when searching for -lc On Thu, Feb 20, 2014 at 7:42 AM, Pekka Nikander <pekka.nikander@xxxxxx>wrote: > >> As in Mac OS X the gnu linker is not used, I cannot use a .ld file in > Mac. Hence, for the emulator only, instead of a .ld file I use the > emulator_post and emulator_pre objects, which define the _peripheral_start > and _peripheral_end. For Linux, you don't want them, but you want to > create a linux.ld file, probably in emulator/ld/linux.ld. For that, you > have to create a new linker script, and either copy to it or include to it > the default gcc 4.7 linker file for Linux. That in turn requires that you > first learn how the GNU ld scripts work and what happens here. It is > largely document in the comments, but only at a quite high level. > >> > >> Please have a look at default internal linker script used by COMMAND ld > in linux: > > > > My questions is that how to use this default linker script and add the > peripheral initialization memory variables there ... isn't it so that we > have recompile the whole GCC toolchain for that script? > > You definitely do *not* need to recompile the whole toolchain. > > As far as I know, just like in Unix, in Linux one can link a binary either > with gcc, which passes a number of default parameters to the ld command, or > directly with the ld command, as we do for the ARM binaries. > > From the arm ld command line (and the ld command manual page) you can see > that that the -T or --script option can be used to pass the linker the > linker script file. Then, from the gcc command manual page you can see > that one can use the -Xlinker option to pass an option to the linker. > > > Is it possible, so that we link manually, calling the ld-script > written/(copied from default) ourselves e.g. emulator/ld/linux.ld for the > emulator objects? Any idea how to call this ld script from emulator make > file? > > Putting the things above together, you should pass the following options > to gcc: > > -Xlinker -T -Xlinker your-linker-script.ld > > If you add those to the LDFLAGS variable in emulator.mk, that should work. > > --Pekka > > > -- *With Best Regards,Asif Sardar.+358 43 8265795*