[CMake] Cross compile + shared libs problem
Alexander Neundorf
a.neundorf-work at gmx.net
Tue Apr 1 19:39:11 EDT 2008
On Wednesday 02 April 2008, you wrote:
> On Tue, Apr 01, 2008 at 10:12:20PM +0200, Alexander Neundorf wrote:
> > On Tuesday 01 April 2008, you wrote:
> > > On Sat, Mar 29, 2008 at 12:25:45AM +0100, Alexander Neundorf wrote:
> > > > On Tuesday 25 March 2008, you wrote:
> > > > ...
> > > >
> > > > > I validated the general approach this morning, should be ready by
> > > > > tomorrow.
> > > >
> > > > News ?
> > >
> > > Sorry, I couldn't quite save time to make a nice platform file. Would
> > > you accept the following Rtems.make so that at least CMAKE_SYSTEM_NAME
> > > == "Rtems" works?
> >
> > Hmm, no, that's a bit too little yet.
> > If this is really enough to have apps and libs build for rtems, yes. If
> > not, we can do that later.
> > If you have questions, just ask :-)
>
> Well, I didn't figure out what should go to Platform, and what should
> go to Toolchain. In fact the target is processor + bsp [1]. Should we make
> a Toolchain per processor + bsp?
>
> [1] Board Support Package, for example for sparc:
> * ERC32 with FPU
> * SPARC Instruction Simulator (sis)
> * leon2
> * leon3
You must have:
Rtems.cmake
You can have
Rtems-GNU-C.cmake
Rtems-GNU-CXX.cmake
and for different boards you could consider setting CMAKE_SYSTEM_PROCESSOR,
e.g. to leon3, then you could have additionally:
Rtems-GNU-C-leon2.cmake
Rtems-GNU-CXX-leon2.cmake
These two files will be loaded before Rtems-GNU-C.cmake and
Rtems-GNU-CXX.cmake, so you can adjust
variables in Rtems-GNU-[C|CXX]-leon2.cmake which can then be used in
Rtems-GNU-[C|CXX].cmake
Does this help ?
> > > I'm sorting out some setup problems, so I've not managed to prepare
> > > a Rtems.make file that's able to generate executables (There are a
> > > few linking flags and objdump magic that seem to be standard in Rtems
> > > developemnt).
> >
> > What do you need to do with objdump ?
>
> Err, objcopy, my bad. A first pass does a bunch of --remove-section=, and a
> second one does a -O binary with the resulting elf file. Then a "bin2boot"
> utility is used to build the final bootable .exe file.
>
> i386-rtems4.7-objcopy -O elf32-i386 --remove-section=.rodata
> --remove-section=.comment --remove-section=.note --strip-unneeded
> o-optimize/stub_server.elf o-optimize/stub_server.exe i386-rtems4.7-objcopy
> -O binary o-optimize/stub_server.elf o-optimize/stub_server.bin
> /opt/rtems/rtems4.7/i386-rtems4.7/pc386/build-tools/bin2boot -v
> o-optimize/stub_server.bt 0x00097E00
> /opt/rtems/rtems4.7/i386-rtems4.7/pc386/lib/start16.bin 0x00097C00 0
> o-optimize/stub_server.bin 0x00100000 0 Plus, there are a few magic numbers
> there which use I need to figure out.
You can do this using add_custom_command(), you could create a macro for that
in Rtems.cmake.
Alex
More information about the CMake
mailing list