Merge remote-tracking branch 'refs/remotes/mbedmicro/master' into DEV_DISCOF429ZI

pull/1414/head
adustm 2015-11-16 15:02:41 +01:00
commit 92fb85f8bd
19 changed files with 750 additions and 430 deletions

View File

@ -39,17 +39,17 @@ typedef enum {
p5 = 5, p5 = 5,
p6 = 6, p6 = 6,
p7 = 7, p7 = 7,
p8 = NC, p8 = 8,
p9 = NC, p9 = 9,
p10 = NC, p10 = 10,
p11 = NC, p11 = 11,
p12 = NC, p12 = 12,
p13 = 13, p13 = 13,
p14 = NC, p14 = 14,
p15 = NC, p15 = 15,
p16 = 16, p16 = 16,
p17 = 17, p17 = 17,
p18 = NC, p18 = 18,
p19 = 19, p19 = 19,
p20 = 20, p20 = 20,
p21 = 21, p21 = 21,
@ -59,13 +59,15 @@ typedef enum {
p25 = 25, p25 = 25,
p26 = 26, p26 = 26,
p27 = 27, p27 = 27,
p28 = NC, p28 = 28,
p29 = 29, p29 = 29,
p30 = 30, p30 = 30,
p31 = 31, p31 = 31,
LED1 = p7, LED1 = p4,
LED2 = p13, LED2 = p5,
LED3 = p6,
LED4 = p13,
BUTTON0 = p16, BUTTON0 = p16,
BUTTON1 = p17, BUTTON1 = p17,
@ -79,23 +81,22 @@ typedef enum {
SPI_PSELMOSI0 = p24, SPI_PSELMOSI0 = p24,
SPI_PSELMISO0 = p29, SPI_PSELMISO0 = p29,
SPI_PSELSS0 = p6, SPI_PSELSS0 = p30,
SPI_PSELSCK0 = p21, SPI_PSELSCK0 = p21,
SPIS_PSELMOSI = p24, SPIS_PSELMOSI = p24,
SPIS_PSELMISO = p29, SPIS_PSELMISO = p29,
SPIS_PSELSS = p6, SPIS_PSELSS = p30,
SPIS_PSELSCK = p21, SPIS_PSELSCK = p21,
I2C_SDA0 = p22, I2C_SDA0 = p22,
I2C_SCL0 = p20, I2C_SCL0 = p20,
A0 = p1, A0 = p26,
A1 = p2, A1 = p27,
A2 = p3, A2 = p4,
A3 = p4, A3 = p5,
A4 = p5, A4 = p6,
A5 = p6,
SWIO = p19, SWIO = p19,
VERF0 = p0, VERF0 = p0,
@ -112,8 +113,7 @@ typedef enum {
SPI_PSELMISO1 = NC, SPI_PSELMISO1 = NC,
SPI_PSELSS1 = NC, SPI_PSELSS1 = NC,
SPI_PSELSCK1 = NC, SPI_PSELSCK1 = NC,
LED3 = NC, A5 = NC
LED4 = NC
} PinName; } PinName;
typedef enum { typedef enum {

View File

@ -16,7 +16,8 @@
#include "cmsis.h" #include "cmsis.h"
/* No init flash in this version, 2015/10/27 */
#if 0
#define SPIM1_SCK_PIN 11u /**< SPI clock GPIO pin number. */ #define SPIM1_SCK_PIN 11u /**< SPI clock GPIO pin number. */
#define SPIM1_MOSI_PIN 15u /**< SPI Master Out Slave In GPIO pin number. */ #define SPIM1_MOSI_PIN 15u /**< SPI Master Out Slave In GPIO pin number. */
#define SPIM1_MISO_PIN 9u /**< SPI Master In Slave Out GPIO pin number. */ #define SPIM1_MISO_PIN 9u /**< SPI Master In Slave Out GPIO pin number. */
@ -95,6 +96,8 @@ void flash_powerDown(void)
//wait for sleep //wait for sleep
//wait_us(3); //wait_us(3);
} }
/* No init flash in this version, 2015/10/27 */
#endif
void mbed_sdk_init() void mbed_sdk_init()
{ {
@ -115,9 +118,11 @@ void mbed_sdk_init()
{// Do nothing. {// Do nothing.
} }
flash_init(); /* No init flash in this version, 2015/10/27 */
// flash_init();
//nrf_delay_ms(10); //
flash_powerDown(); // //nrf_delay_ms(10);
// flash_powerDown();
/* No init flash in this version, 2015/10/27 */
} }

View File

@ -116,6 +116,19 @@ void timer_init(uint8_t pwmChoice)
timer->TASKS_START = 0x01; timer->TASKS_START = 0x01;
} }
static void timer_free()
{
NRF_TIMER_Type *timer = Timers[0];
for(uint8_t i = 1; i < NO_PWMS; i++){
if(PWM_taken[i]){
break;
}
if((i == NO_PWMS - 1) && (!PWM_taken[i]))
timer->TASKS_STOP = 0x01;
}
}
/** @brief Function for initializing the GPIO Tasks/Events peripheral. /** @brief Function for initializing the GPIO Tasks/Events peripheral.
*/ */
void gpiote_init(PinName pin, uint8_t channel_number) void gpiote_init(PinName pin, uint8_t channel_number)
@ -154,6 +167,14 @@ void gpiote_init(PinName pin, uint8_t channel_number)
__NOP(); __NOP();
} }
static void gpiote_free(PinName pin,uint8_t channel_number)
{
NRF_GPIOTE->TASKS_OUT[channel_number] = 0;
NRF_GPIOTE->CONFIG[channel_number] = 0;
NRF_GPIO->PIN_CNF[pin] = (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos);
}
/** @brief Function for initializing the Programmable Peripheral Interconnect peripheral. /** @brief Function for initializing the Programmable Peripheral Interconnect peripheral.
*/ */
static void ppi_init(uint8_t pwm) static void ppi_init(uint8_t pwm)
@ -173,6 +194,16 @@ static void ppi_init(uint8_t pwm)
(1 << (channel_number + 1)); (1 << (channel_number + 1));
} }
static void ppi_free(uint8_t pwm)
{
//using ppi channels 0-7 (only 0-7 are available)
uint8_t channel_number = 2*pwm;
// Disable PPI channels.
NRF_PPI->CHEN &= (~(1 << channel_number))
& (~(1 << (channel_number+1)));
}
void setModulation(pwmout_t *obj, uint8_t toggle, uint8_t high) void setModulation(pwmout_t *obj, uint8_t toggle, uint8_t high)
{ {
if (high) { if (high) {
@ -239,11 +270,13 @@ void pwmout_init(pwmout_t *obj, PinName pin)
pwmout_write (obj, 0); pwmout_write (obj, 0);
} }
void pwmout_free(pwmout_t *obj) void pwmout_free(pwmout_t* obj) {
{
MBED_ASSERT(obj->pwm != (PWMName)NC); MBED_ASSERT(obj->pwm != (PWMName)NC);
PWM_taken[obj->pwm] = 0;
pwmout_write(obj, 0); pwmout_write(obj, 0);
PWM_taken[obj->pwm] = 0;
timer_free();
ppi_free(obj->pwm);
gpiote_free(obj->pin,obj->pwm);
} }
void pwmout_write(pwmout_t *obj, float value) void pwmout_write(pwmout_t *obj, float value)

View File

@ -28,7 +28,6 @@ sys.path.insert(0, ROOT)
from workspace_tools.toolchains import TOOLCHAINS from workspace_tools.toolchains import TOOLCHAINS
from workspace_tools.toolchains import print_notify_verbose
from workspace_tools.targets import TARGET_NAMES, TARGET_MAP from workspace_tools.targets import TARGET_NAMES, TARGET_MAP
from workspace_tools.options import get_default_options_parser from workspace_tools.options import get_default_options_parser
from workspace_tools.build_api import build_mbed_libs, build_lib from workspace_tools.build_api import build_mbed_libs, build_lib
@ -184,8 +183,6 @@ if __name__ == '__main__':
if options.cpputest_lib: if options.cpputest_lib:
libraries.extend(["cpputest"]) libraries.extend(["cpputest"])
notify = print_notify_verbose if options.extra_verbose_notify else None # Special notify for CI (more verbose)
# Build results # Build results
failures = [] failures = []
successes = [] successes = []
@ -203,7 +200,7 @@ if __name__ == '__main__':
# Static check for library # Static check for library
static_analysis_scan_lib(lib_id, mcu, toolchain, CPPCHECK_CMD, CPPCHECK_MSG_FORMAT, static_analysis_scan_lib(lib_id, mcu, toolchain, CPPCHECK_CMD, CPPCHECK_MSG_FORMAT,
options=options.options, options=options.options,
notify=notify, verbose=options.verbose, jobs=options.jobs, clean=options.clean, extra_verbose=options.extra_verbose_notify, verbose=options.verbose, jobs=options.jobs, clean=options.clean,
macros=options.macros) macros=options.macros)
pass pass
except Exception, e: except Exception, e:
@ -221,17 +218,16 @@ if __name__ == '__main__':
mcu = TARGET_MAP[target] mcu = TARGET_MAP[target]
lib_build_res = build_mbed_libs(mcu, toolchain, lib_build_res = build_mbed_libs(mcu, toolchain,
options=options.options, options=options.options,
notify=notify, extra_verbose=options.extra_verbose_notify,
verbose=options.verbose, verbose=options.verbose,
silent=options.silent, silent=options.silent,
jobs=options.jobs, jobs=options.jobs,
clean=options.clean, clean=options.clean,
macros=options.macros) macros=options.macros)
for lib_id in libraries: for lib_id in libraries:
notify = print_notify_verbose if options.extra_verbose_notify else None # Special notify for CI (more verbose)
build_lib(lib_id, mcu, toolchain, build_lib(lib_id, mcu, toolchain,
options=options.options, options=options.options,
notify=notify, extra_verbose=options.extra_verbose_notify,
verbose=options.verbose, verbose=options.verbose,
silent=options.silent, silent=options.silent,
clean=options.clean, clean=options.clean,

View File

@ -23,6 +23,7 @@ import colorama
from types import ListType from types import ListType
from shutil import rmtree from shutil import rmtree
from os.path import join, exists, basename from os.path import join, exists, basename
from time import time
from workspace_tools.utils import mkdir, run_cmd, run_cmd_ext from workspace_tools.utils import mkdir, run_cmd, run_cmd_ext
from workspace_tools.paths import MBED_TARGETS_PATH, MBED_LIBRARIES, MBED_API, MBED_HAL, MBED_COMMON from workspace_tools.paths import MBED_TARGETS_PATH, MBED_LIBRARIES, MBED_API, MBED_HAL, MBED_COMMON
@ -33,13 +34,54 @@ from jinja2 import FileSystemLoader
from jinja2.environment import Environment from jinja2.environment import Environment
def prep_report(report, target_name, toolchain_name, id_name):
# Setup report keys
if not target_name in report:
report[target_name] = {}
if not toolchain_name in report[target_name]:
report[target_name][toolchain_name] = {}
if not id_name in report[target_name][toolchain_name]:
report[target_name][toolchain_name][id_name] = []
def prep_properties(properties, target_name, toolchain_name, id_name):
# Setup test properties
if not target_name in properties:
properties[target_name] = {}
if not toolchain_name in properties[target_name]:
properties[target_name][toolchain_name] = {}
properties[target_name][toolchain_name]["target"] = target_name
properties[target_name][toolchain_name]["toolchain"] = toolchain_name
def create_result(target_name, toolchain_name, id_name, description):
cur_result = {}
cur_result["target_name"] = target_name
cur_result["toolchain_name"] = toolchain_name
cur_result["id"] = id_name
cur_result["description"] = description
cur_result["elapsed_time"] = 0
cur_result["output"] = ""
return cur_result
def add_result_to_report(report, result):
target = result["target_name"]
toolchain = result["toolchain_name"]
id_name = result['id']
result_wrap = { 0: result }
report[target][toolchain][id_name].append(result_wrap)
def build_project(src_path, build_path, target, toolchain_name, def build_project(src_path, build_path, target, toolchain_name,
libraries_paths=None, options=None, linker_script=None, libraries_paths=None, options=None, linker_script=None,
clean=False, notify=None, verbose=False, name=None, macros=None, inc_dirs=None, jobs=1, silent=False): clean=False, notify=None, verbose=False, name=None, macros=None, inc_dirs=None,
jobs=1, silent=False, report=None, properties=None, project_id=None, project_description=None, extra_verbose=False):
""" This function builds project. Project can be for example one test / UT """ This function builds project. Project can be for example one test / UT
""" """
# Toolchain instance # Toolchain instance
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, notify, macros, silent) toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, notify, macros, silent, extra_verbose=extra_verbose)
toolchain.VERBOSE = verbose toolchain.VERBOSE = verbose
toolchain.jobs = jobs toolchain.jobs = jobs
toolchain.build_all = clean toolchain.build_all = clean
@ -48,7 +90,6 @@ def build_project(src_path, build_path, target, toolchain_name,
# We need to remove all paths which are repeated to avoid # We need to remove all paths which are repeated to avoid
# multiple compilations and linking with the same objects # multiple compilations and linking with the same objects
src_paths = [src_paths[0]] + list(set(src_paths[1:])) src_paths = [src_paths[0]] + list(set(src_paths[1:]))
PROJECT_BASENAME = basename(src_paths[0]) PROJECT_BASENAME = basename(src_paths[0])
if name is None: if name is None:
@ -59,44 +100,85 @@ def build_project(src_path, build_path, target, toolchain_name,
# User used custom global project name to have the same name for the # User used custom global project name to have the same name for the
toolchain.info("Building project %s to %s (%s, %s)" % (PROJECT_BASENAME.upper(), name, target.name, toolchain_name)) toolchain.info("Building project %s to %s (%s, %s)" % (PROJECT_BASENAME.upper(), name, target.name, toolchain_name))
# Scan src_path and libraries_paths for resources
resources = toolchain.scan_resources(src_paths[0]) if report != None:
for path in src_paths[1:]: start = time()
resources.add(toolchain.scan_resources(path)) id_name = project_id.upper()
if libraries_paths is not None: description = project_description
src_paths.extend(libraries_paths) cur_result = None
for path in libraries_paths: prep_report(report, target.name, toolchain_name, id_name)
cur_result = create_result(target.name, toolchain_name, id_name, description)
if properties != None:
prep_properties(properties, target.name, toolchain_name, id_name)
try:
# Scan src_path and libraries_paths for resources
resources = toolchain.scan_resources(src_paths[0])
for path in src_paths[1:]:
resources.add(toolchain.scan_resources(path)) resources.add(toolchain.scan_resources(path))
if libraries_paths is not None:
src_paths.extend(libraries_paths)
for path in libraries_paths:
resources.add(toolchain.scan_resources(path))
if linker_script is not None: if linker_script is not None:
resources.linker_script = linker_script resources.linker_script = linker_script
# Build Directory # Build Directory
if clean: if clean:
if exists(build_path): if exists(build_path):
rmtree(build_path) rmtree(build_path)
mkdir(build_path) mkdir(build_path)
# We need to add if necessary additional include directories # We need to add if necessary additional include directories
if inc_dirs: if inc_dirs:
if type(inc_dirs) == ListType: if type(inc_dirs) == ListType:
resources.inc_dirs.extend(inc_dirs) resources.inc_dirs.extend(inc_dirs)
else: else:
resources.inc_dirs.append(inc_dirs) resources.inc_dirs.append(inc_dirs)
# Compile Sources # Compile Sources
for path in src_paths: for path in src_paths:
src = toolchain.scan_resources(path) src = toolchain.scan_resources(path)
objects = toolchain.compile_sources(src, build_path, resources.inc_dirs) objects = toolchain.compile_sources(src, build_path, resources.inc_dirs)
resources.objects.extend(objects) resources.objects.extend(objects)
# Link Program # Link Program
return toolchain.link_program(resources, build_path, name) res, needed_update = toolchain.link_program(resources, build_path, name)
if report != None and needed_update:
end = time()
cur_result["elapsed_time"] = end - start
cur_result["output"] = toolchain.get_output()
cur_result["result"] = "OK"
add_result_to_report(report, cur_result)
return res
except Exception, e:
if report != None:
end = time()
cur_result["result"] = "FAIL"
cur_result["elapsed_time"] = end - start
toolchain_output = toolchain.get_output()
if toolchain_output:
cur_result["output"] += toolchain_output
cur_result["output"] += str(e)
add_result_to_report(report, cur_result)
# Let Exception propagate
raise e
def build_library(src_paths, build_path, target, toolchain_name, def build_library(src_paths, build_path, target, toolchain_name,
dependencies_paths=None, options=None, name=None, clean=False, dependencies_paths=None, options=None, name=None, clean=False,
notify=None, verbose=False, macros=None, inc_dirs=None, inc_dirs_ext=None, jobs=1, silent=False): notify=None, verbose=False, macros=None, inc_dirs=None, inc_dirs_ext=None,
jobs=1, silent=False, report=None, properties=None, extra_verbose=False):
""" src_path: the path of the source directory """ src_path: the path of the source directory
build_path: the path of the build directory build_path: the path of the build directory
target: ['LPC1768', 'LPC11U24', 'LPC2368'] target: ['LPC1768', 'LPC11U24', 'LPC2368']
@ -111,62 +193,106 @@ def build_library(src_paths, build_path, target, toolchain_name,
if type(src_paths) != ListType: if type(src_paths) != ListType:
src_paths = [src_paths] src_paths = [src_paths]
for src_path in src_paths:
if not exists(src_path):
raise Exception("The library source folder does not exist: %s", src_path)
# Toolchain instance
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, macros=macros, notify=notify, silent=silent)
toolchain.VERBOSE = verbose
toolchain.jobs = jobs
toolchain.build_all = clean
# The first path will give the name to the library # The first path will give the name to the library
name = basename(src_paths[0]) name = basename(src_paths[0])
toolchain.info("Building library %s (%s, %s)" % (name.upper(), target.name, toolchain_name))
# Scan Resources if report != None:
resources = [] start = time()
id_name = name.upper()
description = name
cur_result = None
prep_report(report, target.name, toolchain_name, id_name)
cur_result = create_result(target.name, toolchain_name, id_name, description)
if properties != None:
prep_properties(properties, target.name, toolchain_name, id_name)
for src_path in src_paths: for src_path in src_paths:
resources.append(toolchain.scan_resources(src_path)) if not exists(src_path):
error_msg = "The library source folder does not exist: %s", src_path
# Add extra include directories / files which are required by library if report != None:
# This files usually are not in the same directory as source files so cur_result["output"] = error_msg
# previous scan will not include them cur_result["result"] = "FAIL"
if inc_dirs_ext is not None: add_result_to_report(report, cur_result)
for inc_ext in inc_dirs_ext:
resources.append(toolchain.scan_resources(inc_ext))
# Dependencies Include Paths raise Exception(error_msg)
dependencies_include_dir = []
if dependencies_paths is not None:
for path in dependencies_paths:
lib_resources = toolchain.scan_resources(path)
dependencies_include_dir.extend(lib_resources.inc_dirs)
if inc_dirs: try:
dependencies_include_dir.extend(inc_dirs) # Toolchain instance
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, macros=macros, notify=notify, silent=silent, extra_verbose=extra_verbose)
toolchain.VERBOSE = verbose
toolchain.jobs = jobs
toolchain.build_all = clean
# Create the desired build directory structure toolchain.info("Building library %s (%s, %s)" % (name.upper(), target.name, toolchain_name))
bin_path = join(build_path, toolchain.obj_path)
mkdir(bin_path)
tmp_path = join(build_path, '.temp', toolchain.obj_path)
mkdir(tmp_path)
# Copy Headers # Scan Resources
for resource in resources: resources = []
toolchain.copy_files(resource.headers, build_path, rel_path=resource.base_path) for src_path in src_paths:
dependencies_include_dir.extend(toolchain.scan_resources(build_path).inc_dirs) resources.append(toolchain.scan_resources(src_path))
# Compile Sources # Add extra include directories / files which are required by library
objects = [] # This files usually are not in the same directory as source files so
for resource in resources: # previous scan will not include them
objects.extend(toolchain.compile_sources(resource, tmp_path, dependencies_include_dir)) if inc_dirs_ext is not None:
for inc_ext in inc_dirs_ext:
resources.append(toolchain.scan_resources(inc_ext))
toolchain.build_library(objects, bin_path, name) # Dependencies Include Paths
dependencies_include_dir = []
if dependencies_paths is not None:
for path in dependencies_paths:
lib_resources = toolchain.scan_resources(path)
dependencies_include_dir.extend(lib_resources.inc_dirs)
if inc_dirs:
dependencies_include_dir.extend(inc_dirs)
def build_lib(lib_id, target, toolchain, options=None, verbose=False, clean=False, macros=None, notify=None, jobs=1, silent=False): # Create the desired build directory structure
bin_path = join(build_path, toolchain.obj_path)
mkdir(bin_path)
tmp_path = join(build_path, '.temp', toolchain.obj_path)
mkdir(tmp_path)
# Copy Headers
for resource in resources:
toolchain.copy_files(resource.headers, build_path, rel_path=resource.base_path)
dependencies_include_dir.extend(toolchain.scan_resources(build_path).inc_dirs)
# Compile Sources
objects = []
for resource in resources:
objects.extend(toolchain.compile_sources(resource, tmp_path, dependencies_include_dir))
needed_update = toolchain.build_library(objects, bin_path, name)
if report != None and needed_update:
end = time()
cur_result["elapsed_time"] = end - start
cur_result["output"] = toolchain.get_output()
cur_result["result"] = "OK"
add_result_to_report(report, cur_result)
except Exception, e:
if report != None:
end = time()
cur_result["result"] = "FAIL"
cur_result["elapsed_time"] = end - start
toolchain_output = toolchain.get_output()
if toolchain_output:
cur_result["output"] += toolchain_output
cur_result["output"] += str(e)
add_result_to_report(report, cur_result)
# Let Exception propagate
raise e
def build_lib(lib_id, target, toolchain, options=None, verbose=False, clean=False, macros=None, notify=None, jobs=1, silent=False, report=None, properties=None, extra_verbose=False):
""" Wrapper for build_library function. """ Wrapper for build_library function.
Function builds library in proper directory using all dependencies and macros defined by user. Function builds library in proper directory using all dependencies and macros defined by user.
""" """
@ -177,7 +303,7 @@ def build_lib(lib_id, target, toolchain, options=None, verbose=False, clean=Fals
if macros: if macros:
MACROS.extend(macros) MACROS.extend(macros)
build_library(lib.source_dir, lib.build_dir, target, toolchain, lib.dependencies, options, return build_library(lib.source_dir, lib.build_dir, target, toolchain, lib.dependencies, options,
verbose=verbose, verbose=verbose,
silent=silent, silent=silent,
clean=clean, clean=clean,
@ -185,83 +311,134 @@ def build_lib(lib_id, target, toolchain, options=None, verbose=False, clean=Fals
notify=notify, notify=notify,
inc_dirs=lib.inc_dirs, inc_dirs=lib.inc_dirs,
inc_dirs_ext=lib.inc_dirs_ext, inc_dirs_ext=lib.inc_dirs_ext,
jobs=jobs) jobs=jobs,
report=report,
properties=properties,
extra_verbose=extra_verbose)
else: else:
print 'Library "%s" is not yet supported on target %s with toolchain %s' % (lib_id, target.name, toolchain) print 'Library "%s" is not yet supported on target %s with toolchain %s' % (lib_id, target.name, toolchain)
return False
# We do have unique legacy conventions about how we build and package the mbed library # We do have unique legacy conventions about how we build and package the mbed library
def build_mbed_libs(target, toolchain_name, options=None, verbose=False, clean=False, macros=None, notify=None, jobs=1, silent=False): def build_mbed_libs(target, toolchain_name, options=None, verbose=False, clean=False, macros=None, notify=None, jobs=1, silent=False, report=None, properties=None, extra_verbose=False):
""" Function returns True is library was built and false if building was skipped """ """ Function returns True is library was built and false if building was skipped """
if report != None:
start = time()
id_name = "MBED"
description = "mbed SDK"
cur_result = None
prep_report(report, target.name, toolchain_name, id_name)
cur_result = create_result(target.name, toolchain_name, id_name, description)
if properties != None:
prep_properties(properties, target.name, toolchain_name, id_name)
# Check toolchain support # Check toolchain support
if toolchain_name not in target.supported_toolchains: if toolchain_name not in target.supported_toolchains:
supported_toolchains_text = ", ".join(target.supported_toolchains) supported_toolchains_text = ", ".join(target.supported_toolchains)
print '%s target is not yet supported by toolchain %s' % (target.name, toolchain_name) print '%s target is not yet supported by toolchain %s' % (target.name, toolchain_name)
print '%s target supports %s toolchain%s' % (target.name, supported_toolchains_text, 's' if len(target.supported_toolchains) > 1 else '') print '%s target supports %s toolchain%s' % (target.name, supported_toolchains_text, 's' if len(target.supported_toolchains) > 1 else '')
if report != None:
cur_result["result"] = "SKIP"
add_result_to_report(report, cur_result)
return False return False
# Toolchain try:
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, macros=macros, notify=notify, silent=silent) # Toolchain
toolchain.VERBOSE = verbose toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, macros=macros, notify=notify, silent=silent, extra_verbose=extra_verbose)
toolchain.jobs = jobs toolchain.VERBOSE = verbose
toolchain.build_all = clean toolchain.jobs = jobs
toolchain.build_all = clean
# Source and Build Paths # Source and Build Paths
BUILD_TARGET = join(MBED_LIBRARIES, "TARGET_" + target.name) BUILD_TARGET = join(MBED_LIBRARIES, "TARGET_" + target.name)
BUILD_TOOLCHAIN = join(BUILD_TARGET, "TOOLCHAIN_" + toolchain.name) BUILD_TOOLCHAIN = join(BUILD_TARGET, "TOOLCHAIN_" + toolchain.name)
mkdir(BUILD_TOOLCHAIN) mkdir(BUILD_TOOLCHAIN)
TMP_PATH = join(MBED_LIBRARIES, '.temp', toolchain.obj_path) TMP_PATH = join(MBED_LIBRARIES, '.temp', toolchain.obj_path)
mkdir(TMP_PATH) mkdir(TMP_PATH)
# CMSIS # CMSIS
toolchain.info("Building library %s (%s, %s)"% ('CMSIS', target.name, toolchain_name)) toolchain.info("Building library %s (%s, %s)"% ('CMSIS', target.name, toolchain_name))
cmsis_src = join(MBED_TARGETS_PATH, "cmsis") cmsis_src = join(MBED_TARGETS_PATH, "cmsis")
resources = toolchain.scan_resources(cmsis_src) resources = toolchain.scan_resources(cmsis_src)
toolchain.copy_files(resources.headers, BUILD_TARGET) toolchain.copy_files(resources.headers, BUILD_TARGET)
toolchain.copy_files(resources.linker_script, BUILD_TOOLCHAIN) toolchain.copy_files(resources.linker_script, BUILD_TOOLCHAIN)
toolchain.copy_files(resources.bin_files, BUILD_TOOLCHAIN) toolchain.copy_files(resources.bin_files, BUILD_TOOLCHAIN)
objects = toolchain.compile_sources(resources, TMP_PATH) objects = toolchain.compile_sources(resources, TMP_PATH)
toolchain.copy_files(objects, BUILD_TOOLCHAIN) toolchain.copy_files(objects, BUILD_TOOLCHAIN)
# mbed # mbed
toolchain.info("Building library %s (%s, %s)" % ('MBED', target.name, toolchain_name)) toolchain.info("Building library %s (%s, %s)" % ('MBED', target.name, toolchain_name))
# Common Headers # Common Headers
toolchain.copy_files(toolchain.scan_resources(MBED_API).headers, MBED_LIBRARIES) toolchain.copy_files(toolchain.scan_resources(MBED_API).headers, MBED_LIBRARIES)
toolchain.copy_files(toolchain.scan_resources(MBED_HAL).headers, MBED_LIBRARIES) toolchain.copy_files(toolchain.scan_resources(MBED_HAL).headers, MBED_LIBRARIES)
# Target specific sources # Target specific sources
HAL_SRC = join(MBED_TARGETS_PATH, "hal") HAL_SRC = join(MBED_TARGETS_PATH, "hal")
hal_implementation = toolchain.scan_resources(HAL_SRC) hal_implementation = toolchain.scan_resources(HAL_SRC)
toolchain.copy_files(hal_implementation.headers + hal_implementation.hex_files + hal_implementation.libraries, BUILD_TARGET, HAL_SRC) toolchain.copy_files(hal_implementation.headers + hal_implementation.hex_files + hal_implementation.libraries, BUILD_TARGET, HAL_SRC)
incdirs = toolchain.scan_resources(BUILD_TARGET).inc_dirs incdirs = toolchain.scan_resources(BUILD_TARGET).inc_dirs
objects = toolchain.compile_sources(hal_implementation, TMP_PATH, [MBED_LIBRARIES] + incdirs) objects = toolchain.compile_sources(hal_implementation, TMP_PATH, [MBED_LIBRARIES] + incdirs)
# Common Sources # Common Sources
mbed_resources = toolchain.scan_resources(MBED_COMMON) mbed_resources = toolchain.scan_resources(MBED_COMMON)
objects += toolchain.compile_sources(mbed_resources, TMP_PATH, [MBED_LIBRARIES] + incdirs) objects += toolchain.compile_sources(mbed_resources, TMP_PATH, [MBED_LIBRARIES] + incdirs)
# A number of compiled files need to be copied as objects as opposed to # A number of compiled files need to be copied as objects as opposed to
# being part of the mbed library, for reasons that have to do with the way # being part of the mbed library, for reasons that have to do with the way
# the linker search for symbols in archives. These are: # the linker search for symbols in archives. These are:
# - retarget.o: to make sure that the C standard lib symbols get overridden # - retarget.o: to make sure that the C standard lib symbols get overridden
# - board.o: mbed_die is weak # - board.o: mbed_die is weak
# - mbed_overrides.o: this contains platform overrides of various weak SDK functions # - mbed_overrides.o: this contains platform overrides of various weak SDK functions
separate_names, separate_objects = ['retarget.o', 'board.o', 'mbed_overrides.o'], [] separate_names, separate_objects = ['retarget.o', 'board.o', 'mbed_overrides.o'], []
for o in objects:
for name in separate_names:
if o.endswith(name):
separate_objects.append(o)
for o in separate_objects:
objects.remove(o)
toolchain.build_library(objects, BUILD_TOOLCHAIN, "mbed")
for o in separate_objects:
toolchain.copy_files(o, BUILD_TOOLCHAIN)
return True
for o in objects:
for name in separate_names:
if o.endswith(name):
separate_objects.append(o)
for o in separate_objects:
objects.remove(o)
needed_update = toolchain.build_library(objects, BUILD_TOOLCHAIN, "mbed")
for o in separate_objects:
toolchain.copy_files(o, BUILD_TOOLCHAIN)
if report != None and needed_update:
end = time()
cur_result["elapsed_time"] = end - start
cur_result["output"] = toolchain.get_output()
cur_result["result"] = "OK"
add_result_to_report(report, cur_result)
return True
except Exception, e:
if report != None:
end = time()
cur_result["result"] = "FAIL"
cur_result["elapsed_time"] = end - start
toolchain_output = toolchain.get_output()
if toolchain_output:
cur_result["output"] += toolchain_output
cur_result["output"] += str(e)
add_result_to_report(report, cur_result)
# Let Exception propagate
raise e
def get_unique_supported_toolchains(): def get_unique_supported_toolchains():
""" Get list of all unique toolchains supported by targets """ """ Get list of all unique toolchains supported by targets """
@ -323,9 +500,9 @@ def get_target_supported_toolchains(target):
return TARGET_MAP[target].supported_toolchains if target in TARGET_MAP else None return TARGET_MAP[target].supported_toolchains if target in TARGET_MAP else None
def static_analysis_scan(target, toolchain_name, CPPCHECK_CMD, CPPCHECK_MSG_FORMAT, options=None, verbose=False, clean=False, macros=None, notify=None, jobs=1): def static_analysis_scan(target, toolchain_name, CPPCHECK_CMD, CPPCHECK_MSG_FORMAT, options=None, verbose=False, clean=False, macros=None, notify=None, jobs=1, extra_verbose=False):
# Toolchain # Toolchain
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, macros=macros, notify=notify) toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, macros=macros, notify=notify, extra_verbose=extra_verbose)
toolchain.VERBOSE = verbose toolchain.VERBOSE = verbose
toolchain.jobs = jobs toolchain.jobs = jobs
toolchain.build_all = clean toolchain.build_all = clean
@ -436,19 +613,19 @@ def static_analysis_scan(target, toolchain_name, CPPCHECK_CMD, CPPCHECK_MSG_FORM
def static_analysis_scan_lib(lib_id, target, toolchain, cppcheck_cmd, cppcheck_msg_format, def static_analysis_scan_lib(lib_id, target, toolchain, cppcheck_cmd, cppcheck_msg_format,
options=None, verbose=False, clean=False, macros=None, notify=None, jobs=1): options=None, verbose=False, clean=False, macros=None, notify=None, jobs=1, extra_verbose=False):
lib = Library(lib_id) lib = Library(lib_id)
if lib.is_supported(target, toolchain): if lib.is_supported(target, toolchain):
static_analysis_scan_library(lib.source_dir, lib.build_dir, target, toolchain, cppcheck_cmd, cppcheck_msg_format, static_analysis_scan_library(lib.source_dir, lib.build_dir, target, toolchain, cppcheck_cmd, cppcheck_msg_format,
lib.dependencies, options, lib.dependencies, options,
verbose=verbose, clean=clean, macros=macros, notify=notify, jobs=jobs) verbose=verbose, clean=clean, macros=macros, notify=notify, jobs=jobs, extra_verbose=extra_verbose)
else: else:
print 'Library "%s" is not yet supported on target %s with toolchain %s'% (lib_id, target.name, toolchain) print 'Library "%s" is not yet supported on target %s with toolchain %s'% (lib_id, target.name, toolchain)
def static_analysis_scan_library(src_paths, build_path, target, toolchain_name, cppcheck_cmd, cppcheck_msg_format, def static_analysis_scan_library(src_paths, build_path, target, toolchain_name, cppcheck_cmd, cppcheck_msg_format,
dependencies_paths=None, options=None, name=None, clean=False, dependencies_paths=None, options=None, name=None, clean=False,
notify=None, verbose=False, macros=None, jobs=1): notify=None, verbose=False, macros=None, jobs=1, extra_verbose=False):
""" Function scans library (or just some set of sources/headers) for staticly detectable defects """ """ Function scans library (or just some set of sources/headers) for staticly detectable defects """
if type(src_paths) != ListType: if type(src_paths) != ListType:
src_paths = [src_paths] src_paths = [src_paths]
@ -458,7 +635,7 @@ def static_analysis_scan_library(src_paths, build_path, target, toolchain_name,
raise Exception("The library source folder does not exist: %s", src_path) raise Exception("The library source folder does not exist: %s", src_path)
# Toolchain instance # Toolchain instance
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, macros=macros, notify=notify) toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, macros=macros, notify=notify, extra_verbose=extra_verbose)
toolchain.VERBOSE = verbose toolchain.VERBOSE = verbose
toolchain.jobs = jobs toolchain.jobs = jobs

View File

@ -27,6 +27,7 @@ sys.path.insert(0, ROOT)
from workspace_tools.build_api import build_mbed_libs from workspace_tools.build_api import build_mbed_libs
from workspace_tools.build_api import write_build_report from workspace_tools.build_api import write_build_report
from workspace_tools.targets import TARGET_MAP from workspace_tools.targets import TARGET_MAP
from workspace_tools.test_exporters import ReportExporter, ResultExporterType
OFFICIAL_MBED_LIBRARY_BUILD = ( OFFICIAL_MBED_LIBRARY_BUILD = (
('LPC11U24', ('ARM', 'uARM', 'GCC_ARM', 'IAR')), ('LPC11U24', ('ARM', 'uARM', 'GCC_ARM', 'IAR')),
@ -142,15 +143,13 @@ if __name__ == '__main__':
parser.add_option("-p", "--platforms", dest="platforms", default="", help="Build only for the platform namesseparated by comma") parser.add_option("-p", "--platforms", dest="platforms", default="", help="Build only for the platform namesseparated by comma")
parser.add_option("", "--report-build", dest="report_build_file_name", help="Output the build results to an html file") parser.add_option("", "--report-build", dest="report_build_file_name", help="Output the build results to an junit xml file")
options, args = parser.parse_args() options, args = parser.parse_args()
start = time() start = time()
failures = [] report = {}
successes = [] properties = {}
skips = []
build_report = []
platforms = None platforms = None
if options.platforms != "": if options.platforms != "":
@ -171,46 +170,24 @@ if __name__ == '__main__':
toolchainSet = set(toolchains) toolchainSet = set(toolchains)
toolchains = toolchainSet and set((options.toolchains).split(',')) toolchains = toolchainSet and set((options.toolchains).split(','))
cur_target_build_report = { "target": target_name, "passing": [], "failing": [], "skipped": []}
for toolchain in toolchains: for toolchain in toolchains:
id = "%s::%s" % (target_name, toolchain) id = "%s::%s" % (target_name, toolchain)
try: try:
built_mbed_lib = build_mbed_libs(TARGET_MAP[target_name], toolchain, verbose=options.verbose, jobs=options.jobs) built_mbed_lib = build_mbed_libs(TARGET_MAP[target_name], toolchain, verbose=options.verbose, jobs=options.jobs, report=report, properties=properties)
if built_mbed_lib:
successes.append(id)
cur_target_build_report["passing"].append({ "toolchain": toolchain })
else:
skips.append(id)
cur_target_build_report["skipped"].append({ "toolchain": toolchain })
except Exception, e: except Exception, e:
failures.append(id) print str(e)
cur_target_build_report["failing"].append({ "toolchain": toolchain })
print e
if len(toolchains) > 0:
build_report.append(cur_target_build_report)
# Write summary of the builds # Write summary of the builds
if options.report_build_file_name: if options.report_build_file_name:
write_build_report(build_report, 'library_build/report.html', options.report_build_file_name) file_report_exporter = ReportExporter(ResultExporterType.JUNIT, package="build")
file_report_exporter.report_to_file(report, options.report_build_file_name, test_suite_properties=properties)
print "\n\nCompleted in: (%.2f)s" % (time() - start) print "\n\nCompleted in: (%.2f)s" % (time() - start)
if successes: print_report_exporter = ReportExporter(ResultExporterType.PRINT, package="build")
print "\n\nBuild successes:" status = print_report_exporter.report(report)
print "\n".join([" * %s" % s for s in successes])
if skips: if not status:
print "\n\nBuild skips:"
print "\n".join([" * %s" % s for s in skips])
if failures:
print "\n\nBuild failures:"
print "\n".join([" * %s" % f for f in failures])
sys.exit(1) sys.exit(1)

View File

@ -38,6 +38,7 @@ build_list = (
{ "target": "NUCLEO_L053R8", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, { "target": "NUCLEO_L053R8", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] },
{ "target": "NUCLEO_L152RE", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, { "target": "NUCLEO_L152RE", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] },
{ "target": "NUCLEO_F030R8", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, { "target": "NUCLEO_F030R8", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] },
{ "target": "NUCLEO_F031K6", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] },
{ "target": "NUCLEO_F042K6", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, { "target": "NUCLEO_F042K6", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] },
{ "target": "NUCLEO_F070RB", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, { "target": "NUCLEO_F070RB", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] },
{ "target": "NUCLEO_F072RB", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, { "target": "NUCLEO_F072RB", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] },
@ -49,6 +50,11 @@ build_list = (
{ "target": "NUCLEO_F334R8", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, { "target": "NUCLEO_F334R8", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] },
{ "target": "NUCLEO_F401RE", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, { "target": "NUCLEO_F401RE", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] },
{ "target": "NUCLEO_F411RE", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, { "target": "NUCLEO_F411RE", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] },
{ "target": "NUCLEO_L476RG", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] },
{ "target": "NUCLEO_L073RZ", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] },
{ "target": "NUCLEO_F446RE", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] },
{ "target": "ELMO_F411RE", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] },
{ "target": "MTS_MDOT_F405RG", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos"] }, { "target": "MTS_MDOT_F405RG", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos"] },
{ "target": "MTS_MDOT_F411RE", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos"] }, { "target": "MTS_MDOT_F411RE", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos"] },
@ -81,12 +87,25 @@ build_list = (
{ "target": "ARCH_PRO", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, { "target": "ARCH_PRO", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] },
{ "target": "LPC1549", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] }, { "target": "LPC1549", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos", "fat"] },
{ "target": "NRF51822", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] }, { "target": "NRF51822", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] },
{ "target": "DELTA_DFCM_NNN40", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] },
{ "target": "NRF51_DK", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] },
{ "target": "NRF51_MICROBIT", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] },
{ "target": "EFM32ZG_STK3200", "toolchains": "GCC_ARM", "libs": ["dsp"] }, { "target": "EFM32ZG_STK3200", "toolchains": "GCC_ARM", "libs": ["dsp"] },
{ "target": "EFM32HG_STK3400", "toolchains": "GCC_ARM", "libs": ["dsp", "usb"] }, { "target": "EFM32HG_STK3400", "toolchains": "GCC_ARM", "libs": ["dsp", "usb"] },
{ "target": "EFM32LG_STK3600", "toolchains": "GCC_ARM", "libs": ["dsp", "usb"] }, { "target": "EFM32LG_STK3600", "toolchains": "GCC_ARM", "libs": ["dsp", "usb"] },
{ "target": "EFM32GG_STK3700", "toolchains": "GCC_ARM", "libs": ["dsp", "usb"] }, { "target": "EFM32GG_STK3700", "toolchains": "GCC_ARM", "libs": ["dsp", "usb"] },
{ "target": "EFM32WG_STK3800", "toolchains": "GCC_ARM", "libs": ["dsp", "usb"] }, { "target": "EFM32WG_STK3800", "toolchains": "GCC_ARM", "libs": ["dsp", "usb"] },
{ "target": "MAXWSNENV", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] },
{ "target": "MAX32600MBED", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] },
{ "target": "RZ_A1H", "toolchains": "GCC_ARM", "libs": ["fat"] },
{ "target": "SAMR21G18A", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] },
{ "target": "SAMD21J18A", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] },
{ "target": "SAMD21G18A", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] },
{ "target": "SAML21J18A", "toolchains": "GCC_ARM", "libs": ["dsp", "fat"] },
) )
################################################################################ ################################################################################

