[ECOS] Re: Synthetic target on linux x86_64 host

Tarmo Kuuse tarmo.kuuse@mail.ee
Mon May 4 09:55:00 GMT 2009


Sergei Gavrikov wrote:
> On Sun, May 03, 2009 at 11:09:45PM +0300, Tarmo Kuuse wrote:
>> Thanks for the tips.
>>
>> Unfortunately I also host tools like rawether et al (no, they don't 
>> build either). eCos+gcc is a damn complex system and I don't have time 
>> (nor motivation, nor skill) for hacking it - when something breaks, 
>> result is pain, pain, pain. I'll just use a 32-bit environment.
>>
>> Nick Garnett wrote:
>>> Ross Younger <wry@ecoscentric.com> writes:
>>>
>>>> Tarmo Kuuse wrote:
>>>>> Can synthetic target even be built with native x86_64 tools?
>>>> As Andrew has said it's not a supported environment - synth predates
>>>> x86_64 by some years - and I suspect would require a proper porting
>>>> effort in due course.
>>>>
>>>> However, I did find myself poking at the synth target on my
>>>> workstation a few weeks ago (Ubuntu 8.10, 64-bit) and was able to get
>>>> it going, after a fashion, without very much trouble (and without
>>>> having to know much about x86/x86_64 guts!) in order to play with some
>>>> new code I was writing.
>>>>
>>>> I was using the eCos i386-elf toolchain; the syscalls and so on all
>>>> seemed to just work thanks to x86_64's backwards compatibility (and I
>>>> have various 32-bit compatibility libs installed, which may or may not
>>>> have helped).
>>>>
>>>> I manually configured my ecos.ecc to use i386-elf, and once I had
>>>> built eCos I had to edit target.ld by hand and remove the mention of
>>>> libgcc_eh.a in order for my test applications to link. For debugging,
>>>> the native gdb (not i386-elf-gcc!) just worked.
>>>>
>>>> Obviously, running synth cross-architecture in this way is not tested
>>>> at all - it seemed to work for my limited purposes, and might for you,
>>>> but if it breaks you get to keep both pieces :-)
>>>
>>> I have also been running the synthetic target on my OpenSuSE 11.0
>>> x86_64 system. I can do this without making any changes to eCos
>>> sources at all.
>>>
>>> I compile using the native "gcc" compiler, adding the -m32 flag. The
>>> default configuration tries to use i686-pc-linux-gnu-gcc, so I have
>>> put a script of that name in my path that simply contains the line
>>> "gcc -m32 $*". I have also had to define i686-pc-linux-gnu-ar to "ar
>>> $*". Those are the only two tools used during a build, and the
>>> standard native "gdb" then works to debug.
>>>
>>> Like Ross, I have the 32 bit compatibility libraries installed,
>>> together with the development packages for some. eCos synthetic target
>>> executables are not dynamically linked, so it may be necessary to
>>> install the static versions of libraries you already have in dynamic
>>> form. I simply used trial and error to work out which libraries were
>>> needed: try a build, work out which header or library is missing, find
>>> out which RPM it comes from, install that and repeat. The exact
>>> combination will obviously depend on how a specific distribution
>>> divided things up into packages, and what you might already have
>>> installed.
>> I admire the clever solutions. When the linker dies because something 
>> called "libgcc_eh.a" is missing I assume it's a sign from the gods 
>> saying it's not meant to build.
>  
> Often gods do not notice some things at all. To err is human. Tarno, it
> seemed for me that you won't like a receipt the below, but, that would
> be a useful for some atheists.
> 
> I use the wellknown variables and stream editor to play with eCos synth
> target using the prebuilt i386-elf toolchain from eCosCentric
> 
>     ecosconfig new linux
>     ecosconfig tree
> 
>     # No tweaks of ecos.ecc, let use vars
>     make CC=i386-elf-gcc AR=i386-elf-ar
> 
>     # Is it a trick? Well, it is.
>     sed -i 's/ libgcc_eh.a//' install/lib/target.ld
> 
> The sed has one nice option `-i' (edit files in place)
> 
>     $ head -4 install/lib/target.ld 
>     STARTUP(vectors.o)
>     ENTRY(_start)
>     INPUT(extras.o)
>     GROUP(libtarget.a libgcc.a libsupc++.a)
> 
> 
> Then using the same parameters I can build the tests, etc.
> 
>     make CC=i386-elf-gcc AR=i386-elf-ar -C kernel/current tests
> 
> and play with them using native host's GDB
> 
>     gdb -q install/tests/kernel/current/tests/tm_basic
> 
> 
> Of course, you can have something like such an alias the below to play
> with synth target in ... a bash
> 
>     alias maksyn='make CC=i386-elf-gcc AR=i386-elf-ar'
> 
> or to use a scripting...

I humbly suggest updating the FAQ or documentation with a note on 64-bit 
hosts (and the solid know-how provided by previous posters so novices 
have at least a dim glow in the black of night).

OT: Have the eCos web site maintainers ever considered adding a wiki?

--
Kind regards,
Tarmo Kuuse


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list