File: SConscript.target.freertos-due

package info (click to toggle)
alljoyn-thin-client-1509 15.09a-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 4,240 kB
  • sloc: ansic: 55,937; cpp: 2,995; python: 361; sh: 174; makefile: 39
file content (174 lines) | stat: -rw-r--r-- 6,635 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
import os

Import('env')

# Target specific SCons command line variables
vars = Variables()
vars.Add(BoolVariable('AJWSL',             'Compile driver for the QCA4004 for a specific platform', os.environ.get('AJ_AJWSL', True)))
vars.Add(PathVariable('ATMEL_DIR',         'Directory for ATMEL source code',                        os.environ.get('AJ_ATMEL_DIR'),         PathVariable.PathIsDir))
vars.Add(PathVariable('FREE_RTOS_DIR',     'Directory to FreeRTOS source code',                      os.environ.get('AJ_FREE_RTOS_DIR'),     PathVariable.PathIsDir))
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 -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $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 $_LIBDIRFLAGS $_LIBFLAGS $LINKFLAGS')
env.Replace(LINKFLAGS       = '')
env.Replace(CCFLAGS         = '')
env.Replace(ARFLAGS         = 'rc')
env.Replace(ARCOM           = '$AR $ARFLAGS $TARGET $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

# Platform libraries
env.Append(LIBS = ['c'])

# Compiler flags
env.Append(CFLAGS = [
    '-std=gnu99',
    '-pipe',
    '-mcpu=cortex-m3',
    '-mthumb',
    '-mlong-calls',
    '-fdata-sections',
    '-ffunction-sections',
    '-fno-strict-aliasing',
    '-Wall',
    '-Waggregate-return',
    '-Wbad-function-cast',
    '-Wcast-align',
    '-Wfloat-equal',
    '-Wformat=2',
    '-Wno-deprecated-declarations',
    '-Wno-unknown-pragmas',
    '-Wpacked',
    '-Wpointer-arith',
    '-Wshadow',
    '-Wundef',
    '-Wformat-security',
    '-Werror=format-security',
    '-Wwrite-strings'
])

# Pre-processor directives
env.Append(CPPDEFINES = {
    '__SAM3X8E__':     None,
    'ARM_MATH_CM3':    'true',
    'BOARD':           'ARDUINO_DUE_X',
    'printf':          'iprintf',
    '_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.Replace(LINKSCRIPT = '-T$ATMEL_DIR/sam/utils/linker_scripts/sam3x/sam3x8/gcc/flash.ld')

# Path to libajtcl.a and standard C libraries
env.Append(LIBPATH = ['$ATMEL_DIR/thirdparty/CMSIS/Lib/GCC'])

# Add in extra non standard include files
env.Install('#dist/include/ajtcl', Glob('src/wsl/*.h'))
env.Install('#dist/include/ajtcl', Glob('src/target/freertos-due/*.h'))
env.Install('#dist/include/ajtcl', Glob('src/freertos/*.h'))
env.Install('#dist/include/ajtcl', Glob('src/bsp/*.h'))

# The Atmel software pack requires that you provide "conf_uart_serial.h" as a
# configurable header file.  Install that file to '#dist/include' where it will
# be found via the normal -I flags test SCons files use.
env.Install('#dist/include', Glob('src/target/freertos-due/atmel/conf_uart_serial.h'))

# ATMEL include paths
env.Append(CPPPATH = Dir([
    'src/bsp',
    env['FREE_RTOS_DIR'] + '/Source/include',
    env['FREE_RTOS_DIR'] + '/Source/portable/GCC/ARM_CM3',
    env['ATMEL_DIR'] + '/common/boards',
    env['ATMEL_DIR'] + '/common/services/clock',
    env['ATMEL_DIR'] + '/common/services/clock/sam3x',
    env['ATMEL_DIR'] + '/common/services/gpio',
    env['ATMEL_DIR'] + '/common/services/ioport',
    env['ATMEL_DIR'] + '/common/services/freertos/sam',
    env['ATMEL_DIR'] + '/common/services/serial/sam_uart',
    env['ATMEL_DIR'] + '/common/services/serial',
    env['ATMEL_DIR'] + '/common/services/spi',
    env['ATMEL_DIR'] + '/common/services/sam_spi',
    env['ATMEL_DIR'] + '/common/services/spi/sam_spi/module_config',
    env['ATMEL_DIR'] + '/common/utils',
    env['ATMEL_DIR'] + '/common/utils/stdio/stdio_serial',
    env['ATMEL_DIR'] + '/common/drivers/nvm',
    env['ATMEL_DIR'] + '/common/nvm/sam/module_config',
    env['ATMEL_DIR'] + '/sam/boards',
    env['ATMEL_DIR'] + '/sam/boards/arduino_due_x',
    env['ATMEL_DIR'] + '/sam/drivers/pio',
    env['ATMEL_DIR'] + '/sam/drivers/pmc',
    env['ATMEL_DIR'] + '/sam/drivers/tc',
    env['ATMEL_DIR'] + '/sam/drivers/trng',
    env['ATMEL_DIR'] + '/sam/drivers/pdc',
    env['ATMEL_DIR'] + '/sam/drivers/uart',
    env['ATMEL_DIR'] + '/sam/drivers/usart',
    env['ATMEL_DIR'] + '/sam/drivers/spi',
    env['ATMEL_DIR'] + '/sam/drivers/efc',
    env['ATMEL_DIR'] + '/sam/drivers/dmac',
    env['ATMEL_DIR'] + '/sam/drivers/rstc',
    env['ATMEL_DIR'] + '/sam/utils',
    env['ATMEL_DIR'] + '/sam/utils/cmsis/sam3x/include',
    env['ATMEL_DIR'] + '/sam/utils/cmsis/sam3x/source/templates',
    env['ATMEL_DIR'] + '/sam/utils/cmsis/sam3x/include/component',
    env['ATMEL_DIR'] + '/sam/utils/header_files',
    env['ATMEL_DIR'] + '/sam/utils/preprocessor',
    env['ATMEL_DIR'] + '/sam/services/flash_efc',
    env['ATMEL_DIR'] + '/thirdparty/CMSIS/Include',
    env['ATMEL_DIR'] + '/thirdparty/CMSIS/Lib/GCC',
    env['ATMEL_DIR'] + '/sam/boards/arduino_due_x/board_config',
    env['ATMEL_DIR'] + '/config',
    env['ATMEL_DIR'] + '/common/services/clock/sam3x/module_config',
    env['ATMEL_DIR'] + '/common/services/clock/sam3x',
    env['ATMEL_DIR'] + '/thirdparty/freertos/freertos-7.3.0/module_config'
]))

# 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' ]