View File

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Project version="2G - 1.7.5" name="{{name}}">
<Target name="{{name}}" isCurrent="1">
<Device manufacturerId="9" manufacturerName="ST" chipId="577" chipName="STM32F042K6" boardId="" boardName=""/>
<BuildOption>
<Compile>
<Option name="OptimizationLevel" value="4"/>
<Option name="UseFPU" value="0"/>
<Option name="UserEditCompiler" value="-fno-common; -fmessage-length=0; -Wall; -fno-strict-aliasing; -fno-rtti; -fno-exceptions; -ffunction-sections; -fdata-sections; -std=gnu++98"/>
<Option name="FPU" value="1"/>
<Option name="SupportCPlusplus" value="1"/>
<Includepaths>
{% for path in include_paths %} <Includepath path="{{path}}"/> {% endfor %}
</Includepaths>
<DefinedSymbols>
{% for s in symbols %} <Define name="{{s}}"/> {% endfor %}
</DefinedSymbols>
</Compile>
<Link useDefault="0">
<Option name="DiscardUnusedSection" value="1"/>
<Option name="UserEditLinkder" value=""/>
<Option name="UseMemoryLayout" value="0"/>
<Option name="LTO" value="0"/>
<Option name="IsNewStartupCode" value="1"/>
<Option name="Library" value="Not use C Library"/>
<Option name="nostartfiles" value="0"/>
<Option name="UserEditLinker" value="-Wl,--wrap,main; --specs=nano.specs; {% for file in object_files %}
${project.path}/{{file}}; {% endfor %} {% for p in library_paths %}-L${project.path}/{{p}}; {% endfor %}"/>
<LinkedLibraries>
{% for lib in libraries %}
<Libset dir="" libs="{{lib}}"/>
{% endfor %}
<Libset dir="" libs="stdc++"/>
<Libset dir="" libs="supc++"/>
<Libset dir="" libs="m"/>
<Libset dir="" libs="gcc"/>
<Libset dir="" libs="c"/>
<Libset dir="" libs="nosys"/>
</LinkedLibraries>
<MemoryAreas debugInFlashNotRAM="1">
<Memory name="IROM1" type="ReadOnly" size="0x00007FFF" startValue="0x08000000"/>
<Memory name="IRAM1" type="ReadWrite" size="0x00001740" startValue="0x200000C0"/>
<Memory name="IROM2" type="ReadOnly" size="" startValue=""/>
<Memory name="IRAM2" type="ReadWrite" size="" startValue=""/>
</MemoryAreas>
<LocateLinkFile path="{{scatter_file}}" type="0"/>
</Link>
<Output>
<Option name="OutputFileType" value="0"/>
<Option name="Path" value="./"/>
<Option name="Name" value="{{name}}"/>
<Option name="HEX" value="1"/>
<Option name="BIN" value="1"/>
</Output>
<User>
<UserRun name="Run#1" type="Before" checked="0" value=""/>
<UserRun name="Run#1" type="After" checked="0" value=""/>
</User>
</BuildOption>
<DebugOption>
<Option name="org.coocox.codebugger.gdbjtag.core.adapter" value="ST-Link"/>
<Option name="org.coocox.codebugger.gdbjtag.core.debugMode" value="SWD"/>
<Option name="org.coocox.codebugger.gdbjtag.core.clockDiv" value="1M"/>
<Option name="org.coocox.codebugger.gdbjtag.corerunToMain" value="1"/>
<Option name="org.coocox.codebugger.gdbjtag.core.jlinkgdbserver" value=""/>
<Option name="org.coocox.codebugger.gdbjtag.core.userDefineGDBScript" value=""/>
<Option name="org.coocox.codebugger.gdbjtag.core.targetEndianess" value="0"/>
<Option name="org.coocox.codebugger.gdbjtag.core.jlinkResetMode" value="Type 0: Normal"/>
<Option name="org.coocox.codebugger.gdbjtag.core.resetMode" value="SYSRESETREQ"/>
<Option name="org.coocox.codebugger.gdbjtag.core.ifSemihost" value="0"/>
<Option name="org.coocox.codebugger.gdbjtag.core.ifCacheRom" value="1"/>
<Option name="org.coocox.codebugger.gdbjtag.core.ipAddress" value="127.0.0.1"/>
<Option name="org.coocox.codebugger.gdbjtag.core.portNumber" value="2009"/>
<Option name="org.coocox.codebugger.gdbjtag.core.autoDownload" value="1"/>
<Option name="org.coocox.codebugger.gdbjtag.core.verify" value="1"/>
<Option name="org.coocox.codebugger.gdbjtag.core.downloadFuction" value="Erase Effected"/>
<Option name="org.coocox.codebugger.gdbjtag.core.defaultAlgorithm" value="./stm32f05xx_64.elf"/>
</DebugOption>
<ExcludeFile/>
</Target>
<Components path="./"/>
<Files>
{% for file in source_files %}
<File name="sources/{{file.path}}" path="{{file.path}}" type="{{file.type}}"/>
{% endfor %}
{% for file in header_files %}
<File name="headers/{{file.path}}" path="{{file.path}}" type="{{file.type}}"/>
{% endfor %}
</Files>
</Project>

