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

View File

@ -16,7 +16,8 @@
#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_MOSI_PIN 15u /**< SPI Master Out Slave In 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_us(3);
}
/* No init flash in this version, 2015/10/27 */
#endif
void mbed_sdk_init()
{
@ -115,9 +118,11 @@ void mbed_sdk_init()
{// Do nothing.
}
flash_init();
//nrf_delay_ms(10);
flash_powerDown();
/* No init flash in this version, 2015/10/27 */
// flash_init();
//
// //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;
}
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.
*/
void gpiote_init(PinName pin, uint8_t channel_number)
@ -154,6 +167,14 @@ void gpiote_init(PinName pin, uint8_t channel_number)
__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.
*/
static void ppi_init(uint8_t pwm)
@ -173,6 +194,16 @@ static void ppi_init(uint8_t pwm)
(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)
{
if (high) {
@ -239,11 +270,13 @@ void pwmout_init(pwmout_t *obj, PinName pin)
pwmout_write (obj, 0);
}
void pwmout_free(pwmout_t *obj)
{
void pwmout_free(pwmout_t* obj) {
MBED_ASSERT(obj->pwm != (PWMName)NC);
PWM_taken[obj->pwm] = 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)

View File

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

View File

@ -23,6 +23,7 @@ import colorama
from types import ListType
from shutil import rmtree
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.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
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,
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
"""
# 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.jobs = jobs
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
# multiple compilations and linking with the same objects
src_paths = [src_paths[0]] + list(set(src_paths[1:]))
PROJECT_BASENAME = basename(src_paths[0])
if name is None:
@ -59,6 +100,19 @@ def build_project(src_path, build_path, target, toolchain_name,
# 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))
if report != None:
start = time()
id_name = project_id.upper()
description = project_description
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)
try:
# Scan src_path and libraries_paths for resources
resources = toolchain.scan_resources(src_paths[0])
for path in src_paths[1:]:
@ -91,12 +145,40 @@ def build_project(src_path, build_path, target, toolchain_name,
resources.objects.extend(objects)
# 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,
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
build_path: the path of the build directory
target: ['LPC1768', 'LPC11U24', 'LPC2368']
@ -111,18 +193,38 @@ def build_library(src_paths, build_path, target, toolchain_name,
if type(src_paths) != ListType:
src_paths = [src_paths]
# The first path will give the name to the library
name = basename(src_paths[0])
if report != None:
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:
if not exists(src_path):
raise Exception("The library source folder does not exist: %s", src_path)
error_msg = "The library source folder does not exist: %s", src_path
if report != None:
cur_result["output"] = error_msg
cur_result["result"] = "FAIL"
add_result_to_report(report, cur_result)
raise Exception(error_msg)
try:
# Toolchain instance
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, macros=macros, notify=notify, silent=silent)
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
# The first path will give the name to the library
name = basename(src_paths[0])
toolchain.info("Building library %s (%s, %s)" % (name.upper(), target.name, toolchain_name))
# Scan Resources
@ -163,10 +265,34 @@ def build_library(src_paths, build_path, target, toolchain_name,
for resource in resources:
objects.extend(toolchain.compile_sources(resource, tmp_path, dependencies_include_dir))
toolchain.build_library(objects, bin_path, name)
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"
def build_lib(lib_id, target, toolchain, options=None, verbose=False, clean=False, macros=None, notify=None, jobs=1, silent=False):
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.
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:
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,
silent=silent,
clean=clean,
@ -185,23 +311,45 @@ def build_lib(lib_id, target, toolchain, options=None, verbose=False, clean=Fals
notify=notify,
inc_dirs=lib.inc_dirs,
inc_dirs_ext=lib.inc_dirs_ext,
jobs=jobs)
jobs=jobs,
report=report,
properties=properties,
extra_verbose=extra_verbose)
else:
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
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 """
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
if toolchain_name not in 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 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
try:
# Toolchain
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, macros=macros, notify=notify, silent=silent)
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
@ -251,17 +399,46 @@ def build_mbed_libs(target, toolchain_name, options=None, verbose=False, clean=F
# - board.o: mbed_die is weak
# - mbed_overrides.o: this contains platform overrides of various weak SDK functions
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")
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():
""" 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
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_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.jobs = jobs
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,
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)
if lib.is_supported(target, toolchain):
static_analysis_scan_library(lib.source_dir, lib.build_dir, target, toolchain, cppcheck_cmd, cppcheck_msg_format,
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:
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,
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 """
if type(src_paths) != ListType:
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)
# 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.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 write_build_report
from workspace_tools.targets import TARGET_MAP
from workspace_tools.test_exporters import ReportExporter, ResultExporterType
OFFICIAL_MBED_LIBRARY_BUILD = (
('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("", "--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()
start = time()
failures = []
successes = []
skips = []
build_report = []
report = {}
properties = {}
platforms = None
if options.platforms != "":
@ -171,46 +170,24 @@ if __name__ == '__main__':
toolchainSet = set(toolchains)
toolchains = toolchainSet and set((options.toolchains).split(','))
cur_target_build_report = { "target": target_name, "passing": [], "failing": [], "skipped": []}
for toolchain in toolchains:
id = "%s::%s" % (target_name, toolchain)
try:
built_mbed_lib = build_mbed_libs(TARGET_MAP[target_name], toolchain, verbose=options.verbose, jobs=options.jobs)
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 })
built_mbed_lib = build_mbed_libs(TARGET_MAP[target_name], toolchain, verbose=options.verbose, jobs=options.jobs, report=report, properties=properties)
except Exception, e:
failures.append(id)
cur_target_build_report["failing"].append({ "toolchain": toolchain })
print e
if len(toolchains) > 0:
build_report.append(cur_target_build_report)
print str(e)
# Write summary of the builds
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)
if successes:
print "\n\nBuild successes:"
print "\n".join([" * %s" % s for s in successes])
print_report_exporter = ReportExporter(ResultExporterType.PRINT, package="build")
status = print_report_exporter.report(report)
if skips:
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])
if not status:
sys.exit(1)

