|
| 1 | +# This example toolchain file describes the cross compiler to use for |
| 2 | +# the target architecture indicated in the configuration file. |
| 3 | + |
| 4 | +# In this sample application, the cross toolchain is configured to |
| 5 | +# use a compiler for the RTEMS operating system targeting the "pc686" BSP |
| 6 | + |
| 7 | +# Note that to use this, the "RTEMS" platform module may need to be added |
| 8 | +# to the system-wide CMake installation as a default CMake does not yet |
| 9 | +# recognize RTEMS as a system name. An example of this is distributed with |
| 10 | +# the pc-rtems PSP. |
| 11 | + |
| 12 | +# Basic cross system configuration |
| 13 | +set(CMAKE_SYSTEM_NAME RTEMS) |
| 14 | +set(CMAKE_SYSTEM_PROCESSOR i386) |
| 15 | +set(CMAKE_SYSTEM_VERSION 5) |
| 16 | + |
| 17 | +# The TOOLS and BSP are allowed to be installed in different locations. |
| 18 | +# If the README was followed they will both be installed under $HOME |
| 19 | +# By default it is assumed the BSP is installed to the same directory as the tools |
| 20 | +SET(RTEMS_TOOLS_PREFIX "$ENV{HOME}/rtems-${CMAKE_SYSTEM_VERSION}" CACHE PATH |
| 21 | + "RTEMS tools install directory") |
| 22 | +SET(RTEMS_BSP_PREFIX "${RTEMS_TOOLS_PREFIX}" CACHE PATH |
| 23 | + "RTEMS BSP install directory") |
| 24 | + |
| 25 | +# The BSP that will be used for this build |
| 26 | +set(RTEMS_BSP "pc686") |
| 27 | + |
| 28 | +# specify the cross compiler - adjust accord to compiler installation |
| 29 | +# This uses the compiler-wrapper toolchain that buildroot produces |
| 30 | +SET(SDKHOSTBINDIR "${RTEMS_TOOLS_PREFIX}/bin") |
| 31 | +set(TARGETPREFIX "${CMAKE_SYSTEM_PROCESSOR}-rtems${CMAKE_SYSTEM_VERSION}-") |
| 32 | +set(RTEMS_BSP_C_FLAGS "-march=i686 -mtune=i686 -fno-common") |
| 33 | +set(RTEMS_BSP_CXX_FLAGS ${RTEMS_BSP_C_FLAGS}) |
| 34 | + |
| 35 | + |
| 36 | +SET(CMAKE_C_COMPILER "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}gcc") |
| 37 | +SET(CMAKE_CXX_COMPILER "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}g++") |
| 38 | +SET(CMAKE_LINKER "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}ld") |
| 39 | +SET(CMAKE_ASM_COMPILER "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}as") |
| 40 | +SET(CMAKE_STRIP "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}strip") |
| 41 | +SET(CMAKE_NM "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}nm") |
| 42 | +SET(CMAKE_AR "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}ar") |
| 43 | +SET(CMAKE_OBJDUMP "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}objdump") |
| 44 | +SET(CMAKE_OBJCOPY "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}objcopy") |
| 45 | + |
| 46 | +# Exception handling is very iffy. These two options disable eh_frame creation. |
| 47 | +set(CMAKE_C_COMPILE_OPTIONS_PIC -fno-exceptions -fno-asynchronous-unwind-tables) |
| 48 | + |
| 49 | +# Link libraries needed for an RTEMS 5.x executable |
| 50 | +# This was handled by the bsp_specs file in 4.11 |
| 51 | +set(LINK_LIBRARIES "-lrtemsdefaultconfig -lrtemsbsp -lrtemscpu") |
| 52 | + |
| 53 | +# search for programs in the build host directories |
| 54 | +SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) |
| 55 | + |
| 56 | +# for libraries and headers in the target directories |
| 57 | +SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) |
| 58 | +SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) |
| 59 | + |
| 60 | +SET(CMAKE_PREFIX_PATH /) |
| 61 | + |
| 62 | +# these settings are specific to cFE/OSAL and determines which |
| 63 | +# abstraction layers are built when using this toolchain |
| 64 | +SET(CFE_SYSTEM_PSPNAME pc-rtems) |
| 65 | +SET(OSAL_SYSTEM_BSPTYPE pc-rtems) |
| 66 | +SET(OSAL_SYSTEM_OSTYPE rtems) |
| 67 | + |
| 68 | +# This is for RTEMS 5 specific ifdefs needed by the OSAL |
| 69 | +ADD_DEFINITIONS(-D_RTEMS_5_) |
| 70 | + |
| 71 | +# Info regarding the RELOCADDR: |
| 72 | +#+--------------------------------------------------------------------------+ |
| 73 | +#| Set the value of RELOCADDR to the address where you want your image to |
| 74 | +#| load. If you'll be using GRUB to load the images it will have to be >= |
| 75 | +#| 0x100000 (1024K). If you are using NetBoot to load the images it can be |
| 76 | +#| >= 0x10000 (64K) AND <= 0x97C00 (607K) OR >= 0x100000 (1024K). The memory |
| 77 | +#| top is of course another limit. Make sure there is enough space before the |
| 78 | +#| upper memory limits for the image and the memory allocated by it to fit. |
| 79 | +#| Make sure the value you choose is aligned to 4 bytes. |
| 80 | +#+--------------------------------------------------------------------------+ |
| 81 | +set(RTEMS_RELOCADDR 0x00100000) |
| 82 | + |
| 83 | + |
0 commit comments