View File

@ -79,9 +79,9 @@
<nStopB2X>0</nStopB2X> <nStopB2X>0</nStopB2X>
</BeforeMake> </BeforeMake>
<AfterMake> <AfterMake>
<RunUserProg1>0</RunUserProg1> <RunUserProg1>1</RunUserProg1>
<RunUserProg2>0</RunUserProg2> <RunUserProg2>0</RunUserProg2>
<UserProg1Name>fromelf --bin -o build\{{name}}_NUCLEO_F302R8.bin build\{{name}}.axf</UserProg1Name> <UserProg1Name>fromelf --bin -o build\{{name}}_NUCLEO_F042K6.bin build\{{name}}.axf</UserProg1Name>
<UserProg2Name></UserProg2Name> <UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode> <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode> <UserProg2Dos16Mode>0</UserProg2Dos16Mode>

View File

@ -74,7 +74,7 @@
<UserProg2Dos16Mode>0</UserProg2Dos16Mode> <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
</BeforeMake> </BeforeMake>
<AfterMake> <AfterMake>
<RunUserProg1>0</RunUserProg1> <RunUserProg1>1</RunUserProg1>
<RunUserProg2>0</RunUserProg2> <RunUserProg2>0</RunUserProg2>
<UserProg1Name>fromelf --bin -o build\{{name}}_NUCLEO_F302R8.bin build\{{name}}.axf</UserProg1Name> <UserProg1Name>fromelf --bin -o build\{{name}}_NUCLEO_F302R8.bin build\{{name}}.axf</UserProg1Name>
<UserProg2Name></UserProg2Name> <UserProg2Name></UserProg2Name>