View File

@ -38,6 +38,7 @@ build_list = (
{ "target": "NUCLEO_L053R8", "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_F031K6", "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_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_F401RE", "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_F411RE", "toolchains": "GCC_ARM", "libs": ["dsp", "rtos"] },
@ -81,12 +87,25 @@ build_list = (
{ "target": "ARCH_PRO", "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": "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": "EFM32HG_STK3400", "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": "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>
</BeforeMake>
<AfterMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg1>1</RunUserProg1>
<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>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>

View File

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

View File

@ -74,9 +74,9 @@
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
</BeforeMake>
<AfterMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg1>1</RunUserProg1>
<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>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>

View File

@ -74,9 +74,9 @@
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
</BeforeMake>
<AfterMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg1>1</RunUserProg1>
<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>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>

View File

@ -74,7 +74,7 @@
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
</BeforeMake>
<AfterMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg1>1</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name>fromelf --bin -o build\{{name}}_NUCLEO_F334R8.bin build\{{name}}.axf</UserProg1Name>
<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 get_target_supported_toolchains
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.toolchains import TOOLCHAIN_BIN_PATH
from workspace_tools.test_exporters import ReportExporter, ResultExporterType
@ -188,11 +191,6 @@ class SingleTestRunner(object):
from colorama import init
init()
# Build results
build_failures = []
build_successes = []
build_skipped = []
PATTERN = "\\{(" + "|".join(self.TEST_RESULT_MAPPING.keys()) + ")\\}"
self.RE_DETECT_TESTCASE_RESULT = re.compile(PATTERN)
# Settings related to test loops counters
@ -310,19 +308,10 @@ class SingleTestRunner(object):
test_summary_ext = {}
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:
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
# Test suite properties returned to external tools like CI
test_suite_properties = {
@ -352,17 +341,15 @@ class SingleTestRunner(object):
options=build_mbed_libs_options,
clean=clean_mbed_libs_options,
verbose=self.opts_verbose,
jobs=self.opts_jobs)
jobs=self.opts_jobs,
report=build_report,
properties=build_properties)
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))
continue
else:
self.build_successes.append(tt_id)
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))
continue
@ -401,15 +388,15 @@ class SingleTestRunner(object):
# First pass through all tests and determine which libraries need to be built
libraries = set()
libraries = []
for test_id in valid_test_map_keys:
test = TEST_MAP[test_id]
# Detect which lib should be added to test
# Some libs have to compiled like RTOS or ETH
for lib in LIBRARIES:
if lib['build_dir'] in test.dependencies:
libraries.add(lib['id'])
if lib['build_dir'] in test.dependencies and lib['build_dir'] not in libraries:
libraries.append(lib['id'])
build_project_options = ["analyze"] if self.opts_goanna_for_tests else None
@ -424,14 +411,12 @@ class SingleTestRunner(object):
options=build_project_options,
verbose=self.opts_verbose,
clean=clean_mbed_libs_options,
jobs=self.opts_jobs)
build_report[toolchain]["library_build_passing"].append(lib_id)
jobs=self.opts_jobs,
report=build_report,
properties=build_properties)
except ToolException:
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
@ -456,10 +441,10 @@ class SingleTestRunner(object):
MACROS.append('TEST_SUITE_UUID="%s"'% str(test_uuid))
# Prepare extended test results data structure (it can be used to generate detailed test report)
if toolchain not in self.test_summary_ext:
self.test_summary_ext[toolchain] = {} # test_summary_ext : toolchain
if target not in self.test_summary_ext[toolchain]:
self.test_summary_ext[toolchain][target] = {} # test_summary_ext : toolchain : target
if target not in self.test_summary_ext:
self.test_summary_ext[target] = {} # test_summary_ext : toolchain
if toolchain not in self.test_summary_ext[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
@ -476,14 +461,15 @@ class SingleTestRunner(object):
name=project_name,
macros=MACROS,
inc_dirs=INC_DIRS,
jobs=self.opts_jobs)
build_report[toolchain]["test_build_passing"].append(test_id)
jobs=self.opts_jobs,
report=build_report,
properties=build_properties,
project_id=test_id,
project_description=test.get_description())
except ToolException:
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))
build_report[toolchain]["test_build_failing"].append(test_id)
self.build_failures.append(tt_test_id)
# Append test results to global test summary
self.test_summary.append(
@ -491,17 +477,17 @@ class SingleTestRunner(object):
)
# Add detailed test result to test summary structure
if test_id not in self.test_summary_ext[toolchain][target]:
self.test_summary_ext[toolchain][target][test_id] = []
if test_id not in self.test_summary_ext[target][toolchain]:
self.test_summary_ext[target][toolchain][test_id] = []
self.test_summary_ext[toolchain][target][test_id].append({ 0: {
'single_test_result' : self.TEST_RESULT_BUILD_FAILED,
'single_test_output' : '',
self.test_summary_ext[target][toolchain][test_id].append({ 0: {
'result' : self.TEST_RESULT_BUILD_FAILED,
'output' : '',
'target_name' : target,
'target_name_unique': target,
'toolchain_name' : toolchain,
'test_id' : test_id,
'test_description' : 'Toolchain build failed',
'id' : test_id,
'description' : 'Toolchain build failed',
'elapsed_time' : 0,
'duration' : 0,
'copy_method' : None
@ -543,9 +529,9 @@ class SingleTestRunner(object):
self.test_summary.append(single_test_result)
# Add detailed test result to test summary structure
if target not in self.test_summary_ext[toolchain][target]:
if test_id not in self.test_summary_ext[toolchain][target]:
self.test_summary_ext[toolchain][target][test_id] = []
if target not in self.test_summary_ext[target][toolchain]:
if test_id not in self.test_summary_ext[target][toolchain]:
self.test_summary_ext[target][toolchain][test_id] = []
append_test_result = detailed_test_results
@ -554,7 +540,7 @@ class SingleTestRunner(object):
if self.opts_waterfall_test and self.opts_consolidate_waterfall_test:
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'])
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():
self.shuffle_random_seed = round(float(self.opts_shuffle_test_seed), self.SHUFFLE_SEED_ROUND)
build_reports = []
self.build_failures = []
self.build_successes = []
self.build_skipped = []
build_report = {}
build_properties = {}
if self.opts_parallel_test_exec:
###################################################################
@ -589,9 +573,7 @@ class SingleTestRunner(object):
# get information about available MUTs (per target).
for target, toolchains in self.test_spec['targets'].iteritems():
self.test_suite_properties_ext[target] = {}
cur_build_report = {}
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 = threading.Thread(target=self.execute_thread_slice, args = (q, target, toolchains, clean, test_ids, build_report, build_properties))
t.daemon = True
t.start()
execute_threads.append(t)
@ -604,63 +586,16 @@ class SingleTestRunner(object):
if target not in self.test_suite_properties_ext:
self.test_suite_properties_ext[target] = {}
cur_build_report = {}
self.execute_thread_slice(q, target, toolchains, clean, test_ids, cur_build_report)
build_reports.append({ "target": target, "report": cur_build_report})
self.execute_thread_slice(q, target, toolchains, clean, test_ids, build_report, build_properties)
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:
self.db_logger.reconnect();
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.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):
valid_test_map_keys = []
@ -945,13 +880,13 @@ class SingleTestRunner(object):
elapsed_time = single_testduration # TIme of single test case execution after reset
detailed_test_results[test_index] = {
'single_test_result' : single_test_result,
'single_test_output' : single_test_output,
'result' : single_test_result,
'output' : single_test_output,
'target_name' : target_name,
'target_name_unique' : target_name_unique,
'toolchain_name' : toolchain_name,
'test_id' : test_id,
'test_description' : test_description,
'id' : test_id,
'description' : test_description,
'elapsed_time' : round(elapsed_time, 2),
'duration' : single_timeout,
'copy_method' : _copy_method,
@ -1523,7 +1458,7 @@ def singletest_in_cli_mode(single_test):
"""
start = time()
# 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
# Human readable summary
@ -1539,12 +1474,8 @@ def singletest_in_cli_mode(single_test):
print
# Write summary of the builds
for report, report_name in [(single_test.build_successes, "Build successes:"),
(single_test.build_skipped, "Build skipped:"),
(single_test.build_failures, "Build failures:"),
]:
if report:
print print_build_results(report, report_name)
print_report_exporter = ReportExporter(ResultExporterType.PRINT, package="build")
status = print_report_exporter.report(build_report)
# Store extra reports in files
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)
if single_test.opts_report_build_file_name:
# 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
return len(single_test.build_failures) == 0
return status
class TestLogger():
""" 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",
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',
dest='verbose_skipped_tests',

View File

@ -23,7 +23,8 @@ from workspace_tools.utils import construct_enum
ResultExporterType = construct_enum(HTML='Html_Exporter',
JUNIT='JUnit_Exporter',
JUNIT_OPER='JUnit_Exporter_Interoperability',
BUILD='Build_Exporter')
BUILD='Build_Exporter',
PRINT='Print_Exporter')
class ReportExporter():
@ -35,11 +36,11 @@ class ReportExporter():
u'uARM': { u'LPC1768': { 'MBED_2': { 0: { 'copy_method': 'shutils.copy()',
'duration': 20,
'elapsed_time': 1.7929999828338623,
'single_test_output': 'Host test instrumentation on ...\r\n',
'single_test_result': 'OK',
'output': 'Host test instrumentation on ...\r\n',
'result': 'OK',
'target_name': u'LPC1768',
'test_description': 'stdio',
'test_id': u'MBED_2',
'description': 'stdio',
'id': u'MBED_2',
'toolchain_name': u'uARM'}},
"""
CSS_STYLE = """<style>
@ -67,8 +68,9 @@ class ReportExporter():
</script>
"""
def __init__(self, result_exporter_type):
def __init__(self, result_exporter_type, package="test"):
self.result_exporter_type = result_exporter_type
self.package = package
def report(self, test_summary_ext, test_suite_properties=None):
""" Invokes report depending on exporter_type set in constructor
@ -82,6 +84,9 @@ class ReportExporter():
elif self.result_exporter_type == ResultExporterType.JUNIT_OPER:
# JUNIT exporter for interoperability test
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
def report_to_file(self, test_summary_ext, file_name, test_suite_properties=None):
@ -111,8 +116,8 @@ class ReportExporter():
'OTHER': 'LightGray',
}
tooltip_name = self.get_tooltip_name(test['toolchain_name'], test['target_name'], test['test_id'], test_no)
background_color = RESULT_COLORS[test['single_test_result'] if test['single_test_result'] in RESULT_COLORS else 'OTHER']
tooltip_name = self.get_tooltip_name(test['toolchain_name'], test['target_name'], test['id'], test_no)
background_color = RESULT_COLORS[test['result'] if test['result'] in RESULT_COLORS else 'OTHER']
result_div_style = "background-color: %s"% background_color
result = """<div class="name" style="%s" onmouseover="show(%s)" onmouseout="hide(%s)">
@ -130,12 +135,12 @@ class ReportExporter():
"""% (result_div_style,
tooltip_name,
tooltip_name,
test['single_test_result'],
test['result'],
tooltip_name,
test['target_name_unique'],
test['test_description'],
test['description'],
test['elapsed_time'],
test['single_test_output'].replace('\n', '<br />'))
test['output'].replace('\n', '<br />'))
return result
def get_result_tree(self, test_results):
@ -160,11 +165,11 @@ class ReportExporter():
We need this to create complete list of all test ran.
"""
result = []
toolchains = test_result_ext.keys()
for toolchain in toolchains:
targets = test_result_ext[toolchain].keys()
targets = test_result_ext.keys()
for target in targets:
tests = test_result_ext[toolchain][target].keys()
toolchains = test_result_ext[target].keys()
for toolchain in toolchains:
tests = test_result_ext[target][toolchain].keys()
result.extend(tests)
return sorted(list(set(result)))
@ -185,15 +190,15 @@ class ReportExporter():
"""% (self.CSS_STYLE, self.JAVASCRIPT)
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>'
for toolchain in toolchains:
targets = sorted(test_result_ext[toolchain].keys())
for target in targets:
toolchains = sorted(test_result_ext[target].keys())
for toolchain in toolchains:
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:
result += """<td align="center">%s</td>"""% test
result += """</tr>
@ -203,7 +208,7 @@ class ReportExporter():
"""% (toolchain, target)
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 += '</tr>'
@ -233,6 +238,8 @@ class ReportExporter():
tc.add_failure_info(description, _stdout)
elif result == 'ERROR':
tc.add_error_info(description, _stdout)
elif result == 'SKIP':
tc.add_skipped_info(description, _stdout)
test_cases.append(tc)
ts = TestSuite("test.suite.ioper.%s" % (platform), test_cases)
@ -246,34 +253,90 @@ class ReportExporter():
test_suites = []
test_cases = []
toolchains = sorted(test_result_ext.keys())
for toolchain in toolchains:
targets = sorted(test_result_ext[toolchain].keys())
targets = sorted(test_result_ext.keys())
for target in targets:
toolchains = sorted(test_result_ext[target].keys())
for toolchain in toolchains:
test_cases = []
tests = sorted(test_result_ext[toolchain][target].keys())
tests = sorted(test_result_ext[target][toolchain].keys())
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:
test_ids = sorted(test_res.keys())
for test_no in test_ids:
test_result = test_res[test_no]
name = test_result['test_description']
classname = 'test.%s.%s.%s'% (target, toolchain, test_result['test_id'])
name = test_result['description']
classname = '%s.%s.%s.%s'% (self.package, target, toolchain, test_result['id'])
elapsed_sec = test_result['elapsed_time']
_stdout = test_result['single_test_output']
_stdout = test_result['output']
if 'target_name_unique' in test_result:
_stderr = test_result['target_name_unique']
else:
_stderr = test_result['target_name']
# Test case
tc = TestCase(name, classname, elapsed_sec, _stdout, _stderr)
# Test case extra failure / error info
if test_result['single_test_result'] == 'FAIL':
message = test_result['single_test_result']
message = test_result['result']
if test_result['result'] == 'FAIL':
tc.add_failure_info(message, _stdout)
elif test_result['single_test_result'] != 'OK':
message = test_result['single_test_result']
elif test_result['result'] == 'SKIP':
tc.add_skipped_info(message, _stdout)
elif test_result['result'] != 'OK':
tc.add_error_info(message, _stdout)
test_cases.append(tc)
ts = TestSuite("test.suite.%s.%s"% (target, toolchain), test_cases, properties=test_suite_properties[target][toolchain])
test_suites.append(ts)
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
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):
results = []
for command in job['commands']:
@ -213,15 +180,22 @@ class mbedToolchain:
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>.*)"')
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.name = self.__class__.__name__
self.hook = hooks.Hook(target, self)
self.silent = silent
self.output = ""
self.legacy_ignore_dirs = LEGACY_IGNORE_DIRS - set([target.name, LEGACY_TOOLCHAIN_NAMES[self.name]])
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.macros = macros or []
@ -243,6 +217,50 @@ class mbedToolchain:
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):
""" Little closure for notify functions
"""
@ -415,6 +433,7 @@ class mbedToolchain:
return resources
def copy_files(self, files_paths, trg_path, rel_path=None):
# Handle a single file
if type(files_paths) != ListType: files_paths = [files_paths]
@ -596,10 +615,12 @@ class mbedToolchain:
for error_line in _stderr.splitlines():
self.debug("Output: %s"% error_line)
# Check return code
if _rc != 0:
for line in _stderr.splitlines():
self.tool_error(line)
raise ToolException(_stderr)
def compile(self, cc, source, object, includes):
@ -625,13 +646,18 @@ class mbedToolchain:
return self.compile(self.cppc, source, object, includes)
def build_library(self, objects, dir, name):
needed_update = False
lib = self.STD_LIB_NAME % name
fout = join(dir, lib)
if self.need_update(fout, objects):
self.info("Library: %s" % lib)
self.archive(objects, fout)
needed_update = True
return needed_update
def link_program(self, r, tmp_path, name):
needed_update = False
ext = 'bin'
if hasattr(self.target, 'OUTPUT_EXT'):
ext = self.target.OUTPUT_EXT
@ -647,10 +673,12 @@ class mbedToolchain:
bin = join(tmp_path, filename)
if self.need_update(elf, r.objects + r.libraries + [r.linker_script]):
needed_update = True
self.progress("link", name)
self.link(elf, r.objects, r.libraries, r.lib_dirs, r.linker_script)
if self.need_update(bin, [elf]):
needed_update = True
self.progress("elf2bin", name)
self.binary(r, elf, bin)
@ -658,7 +686,7 @@ class mbedToolchain:
self.var("compile_succeded", True)
self.var("binary", filename)
return bin
return bin, needed_update
def default_cmd(self, 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>.+)')
DEP_PATTERN = re.compile('\S+:\s(?P<file>.+)\n')
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
mbedToolchain.__init__(self, target, options, notify, macros, silent)
def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False):
mbedToolchain.__init__(self, target, options, notify, macros, silent, extra_verbose=extra_verbose)
if target.core == "Cortex-M0+":
cpu = "Cortex-M0"
@ -149,8 +149,8 @@ class ARM(mbedToolchain):
self.default_cmd(args)
class ARM_STD(ARM):
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
ARM.__init__(self, target, options, notify, macros, silent)
def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False):
ARM.__init__(self, target, options, notify, macros, silent, extra_verbose=extra_verbose)
self.cc += ["-D__ASSERT_MSG"]
self.cppc += ["-D__ASSERT_MSG"]
self.ld.append("--libpath=%s" % ARM_LIB)
@ -159,8 +159,8 @@ class ARM_STD(ARM):
class ARM_MICRO(ARM):
PATCHED_LIBRARY = False
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
ARM.__init__(self, target, options, notify, macros, silent)
def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False):
ARM.__init__(self, target, options, notify, macros, silent, extra_verbose=extra_verbose)
# Compiler
self.asm += ["-D__MICROLIB"]

