Ejemplo n.º 1
0
    def newPlatform(cls, name, requirements=None):
        pm = PlatformManager()
        platform_dir = None
        if isdir(name):
            platform_dir = name
            name = pm.load_manifest(platform_dir)['name']
        elif name.endswith("platform.json") and isfile(name):
            platform_dir = dirname(name)
            name = util.load_json(name)['name']
        else:
            name, requirements, url = pm.parse_pkg_uri(name, requirements)
            platform_dir = pm.get_package_dir(name, requirements, url)
            if platform_dir:
                name = pm.load_manifest(platform_dir)['name']

        if not platform_dir:
            raise exception.UnknownPlatform(name if not requirements else
                                            "%s@%s" % (name, requirements))

        platform_cls = None
        if isfile(join(platform_dir, "platform.py")):
            platform_cls = getattr(
                cls.load_module(name, join(platform_dir, "platform.py")),
                cls.get_clsname(name))
        else:
            platform_cls = type(
                str(cls.get_clsname(name)), (PlatformBase, ), {})

        _instance = platform_cls(join(platform_dir, "platform.json"))
        assert isinstance(_instance, PlatformBase)
        return _instance
Ejemplo n.º 2
0
    def newPlatform(cls, name, requirements=None):
        platform_dir = None
        if name.endswith("platform.json") and isfile(name):
            platform_dir = dirname(name)
            name = util.load_json(name)['name']
        else:
            if not requirements and "@" in name:
                name, requirements = name.rsplit("@", 1)
            platform_dir = PlatformManager().get_package_dir(name,
                                                             requirements)

        if not platform_dir:
            raise exception.UnknownPlatform(name if not requirements else
                                            "%s@%s" % (name, requirements))

        platform_cls = None
        if isfile(join(platform_dir, "platform.py")):
            platform_cls = getattr(
                cls.load_module(name, join(platform_dir, "platform.py")),
                cls.get_clsname(name))
        else:
            platform_cls = type(
                str(cls.get_clsname(name)), (PlatformBase, ), {})

        _instance = platform_cls(join(platform_dir, "platform.json"))
        assert isinstance(_instance, PlatformBase)
        return _instance
Ejemplo n.º 3
0
    def newPlatform(cls, name, requirements=None):
        pm = PlatformManager()
        platform_dir = None
        if isdir(name):
            platform_dir = name
            name = pm.load_manifest(platform_dir)['name']
        elif name.endswith("platform.json") and isfile(name):
            platform_dir = dirname(name)
            name = util.load_json(name)['name']
        else:
            name, requirements, url = pm.parse_pkg_uri(name, requirements)
            platform_dir = pm.get_package_dir(name, requirements, url)
            if platform_dir:
                name = pm.load_manifest(platform_dir)['name']

        if not platform_dir:
            raise exception.UnknownPlatform(
                name if not requirements else "%s@%s" % (name, requirements))

        platform_cls = None
        if isfile(join(platform_dir, "platform.py")):
            platform_cls = getattr(
                cls.load_module(name, join(platform_dir, "platform.py")),
                cls.get_clsname(name))
        else:
            platform_cls = type(
                str(cls.get_clsname(name)), (PlatformBase, ), {})

        _instance = platform_cls(join(platform_dir, "platform.json"))
        assert isinstance(_instance, PlatformBase)
        return _instance
Ejemplo n.º 4
0
 def __enter__(self):
     try:
         self._lock_state_file()
         if isfile(self.path):
             self._state = util.load_json(self.path)
     except exception.PlatformioException:
         self._state = {}
     self._prev_state = deepcopy(self._state)
     return self._state
Ejemplo n.º 5
0
 def __enter__(self):
     try:
         self._lock_state_file()
         if isfile(self.path):
             self._state = util.load_json(self.path)
     except ValueError:
         self._state = {}
     self._prev_state = deepcopy(self._state)
     return self._state
Ejemplo n.º 6
0
 def __enter__(self):
     try:
         self._lock_state_file()
         if isfile(self.path):
             self._state = util.load_json(self.path)
     except exception.PlatformioException:
         self._state = {}
     self._prev_state = deepcopy(self._state)
     return self._state