View File

@ -74,9 +74,9 @@
<UserProg2Dos16Mode>0</UserProg2Dos16Mode> <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
</BeforeMake> </BeforeMake>
<AfterMake> <AfterMake>
<RunUserProg1>0</RunUserProg1> <RunUserProg1>1</RunUserProg1>
<RunUserProg2>0</RunUserProg2> <RunUserProg2>0</RunUserProg2>
<UserProg1Name>fromelf --bin -o build\{{name}}_NUCLEO_F302R8.bin build\{{name}}.axf</UserProg1Name> <UserProg1Name>fromelf --bin -o build\{{name}}_NUCLEO_F303K8.bin build\{{name}}.axf</UserProg1Name>
<UserProg2Name></UserProg2Name> <UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode> <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode> <UserProg2Dos16Mode>0</UserProg2Dos16Mode>

View File

@ -74,9 +74,9 @@
<UserProg2Dos16Mode>0</UserProg2Dos16Mode> <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
</BeforeMake> </BeforeMake>
<AfterMake> <AfterMake>
<RunUserProg1>0</RunUserProg1> <RunUserProg1>1</RunUserProg1>
<RunUserProg2>0</RunUserProg2> <RunUserProg2>0</RunUserProg2>
<UserProg1Name>fromelf --bin -o build\{{name}}_NUCLEO_F302R8.bin build\{{name}}.axf</UserProg1Name> <UserProg1Name>fromelf --bin -o build\{{name}}_NUCLEO_F303RE.bin build\{{name}}.axf</UserProg1Name>
<UserProg2Name></UserProg2Name> <UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode> <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode> <UserProg2Dos16Mode>0</UserProg2Dos16Mode>