View File

@ -30,8 +30,8 @@ class GCC(mbedToolchain):
CIRCULAR_DEPENDENCIES = True
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=""):
mbedToolchain.__init__(self, target, options, notify, macros, silent)
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, extra_verbose=extra_verbose)
if target.core == "Cortex-M0+":
cpu = "cortex-m0plus"
@ -179,8 +179,8 @@ class GCC(mbedToolchain):
class GCC_ARM(GCC):
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
GCC.__init__(self, target, options, notify, macros, silent, GCC_ARM_PATH)
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, extra_verbose=extra_verbose)
# Use latest gcc nanolib
self.ld.append("--specs=nano.specs")
@ -193,8 +193,8 @@ class GCC_ARM(GCC):
class GCC_CR(GCC):
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
GCC.__init__(self, target, options, notify, macros, silent, GCC_CR_PATH)
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, extra_verbose=extra_verbose)
additional_compiler_flags = [
"-D__NEWLIB__", "-D__CODE_RED", "-D__USE_CMSIS", "-DCPP_USE_HEAP",
@ -210,8 +210,8 @@ class GCC_CR(GCC):
class GCC_CS(GCC):
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
GCC.__init__(self, target, options, notify, macros, silent, GCC_CS_PATH)
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, extra_verbose=extra_verbose)
class GCC_CW(GCC):
@ -219,13 +219,13 @@ class GCC_CW(GCC):
"Cortex-M0+": "armv6-m",
}
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
GCC.__init__(self, target, options, notify, macros, silent, CW_GCC_PATH)
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, extra_verbose=extra_verbose)
class GCC_CW_EWL(GCC_CW):
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
GCC_CW.__init__(self, target, options, notify, macros, silent)
def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False):
GCC_CW.__init__(self, target, options, notify, macros, silent, extra_verbose=extra_verbose)
# Compiler
common = [
@ -253,5 +253,5 @@ class GCC_CW_EWL(GCC_CW):
class GCC_CW_NEWLIB(GCC_CW):
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
GCC_CW.__init__(self, target, options, notify, macros, silent)
def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False):
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>.+)')
def __init__(self, target, options=None, notify=None, macros=None, silent=False):
mbedToolchain.__init__(self, target, options, notify, macros, silent)
def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False):
mbedToolchain.__init__(self, target, options, notify, macros, silent, extra_verbose=extra_verbose)
c_flags = [
"--cpu=%s" % target.core, "--thumb",