예제 #1
0
파일: __init__.py 프로젝트: BartSX/mbed
    def __init__(self,
                 target,
                 options=None,
                 notify=None,
                 macros=None,
                 silent=False,
                 extra_verbose=False):
        self.target = target
        self.name = self.__class__.__name__
        self.hook = hooks.Hook(target, self)
        self.silent = silent
        self.output = ""

        self.legacy_ignore_dirs = LEGACY_IGNORE_DIRS - set(
            [target.name, LEGACY_TOOLCHAIN_NAMES[self.name]])

        if notify:
            self.notify_fun = notify
        elif extra_verbose:
            self.notify_fun = self.print_notify_verbose
        else:
            self.notify_fun = self.print_notify

        self.options = options if options is not None else []

        self.macros = macros or []
        self.options.extend(BUILD_OPTIONS)
        if self.options:
            self.info("Build Options: %s" % (', '.join(self.options)))

        self.obj_path = join("TARGET_" + target.name, "TOOLCHAIN_" + self.name)

        self.symbols = None
        self.labels = None
        self.has_config = False

        self.build_all = False
        self.build_dir = None
        self.timestamp = time()
        self.jobs = 1

        self.CHROOT = None

        self.mp_pool = None

        if 'UVISOR' in self.target.features and 'UVISOR_SUPPORTED' in self.target.extra_labels:
            self.target.core = re.sub(r"F$", '', self.target.core)

        self.flags = deepcopy(self.DEFAULT_FLAGS)
예제 #2
0
파일: __init__.py 프로젝트: dotnfc/mbed-os
    def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False):
        self.target = target
        self.name = self.__class__.__name__

        # compile/assemble/link/binary hooks
        self.hook = hooks.Hook(target, self)

        # Toolchain flags
        self.flags = deepcopy(self.DEFAULT_FLAGS)

        # User-defined macros
        self.macros = macros or []

        # Macros generated from toolchain and target rules/features
        self.asm_symbols = None
        self.cxx_symbols = None

        # Labels generated from toolchain and target rules/features (used for selective build)
        self.labels = None

        # This will hold the initialized config object
        self.config = None

        # This will hold the configuration data (as returned by Config.get_config_data())
        self.config_data = None

        # This will hold the location of the configuration file or None if there's no configuration available
        self.config_file = None

        # Call guard for "get_config_data" (see the comments of get_config_data for details)
        self.config_processed = False

        # Non-incremental compile
        self.build_all = False

        # Build output dir
        self.build_dir = None
        self.timestamp = time()

        # Output build naming based on target+toolchain combo (mbed 2.0 builds)
        self.obj_path = join("TARGET_"+target.name, "TOOLCHAIN_"+self.name)

        # Number of concurrent build jobs. 0 means auto (based on host system cores)
        self.jobs = 0

        # Ignore patterns from .mbedignore files
        self.ignore_patterns = []

        # Pre-mbed 2.0 ignore dirs
        self.legacy_ignore_dirs = (LEGACY_IGNORE_DIRS | TOOLCHAINS) - set([target.name, LEGACY_TOOLCHAIN_NAMES[self.name]])

        # Output notify function
        # This function is passed all events, and expected to handle notification of the
        # user, emit the events to a log, etc.
        # The API for all notify methods passed into the notify parameter is as follows:
        # def notify(Event, Silent)
        # Where *Event* is a dict representing the toolchain event that was generated
        #            e.g.: a compile succeeded, or a warning was emitted by the compiler
        #                  or an application was linked
        #       *Silent* is a boolean
        if notify:
            self.notify_fun = notify
        elif extra_verbose:
            self.notify_fun = self.print_notify_verbose
        else:
            self.notify_fun = self.print_notify

        # Silent builds (no output)
        self.silent = silent

        # Print output buffer
        self.output = str()
        self.map_outputs = list()   # Place to store memmap scan results in JSON like data structures

        # Build options passed by -o flag
        self.options = options if options is not None else []

        # Build options passed by settings.py or mbed_settings.py
        self.options.extend(BUILD_OPTIONS)

        if self.options:
            self.info("Build Options: %s" % (', '.join(self.options)))

        # uVisor spepcific rules
        if 'UVISOR' in self.target.features and 'UVISOR_SUPPORTED' in self.target.extra_labels:
            self.target.core = re.sub(r"F$", '', self.target.core)

        # Stats cache is used to reduce the amount of IO requests to stat
        # header files during dependency change. See need_update()
        self.stat_cache = {}

        # Used by the mbed Online Build System to build in chrooted environment
        self.CHROOT = None

        # Call post __init__() hooks before the ARM/GCC_ARM/IAR toolchain __init__() takes over
        self.init()
예제 #3
0
파일: __init__.py 프로젝트: MaggieMei/mbed
    def __init__(self,
                 target,
                 options=None,
                 notify=None,
                 macros=None,
                 silent=False,
                 extra_verbose=False):
        self.target = target
        self.name = self.__class__.__name__

        # compile/assemble/link/binary hooks
        self.hook = hooks.Hook(target, self)

        # Toolchain flags
        self.flags = deepcopy(self.DEFAULT_FLAGS)

        # User-defined macros
        self.macros = macros or []

        # Macros generated from toolchain and target rules/features
        self.symbols = None

        # Labels generated from toolchain and target rules/features (used for selective build)
        self.labels = None

        # This will hold the configuration data (as returned by Config.get_config_data())
        self.config_data = None

        # Non-incremental compile
        self.build_all = False

        # Build output dir
        self.build_dir = None
        self.timestamp = time()

        # Output build naming based on target+toolchain combo (mbed 2.0 builds)
        self.obj_path = join("TARGET_" + target.name, "TOOLCHAIN_" + self.name)

        # Number of concurrent build jobs. 0 means auto (based on host system cores)
        self.jobs = 0

        self.CHROOT = None

        # Ignore patterns from .mbedignore files
        self.ignore_patterns = []

        # Pre-mbed 2.0 ignore dirs
        self.legacy_ignore_dirs = LEGACY_IGNORE_DIRS - set(
            [target.name, LEGACY_TOOLCHAIN_NAMES[self.name]])

        # Output notify function
        if notify:
            self.notify_fun = notify
        elif extra_verbose:
            self.notify_fun = self.print_notify_verbose
        else:
            self.notify_fun = self.print_notify

        # Silent builds (no output)
        self.silent = silent

        # Print output buffer
        self.output = ""

        # Build options passed by -o flag
        self.options = options if options is not None else []

        # Build options passed by settings.py or mbed_settings.py
        self.options.extend(BUILD_OPTIONS)

        if self.options:
            self.info("Build Options: %s" % (', '.join(self.options)))

        # uVisor spepcific rules
        if 'UVISOR' in self.target.features and 'UVISOR_SUPPORTED' in self.target.extra_labels:
            self.target.core = re.sub(r"F$", '', self.target.core)