View File

@ -74,7 +74,7 @@
<UserProg2Dos16Mode>0</UserProg2Dos16Mode> <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
</BeforeMake> </BeforeMake>
<AfterMake> <AfterMake>
<RunUserProg1>0</RunUserProg1> <RunUserProg1>1</RunUserProg1>
<RunUserProg2>0</RunUserProg2> <RunUserProg2>0</RunUserProg2>
<UserProg1Name>fromelf --bin -o build\{{name}}_NUCLEO_F334R8.bin build\{{name}}.axf</UserProg1Name> <UserProg1Name>fromelf --bin -o build\{{name}}_NUCLEO_F334R8.bin build\{{name}}.axf</UserProg1Name>
<UserProg2Name></UserProg2Name> <UserProg2Name></UserProg2Name>

View File

@ -50,7 +50,10 @@ from workspace_tools.test_db import BaseDBAccess
from workspace_tools.build_api import build_project, build_mbed_libs, build_lib from workspace_tools.build_api import build_project, build_mbed_libs, build_lib
from workspace_tools.build_api import get_target_supported_toolchains from workspace_tools.build_api import get_target_supported_toolchains
from workspace_tools.build_api import write_build_report from workspace_tools.build_api import write_build_report
from workspace_tools.build_api import print_build_results from workspace_tools.build_api import prep_report
from workspace_tools.build_api import prep_properties
from workspace_tools.build_api import create_result
from workspace_tools.build_api import add_result_to_report
from workspace_tools.libraries import LIBRARIES, LIBRARY_MAP from workspace_tools.libraries import LIBRARIES, LIBRARY_MAP
from workspace_tools.toolchains import TOOLCHAIN_BIN_PATH from workspace_tools.toolchains import TOOLCHAIN_BIN_PATH
from workspace_tools.test_exporters import ReportExporter, ResultExporterType from workspace_tools.test_exporters import ReportExporter, ResultExporterType
@ -188,11 +191,6 @@ class SingleTestRunner(object):
from colorama import init from colorama import init
init() init()
# Build results
build_failures = []
build_successes = []
build_skipped = []
PATTERN = "\\{(" + "|".join(self.TEST_RESULT_MAPPING.keys()) + ")\\}" PATTERN = "\\{(" + "|".join(self.TEST_RESULT_MAPPING.keys()) + ")\\}"
self.RE_DETECT_TESTCASE_RESULT = re.compile(PATTERN) self.RE_DETECT_TESTCASE_RESULT = re.compile(PATTERN)
# Settings related to test loops counters # Settings related to test loops counters
@ -310,19 +308,10 @@ class SingleTestRunner(object):
test_summary_ext = {} test_summary_ext = {}
execute_thread_slice_lock = Lock() execute_thread_slice_lock = Lock()
def execute_thread_slice(self, q, target, toolchains, clean, test_ids, build_report): def execute_thread_slice(self, q, target, toolchains, clean, test_ids, build_report, build_properties):
for toolchain in toolchains: for toolchain in toolchains:
tt_id = "%s::%s" % (toolchain, target) tt_id = "%s::%s" % (toolchain, target)
# Toolchain specific build successes and failures
build_report[toolchain] = {
"mbed_failure": False,
"library_failure": False,
"library_build_passing": [],
"library_build_failing": [],
"test_build_passing": [],
"test_build_failing": []
}
# print target, toolchain # print target, toolchain
# Test suite properties returned to external tools like CI # Test suite properties returned to external tools like CI
test_suite_properties = { test_suite_properties = {
@ -352,17 +341,15 @@ class SingleTestRunner(object):
options=build_mbed_libs_options, options=build_mbed_libs_options,
clean=clean_mbed_libs_options, clean=clean_mbed_libs_options,
verbose=self.opts_verbose, verbose=self.opts_verbose,
jobs=self.opts_jobs) jobs=self.opts_jobs,
report=build_report,
properties=build_properties)
if not build_mbed_libs_result: if not build_mbed_libs_result:
self.build_skipped.append(tt_id)
print self.logger.log_line(self.logger.LogType.NOTIF, 'Skipped tests for %s target. Toolchain %s is not yet supported for this target'% (T.name, toolchain)) print self.logger.log_line(self.logger.LogType.NOTIF, 'Skipped tests for %s target. Toolchain %s is not yet supported for this target'% (T.name, toolchain))
continue continue
else:
self.build_successes.append(tt_id)
except ToolException: except ToolException:
self.build_failures.append(tt_id)
build_report[toolchain]["mbed_failure"] = True
print self.logger.log_line(self.logger.LogType.ERROR, 'There were errors while building MBED libs for %s using %s'% (target, toolchain)) print self.logger.log_line(self.logger.LogType.ERROR, 'There were errors while building MBED libs for %s using %s'% (target, toolchain))
continue continue
@ -401,15 +388,15 @@ class SingleTestRunner(object):
# First pass through all tests and determine which libraries need to be built # First pass through all tests and determine which libraries need to be built
libraries = set() libraries = []
for test_id in valid_test_map_keys: for test_id in valid_test_map_keys:
test = TEST_MAP[test_id] test = TEST_MAP[test_id]
# Detect which lib should be added to test # Detect which lib should be added to test
# Some libs have to compiled like RTOS or ETH # Some libs have to compiled like RTOS or ETH
for lib in LIBRARIES: for lib in LIBRARIES:
if lib['build_dir'] in test.dependencies: if lib['build_dir'] in test.dependencies and lib['build_dir'] not in libraries:
libraries.add(lib['id']) libraries.append(lib['id'])
build_project_options = ["analyze"] if self.opts_goanna_for_tests else None build_project_options = ["analyze"] if self.opts_goanna_for_tests else None
@ -424,14 +411,12 @@ class SingleTestRunner(object):
options=build_project_options, options=build_project_options,
verbose=self.opts_verbose, verbose=self.opts_verbose,
clean=clean_mbed_libs_options, clean=clean_mbed_libs_options,
jobs=self.opts_jobs) jobs=self.opts_jobs,
report=build_report,
build_report[toolchain]["library_build_passing"].append(lib_id) properties=build_properties)
except ToolException: except ToolException:
print self.logger.log_line(self.logger.LogType.ERROR, 'There were errors while building library %s'% (lib_id)) print self.logger.log_line(self.logger.LogType.ERROR, 'There were errors while building library %s'% (lib_id))
build_report[toolchain]["library_failure"] = True
build_report[toolchain]["library_build_failing"].append(lib_id)
continue continue
@ -456,10 +441,10 @@ class SingleTestRunner(object):
MACROS.append('TEST_SUITE_UUID="%s"'% str(test_uuid)) MACROS.append('TEST_SUITE_UUID="%s"'% str(test_uuid))
# Prepare extended test results data structure (it can be used to generate detailed test report) # Prepare extended test results data structure (it can be used to generate detailed test report)
if toolchain not in self.test_summary_ext: if target not in self.test_summary_ext:
self.test_summary_ext[toolchain] = {} # test_summary_ext : toolchain self.test_summary_ext[target] = {} # test_summary_ext : toolchain
if target not in self.test_summary_ext[toolchain]: if toolchain not in self.test_summary_ext[target]:
self.test_summary_ext[toolchain][target] = {} # test_summary_ext : toolchain : target self.test_summary_ext[target][toolchain] = {} # test_summary_ext : toolchain : target
tt_test_id = "%s::%s::%s" % (toolchain, target, test_id) # For logging only tt_test_id = "%s::%s::%s" % (toolchain, target, test_id) # For logging only
@ -476,14 +461,15 @@ class SingleTestRunner(object):
name=project_name, name=project_name,
macros=MACROS, macros=MACROS,
inc_dirs=INC_DIRS, inc_dirs=INC_DIRS,
jobs=self.opts_jobs) jobs=self.opts_jobs,
build_report[toolchain]["test_build_passing"].append(test_id) report=build_report,
properties=build_properties,
project_id=test_id,
project_description=test.get_description())
except ToolException: except ToolException:
project_name_str = project_name if project_name is not None else test_id project_name_str = project_name if project_name is not None else test_id
print self.logger.log_line(self.logger.LogType.ERROR, 'There were errors while building project %s'% (project_name_str)) print self.logger.log_line(self.logger.LogType.ERROR, 'There were errors while building project %s'% (project_name_str))
build_report[toolchain]["test_build_failing"].append(test_id)
self.build_failures.append(tt_test_id)
# Append test results to global test summary # Append test results to global test summary
self.test_summary.append( self.test_summary.append(
@ -491,17 +477,17 @@ class SingleTestRunner(object):
) )
# Add detailed test result to test summary structure # Add detailed test result to test summary structure
if test_id not in self.test_summary_ext[toolchain][target]: if test_id not in self.test_summary_ext[target][toolchain]:
self.test_summary_ext[toolchain][target][test_id] = [] self.test_summary_ext[target][toolchain][test_id] = []
self.test_summary_ext[toolchain][target][test_id].append({ 0: { self.test_summary_ext[target][toolchain][test_id].append({ 0: {
'single_test_result' : self.TEST_RESULT_BUILD_FAILED, 'result' : self.TEST_RESULT_BUILD_FAILED,
'single_test_output' : '', 'output' : '',
'target_name' : target, 'target_name' : target,
'target_name_unique': target, 'target_name_unique': target,
'toolchain_name' : toolchain, 'toolchain_name' : toolchain,
'test_id' : test_id, 'id' : test_id,
'test_description' : 'Toolchain build failed', 'description' : 'Toolchain build failed',
'elapsed_time' : 0, 'elapsed_time' : 0,
'duration' : 0, 'duration' : 0,
'copy_method' : None 'copy_method' : None
@ -543,9 +529,9 @@ class SingleTestRunner(object):
self.test_summary.append(single_test_result) self.test_summary.append(single_test_result)
# Add detailed test result to test summary structure # Add detailed test result to test summary structure
if target not in self.test_summary_ext[toolchain][target]: if target not in self.test_summary_ext[target][toolchain]:
if test_id not in self.test_summary_ext[toolchain][target]: if test_id not in self.test_summary_ext[target][toolchain]:
self.test_summary_ext[toolchain][target][test_id] = [] self.test_summary_ext[target][toolchain][test_id] = []
append_test_result = detailed_test_results append_test_result = detailed_test_results
@ -554,7 +540,7 @@ class SingleTestRunner(object):
if self.opts_waterfall_test and self.opts_consolidate_waterfall_test: if self.opts_waterfall_test and self.opts_consolidate_waterfall_test:
append_test_result = {0: detailed_test_results[len(detailed_test_results) - 1]} append_test_result = {0: detailed_test_results[len(detailed_test_results) - 1]}
self.test_summary_ext[toolchain][target][test_id].append(append_test_result) self.test_summary_ext[target][toolchain][test_id].append(append_test_result)
test_suite_properties['skipped'] = ', '.join(test_suite_properties['skipped']) test_suite_properties['skipped'] = ', '.join(test_suite_properties['skipped'])
self.test_suite_properties_ext[target][toolchain] = test_suite_properties self.test_suite_properties_ext[target][toolchain] = test_suite_properties
@ -572,10 +558,8 @@ class SingleTestRunner(object):
if self.opts_shuffle_test_seed is not None and self.is_shuffle_seed_float(): if self.opts_shuffle_test_seed is not None and self.is_shuffle_seed_float():
self.shuffle_random_seed = round(float(self.opts_shuffle_test_seed), self.SHUFFLE_SEED_ROUND) self.shuffle_random_seed = round(float(self.opts_shuffle_test_seed), self.SHUFFLE_SEED_ROUND)
build_reports = [] build_report = {}
self.build_failures = [] build_properties = {}
self.build_successes = []
self.build_skipped = []
if self.opts_parallel_test_exec: if self.opts_parallel_test_exec:
################################################################### ###################################################################
@ -589,9 +573,7 @@ class SingleTestRunner(object):
# get information about available MUTs (per target). # get information about available MUTs (per target).
for target, toolchains in self.test_spec['targets'].iteritems(): for target, toolchains in self.test_spec['targets'].iteritems():
self.test_suite_properties_ext[target] = {} self.test_suite_properties_ext[target] = {}
cur_build_report = {} t = threading.Thread(target=self.execute_thread_slice, args = (q, target, toolchains, clean, test_ids, build_report, build_properties))
t = threading.Thread(target=self.execute_thread_slice, args = (q, target, toolchains, clean, test_ids, cur_build_report))
build_reports.append({ "target": target, "report": cur_build_report})
t.daemon = True t.daemon = True
t.start() t.start()
execute_threads.append(t) execute_threads.append(t)
@ -604,63 +586,16 @@ class SingleTestRunner(object):
if target not in self.test_suite_properties_ext: if target not in self.test_suite_properties_ext:
self.test_suite_properties_ext[target] = {} self.test_suite_properties_ext[target] = {}
cur_build_report = {} self.execute_thread_slice(q, target, toolchains, clean, test_ids, build_report, build_properties)
self.execute_thread_slice(q, target, toolchains, clean, test_ids, cur_build_report)
build_reports.append({ "target": target, "report": cur_build_report})
q.get() q.get()
build_report = []
for target_build_report in build_reports:
cur_report = {
"target": target_build_report["target"],
"passing": [],
"failing": []
}
for toolchain in sorted(target_build_report["report"], key=target_build_report["report"].get):
report = target_build_report["report"][toolchain]
if report["mbed_failure"]:
cur_report["failing"].append({
"toolchain": toolchain,
"project": "mbed library"
})
else:
for passing_library in report["library_build_failing"]:
cur_report["failing"].append({
"toolchain": toolchain,
"project": "Library::%s" % (passing_library)
})
for failing_library in report["library_build_passing"]:
cur_report["passing"].append({
"toolchain": toolchain,
"project": "Library::%s" % (failing_library)
})
for passing_test in report["test_build_passing"]:
cur_report["passing"].append({
"toolchain": toolchain,
"project": "Test::%s" % (passing_test)
})
for failing_test in report["test_build_failing"]:
cur_report["failing"].append({
"toolchain": toolchain,
"project": "Test::%s" % (failing_test)
})
build_report.append(cur_report)
if self.db_logger: if self.db_logger:
self.db_logger.reconnect(); self.db_logger.reconnect();
if self.db_logger.is_connected(): if self.db_logger.is_connected():
self.db_logger.update_build_id_info(self.db_logger_build_id, _status_fk=self.db_logger.BUILD_ID_STATUS_COMPLETED) self.db_logger.update_build_id_info(self.db_logger_build_id, _status_fk=self.db_logger.BUILD_ID_STATUS_COMPLETED)
self.db_logger.disconnect(); self.db_logger.disconnect();
return self.test_summary, self.shuffle_random_seed, self.test_summary_ext, self.test_suite_properties_ext, build_report return self.test_summary, self.shuffle_random_seed, self.test_summary_ext, self.test_suite_properties_ext, build_report, build_properties
def get_valid_tests(self, test_map_keys, target, toolchain, test_ids): def get_valid_tests(self, test_map_keys, target, toolchain, test_ids):
valid_test_map_keys = [] valid_test_map_keys = []
@ -945,13 +880,13 @@ class SingleTestRunner(object):
elapsed_time = single_testduration # TIme of single test case execution after reset elapsed_time = single_testduration # TIme of single test case execution after reset
detailed_test_results[test_index] = { detailed_test_results[test_index] = {
'single_test_result' : single_test_result, 'result' : single_test_result,
'single_test_output' : single_test_output, 'output' : single_test_output,
'target_name' : target_name, 'target_name' : target_name,
'target_name_unique' : target_name_unique, 'target_name_unique' : target_name_unique,
'toolchain_name' : toolchain_name, 'toolchain_name' : toolchain_name,
'test_id' : test_id, 'id' : test_id,
'test_description' : test_description, 'description' : test_description,
'elapsed_time' : round(elapsed_time, 2), 'elapsed_time' : round(elapsed_time, 2),
'duration' : single_timeout, 'duration' : single_timeout,
'copy_method' : _copy_method, 'copy_method' : _copy_method,
@ -1523,7 +1458,7 @@ def singletest_in_cli_mode(single_test):
""" """
start = time() start = time()
# Execute tests depending on options and filter applied # Execute tests depending on options and filter applied
test_summary, shuffle_seed, test_summary_ext, test_suite_properties_ext, build_report = single_test.execute() test_summary, shuffle_seed, test_summary_ext, test_suite_properties_ext, build_report, build_properties = single_test.execute()
elapsed_time = time() - start elapsed_time = time() - start
# Human readable summary # Human readable summary
@ -1539,12 +1474,8 @@ def singletest_in_cli_mode(single_test):
print print
# Write summary of the builds # Write summary of the builds
for report, report_name in [(single_test.build_successes, "Build successes:"), print_report_exporter = ReportExporter(ResultExporterType.PRINT, package="build")
(single_test.build_skipped, "Build skipped:"), status = print_report_exporter.report(build_report)
(single_test.build_failures, "Build failures:"),
]:
if report:
print print_build_results(report, report_name)
# Store extra reports in files # Store extra reports in files
if single_test.opts_report_html_file_name: if single_test.opts_report_html_file_name:
@ -1557,10 +1488,11 @@ def singletest_in_cli_mode(single_test):
report_exporter.report_to_file(test_summary_ext, single_test.opts_report_junit_file_name, test_suite_properties=test_suite_properties_ext) report_exporter.report_to_file(test_summary_ext, single_test.opts_report_junit_file_name, test_suite_properties=test_suite_properties_ext)
if single_test.opts_report_build_file_name: if single_test.opts_report_build_file_name:
# Export build results as html report to sparate file # Export build results as html report to sparate file
write_build_report(build_report, 'tests_build/report.html', single_test.opts_report_build_file_name) report_exporter = ReportExporter(ResultExporterType.JUNIT, package="build")
report_exporter.report_to_file(build_report, single_test.opts_report_build_file_name, test_suite_properties=build_properties)
# Returns True if no build failures of the test projects or their dependencies # Returns True if no build failures of the test projects or their dependencies
return len(single_test.build_failures) == 0 return status
class TestLogger(): class TestLogger():
""" Super-class for logging and printing ongoing events for test suite pass """ Super-class for logging and printing ongoing events for test suite pass
@ -1965,7 +1897,7 @@ def get_default_test_options_parser():
parser.add_option("", "--report-build", parser.add_option("", "--report-build",
dest="report_build_file_name", dest="report_build_file_name",
help="Output the build results to an html file") help="Output the build results to a junit xml file")
parser.add_option('', '--verbose-skipped', parser.add_option('', '--verbose-skipped',
dest='verbose_skipped_tests', dest='verbose_skipped_tests',

View File

@ -23,7 +23,8 @@ from workspace_tools.utils import construct_enum
ResultExporterType = construct_enum(HTML='Html_Exporter', ResultExporterType = construct_enum(HTML='Html_Exporter',
JUNIT='JUnit_Exporter', JUNIT='JUnit_Exporter',
JUNIT_OPER='JUnit_Exporter_Interoperability', JUNIT_OPER='JUnit_Exporter_Interoperability',
BUILD='Build_Exporter') BUILD='Build_Exporter',
PRINT='Print_Exporter')
class ReportExporter(): class ReportExporter():
@ -35,11 +36,11 @@ class ReportExporter():
u'uARM': { u'LPC1768': { 'MBED_2': { 0: { 'copy_method': 'shutils.copy()', u'uARM': { u'LPC1768': { 'MBED_2': { 0: { 'copy_method': 'shutils.copy()',
'duration': 20, 'duration': 20,
'elapsed_time': 1.7929999828338623, 'elapsed_time': 1.7929999828338623,
'single_test_output': 'Host test instrumentation on ...\r\n', 'output': 'Host test instrumentation on ...\r\n',
'single_test_result': 'OK', 'result': 'OK',
'target_name': u'LPC1768', 'target_name': u'LPC1768',
'test_description': 'stdio', 'description': 'stdio',
'test_id': u'MBED_2', 'id': u'MBED_2',
'toolchain_name': u'uARM'}}, 'toolchain_name': u'uARM'}},
""" """
CSS_STYLE = """<style> CSS_STYLE = """<style>
@ -67,8 +68,9 @@ class ReportExporter():
</script> </script>
""" """
def __init__(self, result_exporter_type): def __init__(self, result_exporter_type, package="test"):
self.result_exporter_type = result_exporter_type self.result_exporter_type = result_exporter_type
self.package = package
def report(self, test_summary_ext, test_suite_properties=None): def report(self, test_summary_ext, test_suite_properties=None):
""" Invokes report depending on exporter_type set in constructor """ Invokes report depending on exporter_type set in constructor
@ -82,6 +84,9 @@ class ReportExporter():
elif self.result_exporter_type == ResultExporterType.JUNIT_OPER: elif self.result_exporter_type == ResultExporterType.JUNIT_OPER:
# JUNIT exporter for interoperability test # JUNIT exporter for interoperability test
return self.exporter_junit_ioper(test_summary_ext, test_suite_properties) return self.exporter_junit_ioper(test_summary_ext, test_suite_properties)
elif self.result_exporter_type == ResultExporterType.PRINT:
# JUNIT exporter for interoperability test
return self.exporter_print(test_summary_ext)
return None return None
def report_to_file(self, test_summary_ext, file_name, test_suite_properties=None): def report_to_file(self, test_summary_ext, file_name, test_suite_properties=None):
@ -111,8 +116,8 @@ class ReportExporter():
'OTHER': 'LightGray', 'OTHER': 'LightGray',
} }
tooltip_name = self.get_tooltip_name(test['toolchain_name'], test['target_name'], test['test_id'], test_no) tooltip_name = self.get_tooltip_name(test['toolchain_name'], test['target_name'], test['id'], test_no)
background_color = RESULT_COLORS[test['single_test_result'] if test['single_test_result'] in RESULT_COLORS else 'OTHER'] background_color = RESULT_COLORS[test['result'] if test['result'] in RESULT_COLORS else 'OTHER']
result_div_style = "background-color: %s"% background_color result_div_style = "background-color: %s"% background_color
result = """<div class="name" style="%s" onmouseover="show(%s)" onmouseout="hide(%s)"> result = """<div class="name" style="%s" onmouseover="show(%s)" onmouseout="hide(%s)">
@ -130,12 +135,12 @@ class ReportExporter():
"""% (result_div_style, """% (result_div_style,
tooltip_name, tooltip_name,
tooltip_name, tooltip_name,
test['single_test_result'], test['result'],
tooltip_name, tooltip_name,
test['target_name_unique'], test['target_name_unique'],
test['test_description'], test['description'],
test['elapsed_time'], test['elapsed_time'],
test['single_test_output'].replace('\n', '<br />')) test['output'].replace('\n', '<br />'))
return result return result
def get_result_tree(self, test_results): def get_result_tree(self, test_results):
@ -160,11 +165,11 @@ class ReportExporter():
We need this to create complete list of all test ran. We need this to create complete list of all test ran.
""" """
result = [] result = []
toolchains = test_result_ext.keys() targets = test_result_ext.keys()
for toolchain in toolchains: for target in targets:
targets = test_result_ext[toolchain].keys() toolchains = test_result_ext[target].keys()
for target in targets: for toolchain in toolchains:
tests = test_result_ext[toolchain][target].keys() tests = test_result_ext[target][toolchain].keys()
result.extend(tests) result.extend(tests)
return sorted(list(set(result))) return sorted(list(set(result)))
@ -185,15 +190,15 @@ class ReportExporter():
"""% (self.CSS_STYLE, self.JAVASCRIPT) """% (self.CSS_STYLE, self.JAVASCRIPT)
unique_test_ids = self.get_all_unique_test_ids(test_result_ext) unique_test_ids = self.get_all_unique_test_ids(test_result_ext)
toolchains = sorted(test_result_ext.keys()) targets = sorted(test_result_ext.keys())
result += '<table><tr>' result += '<table><tr>'
for toolchain in toolchains: for target in targets:
targets = sorted(test_result_ext[toolchain].keys()) toolchains = sorted(test_result_ext[target].keys())
for target in targets: for toolchain in toolchains:
result += '<td></td>' result += '<td></td>'
result += '<td></td>' result += '<td></td>'
tests = sorted(test_result_ext[toolchain][target].keys()) tests = sorted(test_result_ext[target][toolchain].keys())
for test in unique_test_ids: for test in unique_test_ids:
result += """<td align="center">%s</td>"""% test result += """<td align="center">%s</td>"""% test
result += """</tr> result += """</tr>
@ -203,7 +208,7 @@ class ReportExporter():
"""% (toolchain, target) """% (toolchain, target)
for test in unique_test_ids: for test in unique_test_ids:
test_result = self.get_result_tree(test_result_ext[toolchain][target][test]) if test in tests else '' test_result = self.get_result_tree(test_result_ext[target][toolchain][test]) if test in tests else ''
result += '<td>%s</td>'% (test_result) result += '<td>%s</td>'% (test_result)
result += '</tr>' result += '</tr>'
@ -233,6 +238,8 @@ class ReportExporter():
tc.add_failure_info(description, _stdout) tc.add_failure_info(description, _stdout)
elif result == 'ERROR': elif result == 'ERROR':
tc.add_error_info(description, _stdout) tc.add_error_info(description, _stdout)
elif result == 'SKIP':
tc.add_skipped_info(description, _stdout)
test_cases.append(tc) test_cases.append(tc)
ts = TestSuite("test.suite.ioper.%s" % (platform), test_cases) ts = TestSuite("test.suite.ioper.%s" % (platform), test_cases)
@ -246,34 +253,90 @@ class ReportExporter():
test_suites = [] test_suites = []
test_cases = [] test_cases = []
toolchains = sorted(test_result_ext.keys()) targets = sorted(test_result_ext.keys())
for toolchain in toolchains: for target in targets:
targets = sorted(test_result_ext[toolchain].keys()) toolchains = sorted(test_result_ext[target].keys())
for target in targets: for toolchain in toolchains:
test_cases = [] test_cases = []
tests = sorted(test_result_ext[toolchain][target].keys()) tests = sorted(test_result_ext[target][toolchain].keys())
for test in tests: for test in tests:
test_results = test_result_ext[toolchain][target][test] test_results = test_result_ext[target][toolchain][test]
for test_res in test_results: for test_res in test_results:
test_ids = sorted(test_res.keys()) test_ids = sorted(test_res.keys())
for test_no in test_ids: for test_no in test_ids:
test_result = test_res[test_no] test_result = test_res[test_no]
name = test_result['test_description'] name = test_result['description']
classname = 'test.%s.%s.%s'% (target, toolchain, test_result['test_id']) classname = '%s.%s.%s.%s'% (self.package, target, toolchain, test_result['id'])
elapsed_sec = test_result['elapsed_time'] elapsed_sec = test_result['elapsed_time']
_stdout = test_result['single_test_output'] _stdout = test_result['output']
_stderr = test_result['target_name_unique']
if 'target_name_unique' in test_result:
_stderr = test_result['target_name_unique']
else:
_stderr = test_result['target_name']
# Test case # Test case
tc = TestCase(name, classname, elapsed_sec, _stdout, _stderr) tc = TestCase(name, classname, elapsed_sec, _stdout, _stderr)
# Test case extra failure / error info # Test case extra failure / error info
if test_result['single_test_result'] == 'FAIL': message = test_result['result']
message = test_result['single_test_result'] if test_result['result'] == 'FAIL':
tc.add_failure_info(message, _stdout) tc.add_failure_info(message, _stdout)
elif test_result['single_test_result'] != 'OK': elif test_result['result'] == 'SKIP':
message = test_result['single_test_result'] tc.add_skipped_info(message, _stdout)
elif test_result['result'] != 'OK':
tc.add_error_info(message, _stdout) tc.add_error_info(message, _stdout)
test_cases.append(tc) test_cases.append(tc)
ts = TestSuite("test.suite.%s.%s"% (target, toolchain), test_cases, properties=test_suite_properties[target][toolchain]) ts = TestSuite("test.suite.%s.%s"% (target, toolchain), test_cases, properties=test_suite_properties[target][toolchain])
test_suites.append(ts) test_suites.append(ts)
return TestSuite.to_xml_string(test_suites) return TestSuite.to_xml_string(test_suites)
def exporter_print_helper(self, array):
for item in array:
print " * %s::%s::%s" % (item["target_name"], item["toolchain_name"], item["id"])
def exporter_print(self, test_result_ext):
""" Export test results in print format.
"""
failures = []
skips = []
successes = []
unique_test_ids = self.get_all_unique_test_ids(test_result_ext)
targets = sorted(test_result_ext.keys())
for target in targets:
toolchains = sorted(test_result_ext[target].keys())
for toolchain in toolchains:
tests = sorted(test_result_ext[target][toolchain].keys())
for test in tests:
test_runs = test_result_ext[target][toolchain][test]
for test_runner in test_runs:
#test_run = test_result_ext[target][toolchain][test][test_run_number][0]
test_run = test_runner[0]
if test_run["result"] == "FAIL":
failures.append(test_run)
elif test_run["result"] == "SKIP":
skips.append(test_run)
elif test_run["result"] == "OK":
successes.append(test_run)
else:
raise Exception("Unhandled result type: %s" % (test_run["result"]))
if successes:
print "\n\nBuild successes:"
self.exporter_print_helper(successes)
if skips:
print "\n\nBuild skips:"
self.exporter_print_helper(skips)
if failures:
print "\n\nBuild failures:"
self.exporter_print_helper(failures)
return False
else:
return True

View File

@ -34,39 +34,6 @@ import workspace_tools.hooks as hooks
#Disables multiprocessing if set to higher number than the host machine CPUs #Disables multiprocessing if set to higher number than the host machine CPUs
CPU_COUNT_MIN = 1 CPU_COUNT_MIN = 1
def print_notify(event, silent=False):
""" Default command line notification
"""
if event['type'] in ['info', 'debug']:
print event['message']
elif event['type'] == 'cc':
event['severity'] = event['severity'].title()
event['file'] = basename(event['file'])
print '[%(severity)s] %(file)s@%(line)s: %(message)s' % event
elif event['type'] == 'progress':
if not silent:
print '%s: %s' % (event['action'].title(), basename(event['file']))
def print_notify_verbose(event, silent=False):
""" Default command line notification with more verbose mode
"""
if event['type'] in ['info', 'debug']:
print_notify(event) # standard handle
elif event['type'] == 'cc':
event['severity'] = event['severity'].title()
event['file'] = basename(event['file'])
event['mcu_name'] = "None"
event['toolchain'] = "None"
event['target_name'] = event['target_name'].upper() if event['target_name'] else "Unknown"
event['toolchain_name'] = event['toolchain_name'].upper() if event['toolchain_name'] else "Unknown"
print '[%(severity)s] %(target_name)s::%(toolchain_name)s::%(file)s@%(line)s: %(message)s' % event
elif event['type'] == 'progress':
print_notify(event) # standard handle
def compile_worker(job): def compile_worker(job):
results = [] results = []
for command in job['commands']: for command in job['commands']:
@ -213,15 +180,22 @@ class mbedToolchain:
GOANNA_FORMAT = "[Goanna] warning [%FILENAME%:%LINENO%] - [%CHECKNAME%(%SEVERITY%)] %MESSAGE%" GOANNA_FORMAT = "[Goanna] warning [%FILENAME%:%LINENO%] - [%CHECKNAME%(%SEVERITY%)] %MESSAGE%"
GOANNA_DIAGNOSTIC_PATTERN = re.compile(r'"\[Goanna\] (?P<severity>warning) \[(?P<file>[^:]+):(?P<line>\d+)\] \- (?P<message>.*)"') GOANNA_DIAGNOSTIC_PATTERN = re.compile(r'"\[Goanna\] (?P<severity>warning) \[(?P<file>[^:]+):(?P<line>\d+)\] \- (?P<message>.*)"')
def __init__(self, target, options=None, notify=None, macros=None, silent=False): def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False):
self.target = target self.target = target
self.name = self.__class__.__name__ self.name = self.__class__.__name__
self.hook = hooks.Hook(target, self) self.hook = hooks.Hook(target, self)
self.silent = silent self.silent = silent
self.output = ""
self.legacy_ignore_dirs = LEGACY_IGNORE_DIRS - set([target.name, LEGACY_TOOLCHAIN_NAMES[self.name]]) self.legacy_ignore_dirs = LEGACY_IGNORE_DIRS - set([target.name, LEGACY_TOOLCHAIN_NAMES[self.name]])
self.notify_fun = notify if notify is not None else print_notify 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.options = options if options is not None else []
self.macros = macros or [] self.macros = macros or []
@ -243,6 +217,50 @@ class mbedToolchain:
self.mp_pool = None self.mp_pool = None
def get_output(self):
return self.output
def print_notify(self, event, silent=False):
""" Default command line notification
"""
msg = None
if event['type'] in ['info', 'debug']:
msg = event['message']
elif event['type'] == 'cc':
event['severity'] = event['severity'].title()
event['file'] = basename(event['file'])
msg = '[%(severity)s] %(file)s@%(line)s: %(message)s' % event
elif event['type'] == 'progress':
if not silent:
msg = '%s: %s' % (event['action'].title(), basename(event['file']))
if msg:
print msg
self.output += msg + "\n"
def print_notify_verbose(self, event, silent=False):
""" Default command line notification with more verbose mode
"""
if event['type'] in ['info', 'debug']:
self.print_notify(event) # standard handle
elif event['type'] == 'cc':
event['severity'] = event['severity'].title()
event['file'] = basename(event['file'])
event['mcu_name'] = "None"
event['toolchain'] = "None"
event['target_name'] = event['target_name'].upper() if event['target_name'] else "Unknown"
event['toolchain_name'] = event['toolchain_name'].upper() if event['toolchain_name'] else "Unknown"
msg = '[%(severity)s] %(target_name)s::%(toolchain_name)s::%(file)s@%(line)s: %(message)s' % event
print msg
self.output += msg + "\n"
elif event['type'] == 'progress':
self.print_notify(event) # standard handle
def notify(self, event): def notify(self, event):
""" Little closure for notify functions """ Little closure for notify functions
""" """
@ -393,7 +411,7 @@ class mbedToolchain:
elif ext == '.hex': elif ext == '.hex':
resources.hex_files.append(file_path) resources.hex_files.append(file_path)
elif ext == '.bin': elif ext == '.bin':
resources.bin_files.append(file_path) resources.bin_files.append(file_path)
@ -415,6 +433,7 @@ class mbedToolchain:
return resources return resources
def copy_files(self, files_paths, trg_path, rel_path=None): def copy_files(self, files_paths, trg_path, rel_path=None):
# Handle a single file # Handle a single file
if type(files_paths) != ListType: files_paths = [files_paths] if type(files_paths) != ListType: files_paths = [files_paths]
@ -596,10 +615,12 @@ class mbedToolchain:
for error_line in _stderr.splitlines(): for error_line in _stderr.splitlines():
self.debug("Output: %s"% error_line) self.debug("Output: %s"% error_line)
# Check return code # Check return code
if _rc != 0: if _rc != 0:
for line in _stderr.splitlines(): for line in _stderr.splitlines():
self.tool_error(line) self.tool_error(line)
raise ToolException(_stderr) raise ToolException(_stderr)
def compile(self, cc, source, object, includes): def compile(self, cc, source, object, includes):
@ -625,13 +646,18 @@ class mbedToolchain:
return self.compile(self.cppc, source, object, includes) return self.compile(self.cppc, source, object, includes)
def build_library(self, objects, dir, name): def build_library(self, objects, dir, name):
needed_update = False
lib = self.STD_LIB_NAME % name lib = self.STD_LIB_NAME % name
fout = join(dir, lib) fout = join(dir, lib)
if self.need_update(fout, objects): if self.need_update(fout, objects):
self.info("Library: %s" % lib) self.info("Library: %s" % lib)
self.archive(objects, fout) self.archive(objects, fout)
needed_update = True
return needed_update
def link_program(self, r, tmp_path, name): def link_program(self, r, tmp_path, name):
needed_update = False
ext = 'bin' ext = 'bin'
if hasattr(self.target, 'OUTPUT_EXT'): if hasattr(self.target, 'OUTPUT_EXT'):
ext = self.target.OUTPUT_EXT ext = self.target.OUTPUT_EXT
@ -647,10 +673,12 @@ class mbedToolchain:
bin = join(tmp_path, filename) bin = join(tmp_path, filename)
if self.need_update(elf, r.objects + r.libraries + [r.linker_script]): if self.need_update(elf, r.objects + r.libraries + [r.linker_script]):
needed_update = True
self.progress("link", name) self.progress("link", name)
self.link(elf, r.objects, r.libraries, r.lib_dirs, r.linker_script) self.link(elf, r.objects, r.libraries, r.lib_dirs, r.linker_script)
if self.need_update(bin, [elf]): if self.need_update(bin, [elf]):
needed_update = True
self.progress("elf2bin", name) self.progress("elf2bin", name)
self.binary(r, elf, bin) self.binary(r, elf, bin)
@ -658,7 +686,7 @@ class mbedToolchain:
self.var("compile_succeded", True) self.var("compile_succeded", True)
self.var("binary", filename) self.var("binary", filename)
return bin return bin, needed_update
def default_cmd(self, command): def default_cmd(self, command):
_stdout, _stderr, _rc = run_cmd(command) _stdout, _stderr, _rc = run_cmd(command)

View File

@ -30,8 +30,8 @@ class ARM(mbedToolchain):
DIAGNOSTIC_PATTERN = re.compile('"(?P<file>[^"]+)", line (?P<line>\d+)( \(column (?P<column>\d+)\)|): (?P<severity>Warning|Error): (?P<message>.+)') DIAGNOSTIC_PATTERN = re.compile('"(?P<file>[^"]+)", line (?P<line>\d+)( \(column (?P<column>\d+)\)|): (?P<severity>Warning|Error): (?P<message>.+)')
DEP_PATTERN = re.compile('\S+:\s(?P<file>.+)\n') DEP_PATTERN = re.compile('\S+:\s(?P<file>.+)\n')
def __init__(self, target, options=None, notify=None, macros=None, silent=False): def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False):
mbedToolchain.__init__(self, target, options, notify, macros, silent) mbedToolchain.__init__(self, target, options, notify, macros, silent, extra_verbose=extra_verbose)
if target.core == "Cortex-M0+": if target.core == "Cortex-M0+":
cpu = "Cortex-M0" cpu = "Cortex-M0"
@ -118,10 +118,10 @@ class ARM(mbedToolchain):
match.group('line'), match.group('line'),
match.group('message') match.group('message')
) )
def get_dep_opt(self, dep_path): def get_dep_opt(self, dep_path):
return ["--depend", dep_path] return ["--depend", dep_path]
def archive(self, objects, lib_path): def archive(self, objects, lib_path):
self.default_cmd([self.ar, '-r', lib_path] + objects) self.default_cmd([self.ar, '-r', lib_path] + objects)
@ -149,8 +149,8 @@ class ARM(mbedToolchain):
self.default_cmd(args) self.default_cmd(args)
class ARM_STD(ARM): class ARM_STD(ARM):
def __init__(self, target, options=None, notify=None, macros=None, silent=False): def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False):
ARM.__init__(self, target, options, notify, macros, silent) ARM.__init__(self, target, options, notify, macros, silent, extra_verbose=extra_verbose)
self.cc += ["-D__ASSERT_MSG"] self.cc += ["-D__ASSERT_MSG"]
self.cppc += ["-D__ASSERT_MSG"] self.cppc += ["-D__ASSERT_MSG"]
self.ld.append("--libpath=%s" % ARM_LIB) self.ld.append("--libpath=%s" % ARM_LIB)
@ -159,8 +159,8 @@ class ARM_STD(ARM):
class ARM_MICRO(ARM): class ARM_MICRO(ARM):
PATCHED_LIBRARY = False PATCHED_LIBRARY = False
def __init__(self, target, options=None, notify=None, macros=None, silent=False): def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False):
ARM.__init__(self, target, options, notify, macros, silent) ARM.__init__(self, target, options, notify, macros, silent, extra_verbose=extra_verbose)
# Compiler # Compiler
self.asm += ["-D__MICROLIB"] self.asm += ["-D__MICROLIB"]

View File

@ -30,8 +30,8 @@ class GCC(mbedToolchain):
CIRCULAR_DEPENDENCIES = True CIRCULAR_DEPENDENCIES = True
DIAGNOSTIC_PATTERN = re.compile('((?P<line>\d+):)(\d+:)? (?P<severity>warning|error): (?P<message>.+)') DIAGNOSTIC_PATTERN = re.compile('((?P<line>\d+):)(\d+:)? (?P<severity>warning|error): (?P<message>.+)')
def __init__(self, target, options=None, notify=None, macros=None, silent=False, tool_path=""): def __init__(self, target, options=None, notify=None, macros=None, silent=False, tool_path="", extra_verbose=False):
mbedToolchain.__init__(self, target, options, notify, macros, silent) mbedToolchain.__init__(self, target, options, notify, macros, silent, extra_verbose=extra_verbose)
if target.core == "Cortex-M0+": if target.core == "Cortex-M0+":
cpu = "cortex-m0plus" cpu = "cortex-m0plus"
@ -179,8 +179,8 @@ class GCC(mbedToolchain):
class GCC_ARM(GCC): class GCC_ARM(GCC):
def __init__(self, target, options=None, notify=None, macros=None, silent=False): def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False):
GCC.__init__(self, target, options, notify, macros, silent, GCC_ARM_PATH) GCC.__init__(self, target, options, notify, macros, silent, GCC_ARM_PATH, extra_verbose=extra_verbose)
# Use latest gcc nanolib # Use latest gcc nanolib
self.ld.append("--specs=nano.specs") self.ld.append("--specs=nano.specs")
@ -193,8 +193,8 @@ class GCC_ARM(GCC):
class GCC_CR(GCC): class GCC_CR(GCC):
def __init__(self, target, options=None, notify=None, macros=None, silent=False): def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False):
GCC.__init__(self, target, options, notify, macros, silent, GCC_CR_PATH) GCC.__init__(self, target, options, notify, macros, silent, GCC_CR_PATH, extra_verbose=extra_verbose)
additional_compiler_flags = [ additional_compiler_flags = [
"-D__NEWLIB__", "-D__CODE_RED", "-D__USE_CMSIS", "-DCPP_USE_HEAP", "-D__NEWLIB__", "-D__CODE_RED", "-D__USE_CMSIS", "-DCPP_USE_HEAP",
@ -210,8 +210,8 @@ class GCC_CR(GCC):
class GCC_CS(GCC): class GCC_CS(GCC):
def __init__(self, target, options=None, notify=None, macros=None, silent=False): def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False):
GCC.__init__(self, target, options, notify, macros, silent, GCC_CS_PATH) GCC.__init__(self, target, options, notify, macros, silent, GCC_CS_PATH, extra_verbose=extra_verbose)
class GCC_CW(GCC): class GCC_CW(GCC):
@ -219,13 +219,13 @@ class GCC_CW(GCC):
"Cortex-M0+": "armv6-m", "Cortex-M0+": "armv6-m",
} }
def __init__(self, target, options=None, notify=None, macros=None, silent=False): def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False):
GCC.__init__(self, target, options, notify, macros, silent, CW_GCC_PATH) GCC.__init__(self, target, options, notify, macros, silent, CW_GCC_PATH, extra_verbose=extra_verbose)
class GCC_CW_EWL(GCC_CW): class GCC_CW_EWL(GCC_CW):
def __init__(self, target, options=None, notify=None, macros=None, silent=False): def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False):
GCC_CW.__init__(self, target, options, notify, macros, silent) GCC_CW.__init__(self, target, options, notify, macros, silent, extra_verbose=extra_verbose)
# Compiler # Compiler
common = [ common = [
@ -253,5 +253,5 @@ class GCC_CW_EWL(GCC_CW):
class GCC_CW_NEWLIB(GCC_CW): class GCC_CW_NEWLIB(GCC_CW):
def __init__(self, target, options=None, notify=None, macros=None, silent=False): def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False):
GCC_CW.__init__(self, target, options, notify, macros, silent) GCC_CW.__init__(self, target, options, notify, macros, silent, extra_verbose=extra_verbose)

View File

@ -30,8 +30,8 @@ class IAR(mbedToolchain):
DIAGNOSTIC_PATTERN = re.compile('"(?P<file>[^"]+)",(?P<line>[\d]+)\s+(?P<severity>Warning|Error)(?P<message>.+)') DIAGNOSTIC_PATTERN = re.compile('"(?P<file>[^"]+)",(?P<line>[\d]+)\s+(?P<severity>Warning|Error)(?P<message>.+)')
def __init__(self, target, options=None, notify=None, macros=None, silent=False): def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False):
mbedToolchain.__init__(self, target, options, notify, macros, silent) mbedToolchain.__init__(self, target, options, notify, macros, silent, extra_verbose=extra_verbose)
c_flags = [ c_flags = [
"--cpu=%s" % target.core, "--thumb", "--cpu=%s" % target.core, "--thumb",
@ -94,7 +94,7 @@ class IAR(mbedToolchain):
def parse_dependencies(self, dep_path): def parse_dependencies(self, dep_path):
return [path.strip() for path in open(dep_path).readlines() return [path.strip() for path in open(dep_path).readlines()
if (path and not path.isspace())] if (path and not path.isspace())]
def assemble(self, source, object, includes): def assemble(self, source, object, includes):
return [self.hook.get_cmdline_assembler(self.asm + ['-D%s' % s for s in self.get_symbols() + self.macros] + ["-I%s" % i for i in includes] + ["-o", object, source])] return [self.hook.get_cmdline_assembler(self.asm + ['-D%s' % s for s in self.get_symbols() + self.macros] + ["-I%s" % i for i in includes] + ["-o", object, source])]