• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1############################################################################
2# Copyright 2017 Intel Corporation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15############################################################################
16# pylint: disable=locally-disabled, invalid-name, missing-docstring
17
18"""Intel posix compiler configuration for embedded
19"""
20from parts.config import ConfigValues, configuration
21
22def map_default_version(env):
23    return env['INTELC_VERSION']
24
25config = configuration(map_default_version)
26
27config.VersionRange(
28    "7-*",
29    append=ConfigValues(
30        CCFLAGS=[
31            # second level optimization
32            '-Os',
33            # prevent using built in stdlib replacement functions
34            '-fno-builtin',
35            '-fno-stack-protector',
36            '-fomit-frame-pointer',
37            '-fno-asynchronous-unwind-tables',
38            # allow linker to optimize out not used stuff
39            '-fdata-sections',
40            '-ffunction-sections',
41            # only export specified functions
42            '-fvisibility=hidden',
43            # shared object friendly
44            '-fPIC',
45            # treat warnings as errors
46            '-Werror',
47            # enable all warnings
48            '-Wall',
49            # extra warnings
50            '-Wextra',
51        ],
52        CPPDEFINES=[
53            'NDEBUG',
54        ],
55        LINKFLAGS=[
56            # do not link standard system libraries
57            '-nodefaultlibs',
58            '-nostdlib',
59            # do not use stadard system startup
60            '-nostartfiles',
61            # remove all symbol table and relocation information
62            '-s',
63            # link only what is used
64            '-Xlinker',
65            '--gc-sections',
66        ],))
67