File: SConscript.target.mbedrtos-frdm

package info (click to toggle)
alljoyn-thin-client-1509 15.09a-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 4,240 kB
  • sloc: ansic: 55,937; cpp: 2,995; python: 361; sh: 174; makefile: 39
file content (199 lines) | stat: -rw-r--r-- 11,310 bytes parent folder | download | duplicates (4)
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
import os

Import('env')

# Target specific SCons command line variables
vars = Variables()
vars.Add(PathVariable('MBED_DIR',          'Path to the mbed source code repository',                os.environ.get('AJ_MBED_DIR'), PathVariable))
vars.Add(PathVariable('ARM_TOOLCHAIN_DIR', 'Path to the GNU ARM toolchain bin folder',               os.environ.get('AJ_ARM_TOOLCHAIN_DIR'), PathVariable.PathIsDir))
vars.Update(env)
Help(vars.GenerateHelpText(env))

# Disable building unit tests
env['build_unit_tests'] = False

# Update environment
if env.has_key('ARM_TOOLCHAIN_DIR'):
    env['ENV']['PATH'] = ';'.join([ env['ENV']['PATH'], env['ARM_TOOLCHAIN_DIR'] ])

# Cross compile setup
cross_prefix = 'arm-none-eabi-'
env.Replace(CC = cross_prefix + 'gcc')
env.Replace(CXX = cross_prefix + 'g++')
env.Replace(LINK = cross_prefix + 'gcc')
env.Replace(AR = cross_prefix + 'ar')
env.Replace(RANLIB = cross_prefix + 'ranlib')

env.Replace(CCCOM           = '$CC $CFLAGS $CCFLAGS $_CCCOMCOM -o $TARGET $SOURCES')
env.Replace(CXXCOM          = '$CXX $CFLAGS $CCFLAGS $CXXFLAGS $_CCCOMCOM -o $TARGET $SOURCES')
env.Replace(CPPDEFPREFIX    = '-D')
env.Replace(OBJSUFFIX       = '.o')
env.Replace(INCPREFIX       = '-I')
env.Replace(LIBPREFIX       = 'lib')
env.Replace(LIBSUFFIX       = '.a')
env.Replace(PROGPREFIX      = '')
env.Replace(PROGSUFFIX      = '.elf')
env.Replace(LIBDIRPREFIX    = '-L')
env.Replace(LIBDIRSUFFIX    = '')
env.Replace(LIBLINKPREFIX   = '-l')
env.Replace(LIBLINKSUFFIX   = '')
env.Replace(LINKCOM         = '$LINK $PRELINKFLAGS $LINKSCRIPT $LIBPATHS -o $TARGET $__RPATH $SOURCES $system_objects $_LIBDIRFLAGS $_LIBFLAGS $LINKFLAGS')
env.Replace(CCFLAGS         = '')
env.Replace(CXXFLAGS        = '')
env.Replace(CPPFLAGS        = '')
env.Replace(ASFLAGS         = '')
env.Replace(ASPPCOM         = '$AS')
env.Replace(ARFLAGS         = 'rc')
env.Replace(ARCOM           = '$AR $ARFLAGS $TARGET $SOURCES')
env.Replace(ASCOM           = '$CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES')

# This was done because scons creates a link file to feed into the linker
# and arm-none-eabi removes '\' when interpreting a linker file. This
# prevents scons from creating a link file and just feeding the command line
# options directly to the compiler/linker
env['MAXLINELENGTH'] = 10000

# Compiler flags
env.Append(CXXFLAGS = ['-std=gnu++98',
                       '-fno-rtti'])

env.Append(CCFLAGS = ['-mcpu=cortex-m4',
                      '-mthumb',
                      '-mfpu=fpv4-sp-d16',
                      '-c',
                      '-g',
                      '-fno-common',
                      '-fmessage-length=0',
                      '-Wall',
                      '-fno-exceptions',
                      '-ffunction-sections',
                      '-Wformat-security',
                      '-Werror=format-security',
                      '-fdata-sections'])

env.Append(PRELINKFLAGS = ['-mcpu=cortex-m4',
                           '-mthumb',
                           '-Wl,--gc-sections',
                           '--specs=nano.specs',
                           '-u', '_printf_float',
                           '-u', '_scanf_float'])

env.Append(LINKSCRIPT = ['-T' + env['MBED_DIR'] + '/mbed/TARGET_K64F/TOOLCHAIN_GCC_ARM/K64FN1M0xxx12.ld'])