Ejemplo n.º 7
0
 def __enter__(self):
     try:
         self._lock_state_file()
         if isfile(self.path):
             self._state = util.load_json(self.path)
     except ValueError:
         self._state = {}
     self._prev_state = deepcopy(self._state)
     return self._state
Ejemplo n.º 8
0
    def __init__(self, manifest_path):
        self._BOARDS_CACHE = {}
        self.manifest_path = manifest_path
        self._manifest = util.load_json(manifest_path)

        self.pm = PackageManager(join(util.get_home_dir(), "packages"), self._manifest.get("packageRepositories"))

        self.silent = False
        self.verbose = False
Ejemplo n.º 9
0
    def __init__(self, manifest_path):
        self._BOARDS_CACHE = {}
        self.manifest_path = manifest_path
        self._manifest = util.load_json(manifest_path)

        self.pm = PackageManager(join(util.get_home_dir(), "packages"),
                                 self._manifest.get("packageRepositories"))

        self.silent = False
        self.verbose = False
Ejemplo n.º 10
0
    def load_manifest(self, pkg_dir):
        cache_key = "load_manifest-%s" % pkg_dir
        result = self.cache_get(cache_key)
        if result:
            return result

        manifest = {}
        src_manifest = None
        manifest_path = self.get_manifest_path(pkg_dir)
        src_manifest_path = self.get_src_manifest_path(pkg_dir)
        if src_manifest_path:
            src_manifest = util.load_json(src_manifest_path)

        if not manifest_path and not src_manifest_path:
            return None

        if manifest_path and manifest_path.endswith(".json"):
            manifest = util.load_json(manifest_path)
        elif manifest_path and manifest_path.endswith(".properties"):
            with codecs.open(manifest_path, encoding="utf-8") as fp:
                for line in fp.readlines():
                    if "=" not in line:
                        continue
                    key, value = line.split("=", 1)
                    manifest[key.strip()] = value.strip()

        if src_manifest:
            if "version" in src_manifest:
                manifest['version'] = src_manifest['version']
            manifest['__src_url'] = src_manifest['url']
            # handle a custom package name
            autogen_name = self.parse_pkg_uri(manifest['__src_url'])[0]
            if "name" not in manifest or autogen_name != src_manifest['name']:
                manifest['name'] = src_manifest['name']

        if "name" not in manifest:
            manifest['name'] = basename(pkg_dir)
        if "version" not in manifest:
            manifest['version'] = "0.0.0"

        manifest['__pkg_dir'] = util.path_to_unicode(pkg_dir)
        self.cache_set(cache_key, manifest)
        return manifest
Ejemplo n.º 11
0
    def load_manifest(self, pkg_dir):
        cache_key = "load_manifest-%s" % pkg_dir
        result = self.cache_get(cache_key)
        if result:
            return result

        manifest = {}
        src_manifest = None
        manifest_path = self.get_manifest_path(pkg_dir)
        src_manifest_path = self.get_src_manifest_path(pkg_dir)
        if src_manifest_path:
            src_manifest = util.load_json(src_manifest_path)

        if not manifest_path and not src_manifest_path:
            return None

        if manifest_path and manifest_path.endswith(".json"):
            manifest = util.load_json(manifest_path)
        elif manifest_path and manifest_path.endswith(".properties"):
            with codecs.open(manifest_path, encoding="utf-8") as fp:
                for line in fp.readlines():
                    if "=" not in line:
                        continue
                    key, value = line.split("=", 1)
                    manifest[key.strip()] = value.strip()

        if src_manifest:
            if "version" in src_manifest:
                manifest['version'] = src_manifest['version']
            manifest['__src_url'] = src_manifest['url']
            # handle a custom package name
            autogen_name = self.parse_pkg_uri(manifest['__src_url'])[0]
            if "name" not in manifest or autogen_name != src_manifest['name']:
                manifest['name'] = src_manifest['name']

        if "name" not in manifest:
            manifest['name'] = basename(pkg_dir)
        if "version" not in manifest:
            manifest['version'] = "0.0.0"

        manifest['__pkg_dir'] = util.path_to_unicode(pkg_dir)
        self.cache_set(cache_key, manifest)
        return manifest
Ejemplo n.º 12
0
def get_mbed_config(target):
    config_file = join(FRAMEWORK_DIR, "platformio", "variants", target,
                       target + ".json")
    if not isfile(config_file):
        sys.stderr.write("Cannot find the configuration file for your board! "
                         "Please read instructions here %s\n" % join(
                             FRAMEWORK_DIR, "platformio", "README.txt"))
        env.Exit(1)

    return util.load_json(config_file)
Ejemplo n.º 13
0
 def _update_src_manifest(self, data, src_dir):
     if not isdir(src_dir):
         os.makedirs(src_dir)
     src_manifest_path = join(src_dir, self.SRC_MANIFEST_NAME)
     _data = {}
     if isfile(src_manifest_path):
         _data = util.load_json(src_manifest_path)
     _data.update(data)
     with open(src_manifest_path, "w") as fp:
         json.dump(_data, fp)
Ejemplo n.º 14
0
 def get_installed(self):
     items = {}
     if not isdir(self.lib_dir):
         return items
     for dirname in sorted(listdir(self.lib_dir)):
         conf_path = join(self.lib_dir, dirname, self.CONFIG_NAME)
         if not isfile(conf_path):
             continue
         items[dirname] = util.load_json(conf_path)
     return items
Ejemplo n.º 15
0
def get_mbed_target(board_type):
    variants_remap = util.load_json(
        os.path.join(FRAMEWORK_DIR, "platformio", "variants_remap.json")
    )
    variant = (
        variants_remap[board_type]
        if board_type in variants_remap
        else board_type.upper()
    )
    return board.get("build.mbed_variant", variant)
Ejemplo n.º 16
0
 def __enter__(self):
     try:
         self._lock_state_file()
         if isfile(self.path):
             self._storage = util.load_json(self.path)
         assert isinstance(self._storage, dict)
     except (AssertionError, ValueError, UnicodeDecodeError,
             exception.InvalidJSONFile):
         self._storage = {}
     return self
Ejemplo n.º 17
0
def get_mbed_config(target):
    config_file = join(FRAMEWORK_DIR, "platformio", "variants", target,
                       target + ".json")
    if not isfile(config_file):
        sys.stderr.write("Cannot find the configuration file for your board! "
                         "Please read instructions here %s\n" %
                         join(FRAMEWORK_DIR, "platformio", "README.txt"))
        env.Exit(1)

    return util.load_json(config_file)
Ejemplo n.º 18
0
 def _update_src_manifest(self, data, src_dir):
     if not isdir(src_dir):
         os.makedirs(src_dir)
     src_manifest_path = join(src_dir, self.SRC_MANIFEST_NAME)
     _data = {}
     if isfile(src_manifest_path):
         _data = util.load_json(src_manifest_path)
     _data.update(data)
     with open(src_manifest_path, "w") as fp:
         json.dump(_data, fp)
Ejemplo n.º 19
0
 def __init__(self, manifest_path):
     self._id = basename(manifest_path)[:-5]
     assert isfile(manifest_path)
     self.manifest_path = manifest_path
     try:
         self._manifest = util.load_json(manifest_path)
     except ValueError:
         raise exception.InvalidBoardManifest(manifest_path)
     if not set(["name", "url", "vendor"]) <= set(self._manifest.keys()):
         raise exception.PlatformioException("Please specify name, url and vendor fields for " + manifest_path)
Ejemplo n.º 20
0
    def load_manifest(self, pkg_dir):
        cache_key = "load_manifest-%s" % pkg_dir
        result = self.cache_get(cache_key)
        if result:
            return result

        manifest_path = self.get_manifest_path(pkg_dir)
        if not manifest_path:
            return None

        # if non-registry packages: VCS or archive
        src_manifest_path = self.get_src_manifest_path(pkg_dir)
        src_manifest = None
        if src_manifest_path:
            src_manifest = util.load_json(src_manifest_path)

        manifest = {}
        if manifest_path.endswith(".json"):
            manifest = util.load_json(manifest_path)
        elif manifest_path.endswith(".properties"):
            with codecs.open(manifest_path, encoding="utf-8") as fp:
                for line in fp.readlines():
                    if "=" not in line:
                        continue
                    key, value = line.split("=", 1)
                    manifest[key.strip()] = value.strip()

        if src_manifest:
            if "name" not in manifest:
                manifest['name'] = src_manifest['name']
            if "version" in src_manifest:
                manifest['version'] = src_manifest['version']
            manifest['__src_url'] = src_manifest['url']

        if "name" not in manifest:
            manifest['name'] = basename(pkg_dir)
        if "version" not in manifest:
            manifest['version'] = "0.0.0"

        manifest['__pkg_dir'] = pkg_dir
        self.cache_set(cache_key, manifest)
        return manifest
Ejemplo n.º 21
0
    def __init__(self, manifest_path):
        self.manifest_path = manifest_path
        self.silent = False
        self.verbose = False

        self._BOARDS_CACHE = {}
        self._manifest = util.load_json(manifest_path)
        self._custom_packages = None

        self.pm = PackageManager(get_project_packages_dir(),
                                 self.package_repositories)
Ejemplo n.º 22
0
def parseSdkConfigsJson(basepath, filepath, pre_config):
    ret = {}
    data = util.load_json(filepath)
    prelist = data['preBuildConfigs']
    for element in prelist:
        key = element['id']
        valueList = element['includePaths']
        for index in range(len(valueList)):
            valueList[index] = join(basepath, valueList[index])
        ret[key] = valueList
    return ret[pre_config]
Ejemplo n.º 23
0
 def __init__(self, manifest_path):
     self._id = basename(manifest_path)[:-5]
     assert isfile(manifest_path)
     self.manifest_path = manifest_path
     try:
         self._manifest = util.load_json(manifest_path)
     except ValueError:
         raise exception.InvalidBoardManifest(manifest_path)
     if not set(["name", "url", "vendor"]) <= set(self._manifest.keys()):
         raise exception.PlatformioException(
             "Please specify name, url and vendor fields for " +
             manifest_path)
Ejemplo n.º 24
0
 def _get_plaform_data():
     data = ["PLATFORM: %s %s" % (platform.title, platform.version)]
     src_manifest_path = platform.pm.get_src_manifest_path(
         platform.get_dir())
     if src_manifest_path:
         src_manifest = util.load_json(src_manifest_path)
         if "version" in src_manifest:
             data.append("#" + src_manifest['version'])
         if int(ARGUMENTS.get("PIOVERBOSE", 0)):
             data.append("(%s)" % src_manifest['url'])
     if board_config:
         data.extend([">", board_config.get("name")])
     return data
Ejemplo n.º 25
0
    def load_manifest(self):
        assert isfile(join(self.path, "library.json"))
        manifest = util.load_json(join(self.path, "library.json"))
        assert "name" in manifest

        # replace "espressif" old name dev/platform with ESP8266
        if "platforms" in manifest:
            manifest['platforms'] = [
                "espressif8266" if p == "espressif" else p
                for p in util.items_to_list(manifest['platforms'])
            ]

        return manifest
Ejemplo n.º 26
0
    def load_manifest(self):
        assert isfile(join(self.path, "library.json"))
        manifest = util.load_json(join(self.path, "library.json"))
        assert "name" in manifest

        # replace "espressif" old name dev/platform with ESP8266
        if "platforms" in manifest:
            manifest['platforms'] = [
                "espressif8266" if p == "espressif" else p
                for p in util.items_to_list(manifest['platforms'])
            ]

        return manifest
Ejemplo n.º 27
0
 def load_manifest(self, path):
     assert path
     pkg_dir = path
     if isdir(path):
         path = self.get_manifest_path(path)
     else:
         pkg_dir = dirname(pkg_dir)
     if path:
         if isfile(path) and path.endswith(self.VCS_MANIFEST_NAME):
             pkg_dir = dirname(dirname(path))
         manifest = util.load_json(path)
         manifest["__pkg_dir"] = pkg_dir
         return manifest
     return None
Ejemplo n.º 28
0
 def load_manifest(self, path):
     assert path
     pkg_dir = path
     if isdir(path):
         path = self.get_manifest_path(path)
     else:
         pkg_dir = dirname(pkg_dir)
     if path:
         if isfile(path) and path.endswith(self.VCS_MANIFEST_NAME):
             pkg_dir = dirname(dirname(path))
         manifest = util.load_json(path)
         manifest['__pkg_dir'] = pkg_dir
         return manifest
     return None
Ejemplo n.º 29
0
    def __init__(self, manifest_path):
        self._BOARDS_CACHE = {}
        self.manifest_path = manifest_path
        self._manifest = util.load_json(manifest_path)

        self.pm = PackageManager(
            join(util.get_home_dir(), "packages"), self.package_repositories)

        self.silent = False
        self.verbose = False

        if self.engines and "platformio" in self.engines:
            if self.PIO_VERSION not in semantic_version.Spec(
                    self.engines['platformio']):
                raise exception.IncompatiblePlatform(self.name,
                                                     str(self.PIO_VERSION))
Ejemplo n.º 30
0
    def __init__(self, manifest_path):
        self._BOARDS_CACHE = {}
        self.manifest_path = manifest_path
        self._manifest = util.load_json(manifest_path)

        self.pm = PackageManager(join(util.get_home_dir(), "packages"),
                                 self._manifest.get("packageRepositories"))

        self.silent = False
        self.verbose = False

        if self.engines and "platformio" in self.engines:
            if self.PIO_VERSION not in semantic_version.Spec(
                    self.engines['platformio']):
                raise exception.IncompatiblePlatform(self.name,
                                                     str(self.PIO_VERSION))
Ejemplo n.º 31
0
    def _mbed_lib_conf_parse_macros(self, mbed_lib_path):
        macros = {}
        cppdefines = str(self.env.Flatten(self.env.subst("$CPPDEFINES")))
        manifest = util.load_json(mbed_lib_path)

        # default macros
        for macro in manifest.get("macros", []):
            macro = self._mbed_normalize_macro(macro)
            macros[macro['name']] = macro

        # configuration items
        for key, options in manifest.get("config", {}).items():
            if "value" not in options:
                continue
            macros[key] = dict(name=options.get("macro_name"),
                               value=options.get("value"))

        # overrode items per target
        for target, options in manifest.get("target_overrides", {}).items():
            if target != "*" and "TARGET_" + target not in cppdefines:
                continue
            for macro in options.get("target.macros_add", []):
                macro = self._mbed_normalize_macro(macro)
                macros[macro['name']] = macro
            for key, value in options.items():
                if not key.startswith("target.") and key in macros:
                    macros[key]['value'] = value

        # normalize macro names
        for key, macro in macros.items():
            if not macro['name']:
                macro['name'] = key
                if "." not in macro['name']:
                    macro['name'] = "%s.%s" % (manifest.get("name"),
                                               macro['name'])
                macro['name'] = re.sub(r"[^a-z\d]+",
                                       "_",
                                       macro['name'],
                                       flags=re.I).upper()
                macro['name'] = "MBED_CONF_" + macro['name']
            if isinstance(macro['value'], bool):
                macro['value'] = 1 if macro['value'] else 0

        return {macro["name"]: macro["value"] for macro in macros.values()}
Ejemplo n.º 32
0
 def _parse_manifest(path):
     manifest = {}
     if path.endswith(".json"):
         return util.load_json(path)
     elif path.endswith("library.properties"):
         with open(path) as fp:
             for line in fp.readlines():
                 if "=" not in line:
                     continue
                 key, value = line.split("=", 1)
                 manifest[key.strip()] = value.strip()
         manifest['frameworks'] = ["arduino"]
         if "author" in manifest:
             manifest['authors'] = [{"name": manifest['author']}]
             del manifest['author']
         if "sentence" in manifest:
             manifest['description'] = manifest['sentence']
             del manifest['sentence']
     return manifest
Ejemplo n.º 33
0
 def _parse_manifest(path):
     manifest = {}
     if path.endswith(".json"):
         return util.load_json(path)
     elif path.endswith("library.properties"):
         with open(path) as fp:
             for line in fp.readlines():
                 if "=" not in line:
                     continue
                 key, value = line.split("=", 1)
                 manifest[key.strip()] = value.strip()
         manifest['frameworks'] = ["arduino"]
         if "author" in manifest:
             manifest['authors'] = [{"name": manifest['author']}]
             del manifest['author']
         if "sentence" in manifest:
             manifest['description'] = manifest['sentence']
             del manifest['sentence']
     return manifest
Ejemplo n.º 34
0
    def _mbed_lib_conf_parse_macros(self, mbed_lib_path):
        macros = {}
        cppdefines = str(self.env.Flatten(self.env.subst("$CPPDEFINES")))
        manifest = util.load_json(mbed_lib_path)

        # default macros
        for macro in manifest.get("macros", []):
            macro = self._mbed_normalize_macro(macro)
            macros[macro['name']] = macro

        # configuration items
        for key, options in manifest.get("config", {}).items():
            if "value" not in options:
                continue
            macros[key] = dict(
                name=options.get("macro_name"), value=options.get("value"))

        # overrode items per target
        for target, options in manifest.get("target_overrides", {}).items():
            if target != "*" and "TARGET_" + target not in cppdefines:
                continue
            for macro in options.get("target.macros_add", []):
                macro = self._mbed_normalize_macro(macro)
                macros[macro['name']] = macro
            for key, value in options.items():
                if not key.startswith("target.") and key in macros:
                    macros[key]['value'] = value

        # normalize macro names
        for key, macro in macros.items():
            if not macro['name']:
                macro['name'] = key
                if "." not in macro['name']:
                    macro['name'] = "%s.%s" % (manifest.get("name"),
                                               macro['name'])
                macro['name'] = re.sub(
                    r"[^a-z\d]+", "_", macro['name'], flags=re.I).upper()
                macro['name'] = "MBED_CONF_" + macro['name']
            if isinstance(macro['value'], bool):
                macro['value'] = 1 if macro['value'] else 0

        return {macro["name"]: macro["value"] for macro in macros.values()}
Ejemplo n.º 35
0
    def newPlatform(cls, name, requirements=None):
        platform_dir = None
        if name.endswith("platform.json") and isfile(name):
            platform_dir = dirname(name)
            name = util.load_json(name)["name"]
        else:
            if not requirements and "@" in name:
                name, requirements = name.rsplit("@", 1)
            platform_dir = PlatformManager().get_package_dir(name, requirements)

        if not platform_dir:
            raise exception.UnknownPlatform(name if not requirements else "%s@%s" % (name, requirements))

        platform_cls = None
        if isfile(join(platform_dir, "platform.py")):
            platform_cls = getattr(cls.load_module(name, join(platform_dir, "platform.py")), cls.get_clsname(name))
        else:
            platform_cls = type(str(cls.get_clsname(name)), (PlatformBase,), {})

        _instance = platform_cls(join(platform_dir, "platform.json"))
        assert isinstance(_instance, PlatformBase)
        return _instance
Ejemplo n.º 36
0
    def _upgrade_to_3_0_0(ctx):
        # convert custom board configuration
        boards_dir = join(util.get_home_dir(), "boards")
        if isdir(boards_dir):
            for item in os.listdir(boards_dir):
                if not item.endswith(".json"):
                    continue
                data = util.load_json(join(boards_dir, item))
                if set(["name", "url", "vendor"]) <= set(data.keys()):
                    continue
                os.remove(join(boards_dir, item))
                for key, value in data.items():
                    with open(join(boards_dir, "%s.json" % key), "w") as f:
                        json.dump(value, f, sort_keys=True, indent=2)

        # re-install PlatformIO 2.0 development platforms
        installed_platforms = app.get_state_item("installed_platforms", [])
        if installed_platforms:
            if "espressif" in installed_platforms:
                installed_platforms[installed_platforms.index(
                    "espressif")] = "espressif8266"
            ctx.invoke(cmd_platform_install, platforms=installed_platforms)

        return True
Ejemplo n.º 37
0
    def _upgrade_to_3_0_0(ctx):
        # convert custom board configuration
        boards_dir = join(util.get_home_dir(), "boards")
        if isdir(boards_dir):
            for item in os.listdir(boards_dir):
                if not item.endswith(".json"):
                    continue
                data = util.load_json(join(boards_dir, item))
                if set(["name", "url", "vendor"]) <= set(data.keys()):
                    continue
                os.remove(join(boards_dir, item))
                for key, value in data.items():
                    with open(join(boards_dir, "%s.json" % key), "w") as f:
                        json.dump(value, f, sort_keys=True, indent=2)

        # re-install PlatformIO 2.0 development platforms
        installed_platforms = app.get_state_item("installed_platforms", [])
        if installed_platforms:
            if "espressif" in installed_platforms:
                installed_platforms[installed_platforms.index(
                    "espressif")] = "espressif8266"
            ctx.invoke(cmd_platform_install, platforms=installed_platforms)

        return True
Ejemplo n.º 38
0
env.Append(CPPPATH=[
    join(FRAMEWORK_DIR, FRAMEWORK_CORE, "Drivers", "CMSIS", "Include"),
    join(FRAMEWORK_DIR, FRAMEWORK_CORE, "Drivers", "CMSIS", "Device", "ST",
         MCU_FAMILY.upper() + "xx", "Include"),
    join(FRAMEWORK_DIR, FRAMEWORK_CORE, "Drivers",
         MCU_FAMILY.upper() + "xx_HAL_Driver", "Inc"),
    join(FRAMEWORK_DIR, FRAMEWORK_CORE, "Drivers", "BSP", "Components",
         "Common")
],
           LIBPATH=[
               join(FRAMEWORK_DIR, FRAMEWORK_CORE, "Drivers", "CMSIS", "Lib",
                    "GCC"),
               join(FRAMEWORK_DIR, "platformio", "ldscripts")
           ])

variants_remap = util.load_json(
    join(FRAMEWORK_DIR, "platformio", "variants_remap.json"))
board_type = env.subst("$BOARD")
variant = variants_remap[
    board_type] if board_type in variants_remap else board_type.upper()

#
# Generate framework specific files
#

generate_hal_config_file(env.BoardConfig().get("build.mcu"))

#
# Process BSP components
#

components_dir = join(FRAMEWORK_DIR, FRAMEWORK_CORE, "Drivers", "BSP",
Ejemplo n.º 39
0
 def vcs_info(self):
     items = glob(join(self.path, ".*", PackageManager.SRC_MANIFEST_NAME))
     if not items:
         return None
     return util.load_json(items[0])
Ejemplo n.º 40
0
 def load_manifest(self):
     if not isfile(join(self.path, "module.json")):
         return {}
     return util.load_json(join(self.path, "module.json"))
Ejemplo n.º 41
0
 def load_manifest(self):
     if not isfile(join(self.path, "module.json")):
         return {}
     return util.load_json(join(self.path, "module.json"))
Ejemplo n.º 42
0
 def vcs_info(self):
     items = glob(join(self.path, ".*", PackageManager.SRC_MANIFEST_NAME))
     if not items:
         return None
     return util.load_json(items[0])
Ejemplo n.º 43
0
 def _get_vcs_info(lb):
     path = LibraryManager.get_src_manifest_path(lb.path)
     return util.load_json(path) if path else None
Ejemplo n.º 44
0
 def load_manifest(self):
     assert isfile(join(self.path, "library.json"))
     manifest = util.load_json(join(self.path, "library.json"))
     assert "name" in manifest
     return manifest
Ejemplo n.º 45
0
             "ST", MCU_FAMILY.upper() + "xx", "Include"),

        join(FRAMEWORK_DIR, FRAMEWORK_CORE, "Drivers",
             MCU_FAMILY.upper() + "xx_HAL_Driver", "Inc"),
        join(FRAMEWORK_DIR, FRAMEWORK_CORE, "Drivers",
             "BSP", "Components", "Common")
    ],

    LIBPATH=[
        join(FRAMEWORK_DIR, FRAMEWORK_CORE,
             "Drivers", "CMSIS", "Lib", "GCC"),
        join(FRAMEWORK_DIR, "platformio", "ldscripts")
    ]
)

variants_remap = util.load_json(
    join(FRAMEWORK_DIR, "platformio", "variants_remap.json"))
board_type = env.subst("$BOARD")
variant = variants_remap[
    board_type] if board_type in variants_remap else board_type.upper()

#
# Generate framework specific files
#

generate_hal_config_file(env.BoardConfig().get("build.mcu"))

#
# Process BSP components
#

components_dir = join(