Building RTEMS hello world image using CMake

Sujay Raj sujayraaj at gmail.com
Sun Mar 13 11:52:31 UTC 2016


cmake works fine if the variables are over-ridden. And things aren't that
difficult while using pc386 bsp.
But if we are dealing with arm or other archs, the best way ( and the
recommended one ) to do during cross-compiling would be to create a
toolchain file, forcing cmake to use the cross compiling toolchain, and not
run its tests that it usually runs for x86/x86-64 systems.

documentation on how to do it is available here:

https://cmake.org/Wiki/CMake_Cross_Compiling

an example for the cmake toolchain file for building an application for
rtems:

https://github.com/sujayraaj/monkey/blob/1.6/cmake/rtems/RTEMS.tc

and adding :


set(ARCH arm )
set(BSP xilinx_zynq_a9_qemu )
set(BSP_CFLAGS "-march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard
-mtune=cortex-a9" )

set(RTEMS_CFLAGS "${BSP_CFLAGS} -O0 -g -qrtems
-B${BSP_DIR}/${ARCH}-rtems4.11/lib" )

set(RTEMS_CFLAGS "${RTEMS_CFLAGS}
-B${BSP_DIR}/${ARCH}-rtems4.11/xilinx_zynq_a9_qemu/lib/" )

set(RTEMS_CFLAGS "${RTEMS_CFLAGS} --specs bsp_specs")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${RTEMS_CFLAGS}")


at the top of the CmakeLists.txt file.

( Somehow I didn't recieve Chris's mail on this thread so what I have said
might be repetitive )


On Sat, Mar 12, 2016 at 8:23 PM, Gedare Bloom <gedare at rtems.org> wrote:

> If this works for you, and you are sufficiently interested, it would
> be useful to provide CMake example for the examples-v2.git repository
> for others to benefit.
>
> On Sat, Mar 12, 2016 at 9:29 AM, Sambeet Panigrahi
> <sambeet161616 at gmail.com> wrote:
> > Thank you Chris.That works perfectly:)
> >
> > On Mar 11, 2016 6:32 AM, "Chris Johns" <chrisj at rtems.org> wrote:
> >>
> >>  [ Please excuse the delay. It took a while to get
> >>    something worth posting sorted out. ]
> >>
> >> On 04/03/2016 14:46, Sambeet Panigrahi wrote:
> >>>
> >>> I wanted to build a hello world image of RTEMS using cmake. Can someone
> >>> provide me steps for doing so or point me to the right resources ?
> >>
> >>
> >> I attach a couple of files from a friend of mine, Andi, who knows and
> >> works with cmake. I have not tried them and I do not know if they work.
> >>
> >> If you have any questions please feel free to ask.
> >>
> >> Chris
> >
> >
> > _______________________________________________
> > devel mailing list
> > devel at rtems.org
> > http://lists.rtems.org/mailman/listinfo/devel
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20160313/b6f800e0/attachment.html>


More information about the devel mailing list