• 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"""win32 gcc compiler configuration for embedded
19"""
20from parts.config import ConfigValues, configuration
21
22def map_default_version(env):
23    return env['GCC_VERSION']
24
25config = configuration(map_default_version)
26
27config.VersionRange(
28    "3-*",
29    append=ConfigValues(
30        CCFLAGS=[
31            # optimize for size
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            # treat warnings as errors
42            '-Werror',
43            # enable all warnings
44            '-Wall',
45            # extra warnings
46            '-Wextra',
47            # Allow struct initilization with {0}
48            '-Wno-missing-braces',
49            # dump stack usage to file
50            '-fstack-usage',
51            # dump control flow graph
52            '-fdump-tree-cfg-raw',
53        ],
54        CPPDEFINES=[
55            'NDEBUG',
56        ],
57        SHLINKFLAGS=[
58            # do not use stadard system entrypoint
59            '-e 0',
60        ],
61        LINKFLAGS=[
62            # do not link standard system libraries
63            '-nodefaultlibs',
64            '-nostdlib',
65            # do not use stadard system startup
66            '-nostartfiles',
67            # remove all symbol table and relocation information
68            '-s',
69            # link only what is used
70            '-Xlinker',
71            '--gc-sections',
72        ],))
73