env.Append(LIBPATHS = ['-L' + env['MBED_DIR'] + '/mbed/TARGET_K64F/TOOLCHAIN_GCC_ARM'])

env.Replace(LINKFLAGS = ['-Wl,-Map,${TARGET.base}.map'])

env.Prepend(_LIBFLAGS = ['-Wl,-start-group'])
env.Append(_LIBFLAGS = ['-Wl,-end-group'])

env.Append(LIBS = ['mbed',
                   'stdc++',
                   'gcc',
                   'm',
                   'c'])

# Pre-processor directives
env.Append(CPPDEFINES = {'TARGET_K64F'      : None,
                         'TARGET_M4'        : None,
                         'TARGET_Freescale' : None,
                         'TARGET_KPSDK_MCUS': None,
                         'TARGET_KPSDK_CODE': None,
                         'TARGET_MCU_K64F'  : None,
                         'TARGET_FRDM'      : None,
                         'TOOLCHAIN_GCC_ARM': None,
                         'TOOLCHAIN_GCC'    : None,
                         '__CORTEX_M4'      : None,
                         'ARM_MATH_CM4'     : None,
                         '__FPU_PRESENT'    : '1',
                         'MBED_BUILD_TIMESTAMP': '0.0',
                         '__MBED__'         : '1',
                         'CPU_MK64FN1M0VMD12': None,
                         'FSL_RTOS_MBED'    : None,
                         'TARGET_FF_ARDUINO': None,
                         '__CORTEX_M4'      : None,
                         'FSL_RTOS_MBED'    : None,
                         '_FORTIFY_SOURCE'  : '1'
                     })

# Linker flags
env.Append(LINKFLAGS = [
    '-mcpu=cortex-m3',
    '-mthumb',
    '-Wl,--gc-sections',
    '-Wl,-Map,${TARGET.base}.map',
    '-Wl,--entry=Reset_Handler',
])

env.Append(CPPPATH = [env['MBED_DIR'] + '/mbed-rtos',
                      env['MBED_DIR'] + '/mbed-rtos/rtx',
                      env['MBED_DIR'] + '/mbed-rtos/rtx/TARGET_M4',
                      env['MBED_DIR'] + '/mbed-rtos/rtx/TARGET_M4/TOOLCHAIN_GCC',
                      env['MBED_DIR'] + '/mbed-rtos/rtos',
                      env['MBED_DIR'] + '/SDFileSystem',
                      env['MBED_DIR'] + '/FATFileSystem',
                      env['MBED_DIR'] + '/FATFileSystem/ChaN',
                      env['MBED_DIR'] + '/mbed',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F_Freescale',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/can',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/edma',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/sdhc',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/pit',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/flextimer',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/smc',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/uart',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/pmc',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/mcg',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/port',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/wdog',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/adc',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/osc',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/enet',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/i2c',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/gpio',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/rtc',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/dmamux',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/sim',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/sai',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/dspi',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/utilities',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/drivers',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/drivers/pit',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/drivers/clock',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/drivers/clock/src',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/drivers/enet',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/drivers/interrupt',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/common',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/common/phyksz8081',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/device',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/device/MK64F12',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/TARGET_FRDM',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TOOLCHAIN_GCC_ARM'])

# Pre-compiled object files for the K64F
env['system_objects'] = [env['MBED_DIR'] + '/mbed/TARGET_K64F/TOOLCHAIN_GCC_ARM/startup_MK64F12.o',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TOOLCHAIN_GCC_ARM/cmsis_nvic.o',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TOOLCHAIN_GCC_ARM/system_MK64F12.o',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TOOLCHAIN_GCC_ARM/mbed_overrides.o',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TOOLCHAIN_GCC_ARM/board.o',
                      env['MBED_DIR'] + '/mbed/TARGET_K64F/TOOLCHAIN_GCC_ARM/retarget.o']

env.Install('#dist/include/ajtcl', Glob('src/target/mbedrtos-frdm/*.h'))
env.Install('#dist/include/ajtcl', Glob('src/mbedrtos/*.h'))
env.Install('#dist/include/ajtcl', Glob('src/wsl/*.h'))
env.Install('#dist/include/ajtcl', Glob('src/bsp/*.h'))

# Debug/Release Variants
if env['VARIANT'] == 'debug':
    env.Append(CFLAGS = '-g3')
else:
    env.Append(CFLAGS = '-Os')
    env.Append(LINKFLAGS = '-s')

env['build_shared'] = False
#env['connectivity_options'] = [ 'tcp', 'ardp' ]