Skip to content

Commit ba709ed

Browse files
authored
Merge pull request #574 from jphickey/fix-573-rtems-example-toolchain
Fix #573, Update RTEMS example toolchain
2 parents 9349100 + 6ff4e5f commit ba709ed

File tree

1 file changed

+43
-21
lines changed

1 file changed

+43
-21
lines changed

cmake/sample_defs/toolchain-i686-rtems4.11.cmake

+43-21
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,41 @@
1010
# the pc-rtems PSP.
1111

1212
# Basic cross system configuration
13-
SET(RTEMS_TOOLS_TOP "/opt/rtems-4.11")
14-
SET(RTEMS_BSP_TOP "/opt/x-tools/rtems-4.11" CACHE PATH "Rtems install directory")
13+
set(CMAKE_SYSTEM_NAME RTEMS)
14+
set(CMAKE_SYSTEM_PROCESSOR i386)
15+
set(CMAKE_SYSTEM_VERSION 4.11)
1516

16-
SET(CMAKE_SYSTEM_NAME RTEMS)
17-
SET(CMAKE_SYSTEM_VERSION 1)
18-
SET(CMAKE_SYSTEM_PROCESSOR i686)
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")
1924

20-
# specify the cross compiler
21-
SET(CMAKE_C_COMPILER ${RTEMS_TOOLS_TOP}/bin/i386-rtems4.11-gcc)
22-
SET(CMAKE_CXX_COMPILER ${RTEMS_TOOLS_TOP}/bin/i386-rtems4.11-g++)
23-
SET(CMAKE_LINKER ${RTEMS_TOOLS_TOP}/bin/i386-rtems4.11-ld)
25+
# The BSP that will be used for this build
26+
set(RTEMS_BSP "pc686")
2427

25-
# where is the target environment
26-
SET(CMAKE_FIND_ROOT_PATH ${RTEMS_TOOLS_TOP}/i386-rtems4.11
27-
${RTEMS_TOOLS_TOP}/lib/gcc/i386-rtems4.11/4.8.2 ${RTEMS_BSP_TOP}/i386-rtems4.11/pc686)
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+
SET(CMAKE_C_COMPILER "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}gcc")
36+
SET(CMAKE_CXX_COMPILER "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}g++")
37+
SET(CMAKE_LINKER "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}ld")
38+
SET(CMAKE_ASM_COMPILER "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}as")
39+
SET(CMAKE_STRIP "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}strip")
40+
SET(CMAKE_NM "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}nm")
41+
SET(CMAKE_AR "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}ar")
42+
SET(CMAKE_OBJDUMP "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}objdump")
43+
SET(CMAKE_OBJCOPY "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}objcopy")
44+
45+
# Note that CEXP is not a shared library loader - it will not support code compiled with -fPIC
46+
# Also 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)
2848

2949
# search for programs in the build host directories
3050
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
@@ -41,14 +61,16 @@ SET(CFE_SYSTEM_PSPNAME pc-rtems)
4161
SET(OSAL_SYSTEM_BSPTYPE pc-rtems)
4262
SET(OSAL_SYSTEM_OSTYPE rtems)
4363

44-
# Forces the "Init" symbol to be undefined so it can be defined in a library
45-
SET(CFE_ENTRY_SYM Init)
46-
47-
SET(CMAKE_C_FLAGS_INIT "-march=i686 -B${RTEMS_BSP_TOP}/i386-rtems4.11/pc686/lib"
48-
CACHE STRING "C Flags required by platform")
64+
# Info regarding the RELOCADDR:
65+
#+--------------------------------------------------------------------------+
66+
#| Set the value of RELOCADDR to the address where you want your image to
67+
#| load. If you'll be using GRUB to load the images it will have to be >=
68+
#| 0x100000 (1024K). If you are using NetBoot to load the images it can be
69+
#| >= 0x10000 (64K) AND <= 0x97C00 (607K) OR >= 0x100000 (1024K). The memory
70+
#| top is of course another limit. Make sure there is enough space before the
71+
#| upper memory limits for the image and the memory allocated by it to fit.
72+
#| Make sure the value you choose is aligned to 4 bytes.
73+
#+--------------------------------------------------------------------------+
74+
set(RTEMS_RELOCADDR 0x00100000)
4975

50-
# For RTEMS also install rtems-grub.cfg that allows booting using QEMU
51-
macro(target_add_hook TGTNAME)
52-
install(FILES ${MISSION_DEFS}/${TGTNAME}_rtems-grub.cfg DESTINATION ${TGTNAME} RENAME rtems-grub.cfg)
53-
endmacro()
5476

0 commit comments

Comments
 (0)