-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathToolchain-vxworks6.6-Linux.cmake
135 lines (113 loc) · 6.24 KB
/
Toolchain-vxworks6.6-Linux.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# VxWorks 6.6 toolchain in Ubuntu environment.
#
SET (VX_TOOL_FAMILY gnu)
SET (VX_TOOL e500v2gnu)
SET (VX_CPU_FAMILY ppc)
SET (VX_CPU PPC32)
SET (VX_CPU_CARD ADS8572)
SET (VX_CPU_VARIANT _ppc85XX_e500v2)
SET (VX_VERSION vxworks-6.6)
# ホストOSの判定
FIND_PROGRAM (UNAME uname)
MARK_AS_ADVANCED (UNAME)
EXECUTE_PROCESS (COMMAND ${UNAME} OUTPUT_VARIABLE VXWORKS_HOST_OS)
IF (VXWORKS_HOST_OS MATCHES "SunOS")
SET (WIND_HOST_TYPE sun4-solaris2)
SET (WIND_HOME /usr/local/vw/workbench3.0)
ELSEIF (VXWORKS_HOST_OS MATCHES "Linux")
SET (WIND_HOST_TYPE x86-linux2)
IF (NOT EXISTS "$ENV{WIND_HOME}")
MESSAGE (STATUS "WIND_HOME=$ENV{WIND_HOME}")
MESSAGE (FATAL_ERROR "Please provide valid WIND_HOME environment variable.")
ENDIF (NOT EXISTS "$ENV{WIND_HOME}")
SET (WIND_HOME "$ENV{WIND_HOME}")
ENDIF (VXWORKS_HOST_OS MATCHES "SunOS")
# Path Settings
SET (WIND_BASE ${WIND_HOME}/${VX_VERSION})
SET (WIND_GNU_BASE ${WIND_HOME}/gnu/4.1.2-${VX_VERSION}/${WIND_HOST_TYPE})
SET (VX_VW_BASE ${WIND_BASE}/target)
# environment variables required by compiler
SET (WIND_ENV "WIND_HOME=${WIND_HOME} WIND_HOST_TYPE=${WIND_HOST_TYPE} WIND_BASE=${WIND_BASE}")
################################################################################
SET (VXWORKS ON)
SET (VXWORKS_MAJOR 6)
SET (VXWORKS_MINOR 6)
SET (CMAKE_SYSTEM_NAME VxWorks)
SET (CMAKE_SYSTEM_VERSION ${VX_VERSION})
SET (CMAKE_SYSTEM_PROCESSOR ${VX_CPU_FAMILY})
INCLUDE (CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER(${WIND_GNU_BASE}/bin/ccppc GNU)
CMAKE_FORCE_CXX_COMPILER(${WIND_GNU_BASE}/bin/c++ppc GNU)
SET (CMAKE_LINKER ${WIND_GNU_BASE}/bin/ldppc CACHE FILEPATH "vxworks linker")
SET (CMAKE_AR ${WIND_GNU_BASE}/bin/arppc CACHE FILEPATH "vxworks ar")
SET (CMAKE_NM ${WIND_GNU_BASE}/bin/nmppc CACHE FILEPATH "vxworks nm")
SET (CMAKE_STRIP ${WIND_GNU_BASE}/bin/stripppc CACHE FILEPATH "vxworks strip")
SET (CMAKE_OBJCOPY ${WIND_GNU_BASE}/bin/objcopyppc CACHE FILEPATH "vxworks objcopy")
SET (CMAKE_OBJDUMP ${WIND_GNU_BASE}/bin/objdumpppc CACHE FILEPATH "vxworks objdump")
SET (CMAKE_RANLIB ${WIND_GNU_BASE}/bin/ranlibppc CACHE FILEPATH "vxworks ranlib")
SET (CMAKE_EXE_LINKER_FLAGS_INIT -r)
FIND_PROGRAM (SH sh REQUIRED)
SET (MUNCH ${WIND_BASE}/host/${WIND_HOST_TYPE}/bin/munch CACHE FILEPATH "munch")
SET (CMAKE_C_COMPILE_OBJECT
"${WIND_ENV} <CMAKE_C_COMPILER> <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>")
# "${WIND_ENV} <CMAKE_C_COMPILER> <DEFINES> <FLAGS> <INCLUDES> -o <OBJECT> -c <SOURCE>")
SET (CMAKE_CXX_COMPILE_OBJECT
"${WIND_ENV} <CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>")
# "${WIND_ENV} <CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> <INCLUDES> -o <OBJECT> -c <SOURCE>")
SET (CMAKE_C_LINK_EXECUTABLE
"${CMAKE_LINKER} <LINK_FLAGS> <CMAKE_C_LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
SET (CMAKE_CXX_LINK_EXECUTABLE
"${CMAKE_LINKER} <LINK_FLAGS> <CMAKE_CXX_LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
SET (CMAKE_C_FLAGS_DEBUG "-O -g1" CACHE STRING "")
SET (CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG} CACHE STRING "")
SET (CMAKE_C_FLAGS_RELWITHDEBINFO "-O -g1 -DNDEBUG" CACHE STRING "")
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_C_FLAGS_RELWITHDEBINFO} CACHE STRING "")
SET (CMAKE_C_FLAGS_RELEASE "-O -g1 -DNDEBUG" CACHE STRING "")
SET (CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE} CACHE STRING "")
INCLUDE_DIRECTORIES (
${VX_VW_BASE}/h
${VX_VW_BASE}/h/wrn/coreip)
SET (VXWORKS_C_FLAGS_LIST
-DCPU=${VX_CPU}
-DVX_CPU_CARD=${VX_CPU_CARD}
-DTOOL_FAMILY=${VX_TOOL_FAMILY}
-DTOOL=${VX_TOOL}
-D_WRS_KERNEL
-DCPU_VARIANT=${VX_CPU_VARIANT}
-DVXWORKS_MAJOR=${VXWORKS_MAJOR}
-DVXWORKS_MINOR=${VXWORKS_MINOR}
-mlongcall
-fstrength-reduce
-fno-builtin
-te500v2
-mcpu=8548
-mfloat-gprs=double
-mspe=yes
-mabi=spe
-mstrict-align
-fno-implicit-fp
-DVXWORKS_66
)
ADD_DEFINITIONS (${VXWORKS_C_FLAGS_LIST})
string(REPLACE ";" " " VXWORKS_C_FLAGS_LIST_STR "${VXWORKS_C_FLAGS_LIST}")
SET (RUN_MUNCH_SCRIPT ${CMAKE_SOURCE_DIR}/run_munch.sh)
SET (CMAKE_C_LINK_EXECUTABLE
"${CMAKE_LINKER} <LINK_FLAGS> <CMAKE_CXX_LINK_FLAGS> -warn-common -S <OBJECTS> -o <TARGET>_partialImage.o <LINK_LIBRARIES>"
# "${CMAKE_LINKER} <LINK_FLAGS> <CMAKE_CXX_LINK_FLAGS> -warn-common -S <OBJECTS> -o <TARGET>_partialImage.o <LINK_LIBRARIES> /home/openrtm/OIS/ORBexpress/RT_2.8.4_PATCH_KC1/target/ppc_8xx-vxworks_6.6/gcc_4.1.2_ExLcRi/config_rt_full/OENames_2.1.6/lib/libOEnames.a /home/openrtm/OIS/ORBexpress/RT_2.8.4_PATCH_KC1/target/ppc_8xx-vxworks_6.6/gcc_4.1.2_ExLcRi/config_rt_full/lib/libOEtcp.a /home/openrtm/OIS/ORBexpress/RT_2.8.4_PATCH_KC1/target/ppc_8xx-vxworks_6.6/gcc_4.1.2_ExLcRi/config_rt_full/lib/libOEmirror.a /home/openrtm/OIS/ORBexpress/RT_2.8.4_PATCH_KC1/target/ppc_8xx-vxworks_6.6/gcc_4.1.2_ExLcRi/config_rt_full/lib/libOEbridge.a /home/openrtm/OIS/ORBexpress/RT_2.8.4_PATCH_KC1/target/ppc_8xx-vxworks_6.6/gcc_4.1.2_ExLcRi/config_rt_full/lib/libOEudp.a /home/openrtm/OIS/ORBexpress/RT_2.8.4_PATCH_KC1/target/ppc_8xx-vxworks_6.6/gcc_4.1.2_ExLcRi/config_rt_full/lib/libOEipmc.a /home/openrtm/OIS/ORBexpress/RT_2.8.4_PATCH_KC1/target/ppc_8xx-vxworks_6.6/gcc_4.1.2_ExLcRi/config_rt_full/lib/libOEshrmem.a /home/openrtm/OIS/ORBexpress/RT_2.8.4_PATCH_KC1/target/ppc_8xx-vxworks_6.6/gcc_4.1.2_ExLcRi/config_rt_full/lib/libOEorb.a"
"sh ${RUN_MUNCH_SCRIPT} ${CMAKE_NM} <TARGET>_partialImage.o ${MUNCH} ctdt.c"
#sh -c WIND_BASE=${WIND_BASE}\; export WIND_BASE\; WIND_HOST_TYPE=${WIND_HOST_TYPE}\; export WIND_HOST_TYPE\; ${CMAKE_NM} <TARGET>_partialImage.o | ${MUNCH} > ctdt.c"
"${CMAKE_C_COMPILER} ${VXWORKS_C_FLAGS_LIST_STR} -o ctdt.o -c ctdt.c"
"${CMAKE_LINKER} <LINK_FLAGS> <CMAKE_CXX_LINK_FLAGS> -S -warn-common -o <TARGET> <TARGET>_partialImage.o ctdt.o "
)
SET (CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE})
LIST (APPEND CMAKE_FIND_ROOT_PATH /usr/${CMAKE_SYSTEM_PROCESSOR}-${CMAKE_SYSTEM})
LIST (APPEND CMAKE_PREFIX_PATH /)
SET (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
MARK_AS_ADVANCED (CMAKE_LINKER CMAKE_AR CMAKE_NM CMAKE_STRIP
CMAKE_OBJCOPY CMAKE_OBJDUMP CMAKE_RANLIB CMAKE_C_FLAGS_DEBUG
CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELEASE SH MUNCH)