[ell-i-developers] Re: Ellduino Emulator: Fixing issues for Linux (Ubuntu 12.04 LTS)

  • From: Asif Sardar <engr.asif.sardar@xxxxxxxxxxxxxx>
  • To: ell-i-developers@xxxxxxxxxxxxx
  • Date: Thu, 20 Feb 2014 03:47:03 +0200

Hi Pekka,


*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?

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?




On Mon, Feb 17, 2014 at 4:47 PM, Pekka Nikander <pekka.nikander@xxxxxx>wrote:

> > g++ -c -std=c++11 -g -Os -Wall -ffunction-sections -fdata-sections
> -fno-common -nostdlib -m32 -march=i386 -DF_CPU=48000000L -DARDUINO=1.5.4
> -DELLI_STM32F051_ELLDUINO -DARDUINO_ARCH_STM32 -DEMULATOR -D__STM32F051__
> -Dmain=emulated_main -I../emulator/inc -I../cores/arduelli
> -I../system/stm32/inc -I../system/stm32/CMSIS/Include
> -I../variants/ellduino    -c -o emulator_pre.o
> ../emulator/src/emulator_pre.c
> > /tmp/cc4s2eZQ.s: Assembler messages:
> > /tmp/cc4s2eZQ.s:5: Error: character following name is not '#'
> >
> > I am getting other binaries, but for emulator_pre.o, there is error
> mentioned above. Does it needs changes in compiler/assembler flags ...
>
> emulator_pre has never worked on Linux, and the way it is currently done
> means that it won't work without changes.
>
> The eventual changes may be small (changing the section name), but instead
> of me doing that I think it is better that you now study the details and
> document them.  The details are in system/stm32/inc/system_init.h,
> system/stm32/src/system_init.h, and variants/ellduino/ld/flash.ld  In
> essence, the system init records are placed into the .preripheral.*
> segment, with the _peripheral_start and _peripheral_end framing it.
>
> 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.
>
> > Regarding the Wiki, I have noted these points in a file ... after
> getting emulator fixed, I will make a WiKi page mentioning problems and its
> solutions.
>
> My recommendation is to start the Wiki file early, as that allows also
> others to comment and contribute to it.  But YMMV.
>
> > I remember, we agreed to meet on Feb 19th at 4pm, Wednesday regarding
> test cases ... but we have already discussed that in 12th Feb meeting. Do
> we need to meet for test cases, because emulator still needs to be fixed?
>
> I think it is useful to have a meeting on Wednesday anyway.  If you cannot
> make it, no problem, I'm sure Ivan and I can use the slot in a productive
> way in any case.
>
> --Pekka
>
>
>
>


-- 



*With Best Regards,Asif Sardar.+358 43 8265795*

Attachment: default-linker-script
Description: Binary data

Other related posts: