mirror of https://github.com/ARMmbed/mbed-os.git
[Exporters] Build method documentation. Removal of unused Exception classes.
parent
d8fc362c11
commit
cc154a48cd
|
@ -18,7 +18,6 @@
|
|||
from tools.export import codered, ds5_5, iar, makefile
|
||||
from tools.export import emblocks, coide, kds, simplicityv3, atmelstudio
|
||||
from tools.export import sw4stm32, e2studio, zip, cmsis, uvision, cdt
|
||||
from tools.export.exporters import OldLibrariesException, FailedBuildException
|
||||
from tools.targets import TARGET_NAMES
|
||||
|
||||
EXPORTERS = {
|
||||
|
|
|
@ -30,7 +30,8 @@ class DeviceCMSIS():
|
|||
"""CMSIS Device class
|
||||
|
||||
Encapsulates target information retrieved by arm-pack-manager"""
|
||||
cache = Cache(True, False)
|
||||
|
||||
CACHE = Cache(True, False)
|
||||
def __init__(self, target):
|
||||
target_info = self.check_supported(target)
|
||||
if not target_info:
|
||||
|
@ -52,7 +53,7 @@ class DeviceCMSIS():
|
|||
t = TARGET_MAP[target]
|
||||
try:
|
||||
cpu_name = t.device_name
|
||||
target_info = DeviceCMSIS.cache.index[cpu_name]
|
||||
target_info = DeviceCMSIS.CACHE.index[cpu_name]
|
||||
# Target does not have device name or pdsc file
|
||||
except:
|
||||
try:
|
||||
|
|
|
@ -11,16 +11,6 @@ import copy
|
|||
from tools.targets import TARGET_MAP
|
||||
|
||||
|
||||
class OldLibrariesException(Exception):
|
||||
"""Exception that indicates an export can not complete due to an out of date
|
||||
library version.
|
||||
"""
|
||||
pass
|
||||
|
||||
class FailedBuildException(Exception):
|
||||
"""Exception that indicates that a build failed"""
|
||||
pass
|
||||
|
||||
class TargetNotSupportedException(Exception):
|
||||
"""Indicates that an IDE does not support a particular MCU"""
|
||||
pass
|
||||
|
@ -146,9 +136,31 @@ class Exporter(object):
|
|||
def group_project_files(self, sources):
|
||||
"""Group the source files by their encompassing directory
|
||||
Positional Arguments:
|
||||
sources - array of sourc locations
|
||||
sources - array of source locations
|
||||
|
||||
Returns a dictionary of {group name: list of source locations}
|
||||
"""
|
||||
data = sorted(sources, key=self.make_key)
|
||||
return {k: list(g) for k,g in groupby(data, self.make_key)}
|
||||
|
||||
@staticmethod
|
||||
def build(project_name, log_name='build_log.txt', cleanup=True):
|
||||
"""Invoke exporters build command within a subprocess.
|
||||
This method is assumed to be executed at the same level as exporter
|
||||
project files and project source code.
|
||||
See uvision/__init__.py, iar/__init__.py, and makefile/__init__.py for
|
||||
example implemenation.
|
||||
|
||||
Positional Arguments:
|
||||
project_name - the name of the project to build; often required by
|
||||
exporter's build command.
|
||||
|
||||
Keyword Args:
|
||||
log_name - name of the build log to create. Written and printed out,
|
||||
deleted if cleanup = True
|
||||
cleanup - a boolean dictating whether exported project files and
|
||||
build log are removed after build
|
||||
|
||||
Returns -1 on failure and 0 on success
|
||||
"""
|
||||
raise NotImplemented("Implement in derived Exporter class.")
|
||||
|
|
|
@ -7,7 +7,7 @@ import re
|
|||
import sys
|
||||
|
||||
from tools.targets import TARGET_MAP
|
||||
from tools.export.exporters import Exporter, FailedBuildException
|
||||
from tools.export.exporters import Exporter
|
||||
import json
|
||||
from tools.export.cmsis import DeviceCMSIS
|
||||
from multiprocessing import cpu_count
|
||||
|
|
|
@ -108,7 +108,7 @@ class Makefile(Exporter):
|
|||
@staticmethod
|
||||
def build(project_name, log_name="build_log.txt", cleanup=True):
|
||||
""" Build Make project """
|
||||
# > Make -C [project directory] -j
|
||||
# > Make -j
|
||||
cmd = ["make", "-j"]
|
||||
p = Popen(cmd, stdout=PIPE, stderr=PIPE)
|
||||
ret = p.communicate()
|
||||
|
|
|
@ -9,7 +9,7 @@ import re
|
|||
|
||||
from tools.arm_pack_manager import Cache
|
||||
from tools.targets import TARGET_MAP
|
||||
from tools.export.exporters import Exporter, FailedBuildException
|
||||
from tools.export.exporters import Exporter
|
||||
from tools.export.cmsis import DeviceCMSIS
|
||||
|
||||
cache_d = False
|
||||
|
@ -207,6 +207,8 @@ class Uvision(Exporter):
|
|||
|
||||
@staticmethod
|
||||
def build(project_name, log_name='build_log.txt', cleanup=True):
|
||||
""" Build Uvision project """
|
||||
# > UV4.exe -r -j0 -o [log_name] [project_name].uvprojx
|
||||
success = 0
|
||||
warn = 1
|
||||
cmd = ["UV4.exe", '-r', '-j0', '-o', log_name, project_name+".uvprojx"]
|
||||
|
|
Loading…
Reference in New Issue