def setup_project(mcu, ide, program=None, source_dir=None, build=None):

    # Some libraries have extra macros (called by exporter symbols) to we need to pass
    # them to maintain compilation macros integrity between compiled library and
    # header files we might use with it
    if source_dir:
        # --source is used to generate IDE files to toolchain directly in the source tree and doesn't generate zip file
        project_dir = source_dir
        project_name = TESTS[program] if program else "Unnamed_Project"
        project_temp = join(source_dir[0], 'projectfiles', '%s_%s' % (ide, mcu))
        mkdir(project_temp)
    else:
        test = get_test(program)
        if not build:
            # Substitute the library builds with the sources
            # TODO: Substitute also the other library build paths
            if MBED_LIBRARIES in test.dependencies:
                test.dependencies.remove(MBED_LIBRARIES)
                test.dependencies.append(MBED_BASE)

        # Build the project with the same directory structure of the mbed online IDE
        project_name = test.id
        project_dir = [join(EXPORT_WORKSPACE, project_name)]
        project_temp = EXPORT_TMP
        setup_user_prj(project_dir[0], test.source_dir, test.dependencies)

    return project_dir, project_name, project_temp
Exemple #2
0
def setup_project(mcu, ide, program=None, source_dir=None, build=None):

    # Some libraries have extra macros (called by exporter symbols) to we need to pass
    # them to maintain compilation macros integrity between compiled library and
    # header files we might use with it
    if source_dir:
        # --source is used to generate IDE files to toolchain directly in the source tree and doesn't generate zip file
        project_dir = source_dir
        project_name = TESTS[program] if program else "Unnamed_Project"
        project_temp = join(source_dir[0], 'projectfiles',
                            '%s_%s' % (ide, mcu))
        mkdir(project_temp)
    else:
        test = get_test(program)
        if not build:
            # Substitute the library builds with the sources
            # TODO: Substitute also the other library build paths
            if MBED_LIBRARIES in test.dependencies:
                test.dependencies.remove(MBED_LIBRARIES)
                test.dependencies.append(MBED_BASE)

        # Build the project with the same directory structure of the mbed online IDE
        project_name = test.id
        project_dir = [join(EXPORT_WORKSPACE, project_name)]
        project_temp = EXPORT_TMP
        setup_user_prj(project_dir[0], test.source_dir, test.dependencies)

    return project_dir, project_name, project_temp
Exemple #3
0
def setup_test_user_prj():
    if exists(USER_PRJ):
        print 'Test user project already generated...'
        return

    setup_user_prj(USER_PRJ, join(TEST_DIR, "rtos", "mbed", "basic"), [join(ROOT, "rtos"), join(LIB_DIR, "tests", "mbed", "env")])

    # FAKE BUILD URL
    open(join(USER_SRC, "mbed.bld"), 'w').write("http://mbed.org/users/mbed_official/code/mbed/builds/976df7c37ad5\n")
Exemple #4
0
def setup_test_user_prj():
    if exists(USER_PRJ):
        print 'Test user project already generated...'
        return

    setup_user_prj(USER_PRJ, join(TEST_DIR, "rtos", "mbed", "basic"), [join(LIB_DIR, "rtos"), join(LIB_DIR, "tests", "mbed", "env")])

    # FAKE BUILD URL
    open(join(USER_SRC, "mbed.bld"), 'w').write("http://mbed.org/users/mbed_official/code/mbed/builds/976df7c37ad5\n")
Exemple #5
0
                    lib_macros = lib.get('macros', None)
                    if lib_macros is not None:
                        lib_symbols.extend(lib_macros)

            if not options.build:
                # Substitute the library builds with the sources
                # TODO: Substitute also the other library build paths
                if MBED_LIBRARIES in test.dependencies:
                    test.dependencies.remove(MBED_LIBRARIES)
                    test.dependencies.append(MBED_BASE)

            # Build the project with the same directory structure of the mbed online IDE
            project_name = test.id
            project_dir = join(EXPORT_WORKSPACE, project_name)
            project_temp = EXPORT_TMP
            setup_user_prj(project_dir, test.source_dir, test.dependencies)

        # Export to selected toolchain
        tmp_path, report = export(project_dir, project_name, ide, mcu, project_dir, project_temp, clean=clean, zip=zip, extra_symbols=lib_symbols, relative=sources_relative)
        if report['success']:
            zip_path = join(EXPORT_DIR, "%s_%s_%s.zip" % (project_name, ide, mcu))
            if zip:
                move(tmp_path, zip_path)
            successes.append("%s::%s\t%s"% (mcu, ide, zip_path))
        else:
            failures.append("%s::%s\t%s"% (mcu, ide, report['errormsg']))

    # Prints export results
    print
    if len(successes) > 0:
        print "Successful exports:"
Exemple #6
0
                    lib_macros = lib.get('macros', None)
                    if lib_macros is not None:
                        lib_symbols.extend(lib_macros)

            if not options.build:
                # Substitute the library builds with the sources
                # TODO: Substitute also the other library build paths
                if MBED_LIBRARIES in test.dependencies:
                    test.dependencies.remove(MBED_LIBRARIES)
                    test.dependencies.append(MBED_BASE)

            # Build the project with the same directory structure of the mbed online IDE
            project_name = test.id
            project_dir = [join(EXPORT_WORKSPACE, project_name)]
            project_temp = EXPORT_TMP
            setup_user_prj(project_dir[0], test.source_dir, test.dependencies)

        # Export to selected toolchain
        tmp_path, report = export(project_dir, project_name, ide, mcu, project_dir[0], project_temp, clean=clean, zip=zip, extra_symbols=lib_symbols, relative=sources_relative)
        if report['success']:
            zip_path = join(EXPORT_DIR, "%s_%s_%s.zip" % (project_name, ide, mcu))
            if zip:
                move(tmp_path, zip_path)
            successes.append("%s::%s\t%s"% (mcu, ide, zip_path))
        else:
            failures.append("%s::%s\t%s"% (mcu, ide, report['errormsg']))

    # Prints export results
    print
    if len(successes) > 0:
        print "Successful exports:"