def system_build(system, configuration): inc_path_args = ['-I%s' % i for i in system.include_paths] if len(system.c_files) == 0: raise SystemBuildError("Zero C files in system definition") shared_args = ['-shared', '-fPIC', '-std=c90'] if configuration['output_type'] == 'shared-library' else [] execute(['gcc', '-o', system.output_file, '-Wall', '-Werror'] + shared_args + inc_path_args + system.c_files)
def system_build(system, configuration): inc_path_args = ['-I%s' % i for i in system.include_paths + [os.path.dirname(os.path.abspath(__file__))]] if len(system.c_files) == 0: raise SystemBuildError("Zero C files in system definition") shared_args = ['-shared', '-fPIC'] if configuration['output_type'] == 'shared-library' else [] execute('gcc -std=c90 -Werror -Wall --all-warnings -Wpedantic -pedantic -o'.split() + [system.output_file] + shared_args + inc_path_args + system.c_files)
def system_build(system, configuration): inc_path_args = ['-I%s' % i for i in system.include_paths] if len(system.c_files) == 0: raise SystemBuildError("Zero C files in system definition") shared_args = [ '-shared', '-fPIC', '-std=c90' ] if configuration['output_type'] == 'shared-library' else [] execute(['gcc', '-o', system.output_file, '-Wall', '-Werror'] + shared_args + inc_path_args + system.c_files)
def system_build(output_file, modules, include_paths=None): if include_paths is None: include_paths = [] inc_path_args = ['-I%s' % i for i in include_paths] c_files = [] for mod in modules: c_files.extend(mod.c_files()) if not c_files: raise SystemBuildError("Zero C files in system definition") execute(['gcc', '-o', output_file, '-Wall'] + inc_path_args + c_files)
def system_build(output_file, modules, include_paths=None): if include_paths is None: include_paths = [] inc_path_args = ["-I%s" % i for i in include_paths] c_files = [] for m in modules: c_files.extend(m.c_files()) if len(c_files) == 0: raise SystemBuildError("Zero C files in system definition") execute(["gcc", "-o", output_file, "-Wall"] + inc_path_args + c_files)
def system_build(system, configuration): inc_path_args = [ '-I%s' % i for i in system.include_paths + [os.path.dirname(os.path.abspath(__file__))] ] if len(system.c_files) == 0: raise SystemBuildError("Zero C files in system definition") shared_args = [ '-shared', '-fPIC' ] if configuration['output_type'] == 'shared-library' else [] execute('gcc -std=c90 -Werror -Wall --all-warnings -Wpedantic -pedantic -o' .split() + [system.output_file] + shared_args + inc_path_args + system.c_files)
def system_build(system, configuration): inc_path_args = ['-I%s' % i for i in system.include_paths] if not system.c_files: raise SystemBuildError("Zero C files in system definition") if configuration['output_type'] == 'shared-library': shared_args = ['-shared'] if sys.platform != 'win32': shared_args.append('-fPIC') else: shared_args = [] execute([ 'gcc', '-o', system.output_file, '-Wall', '-Werror', '-std=c90', '-D_DEFAULT_SOURCE', '-D_POSIX_C_SOURCE' ] + shared_args + inc_path_args + system.c_files)
def system_build(system, configuration): inc_path_args = [ '-I%s' % i for i in system.include_paths + [os.path.dirname(os.path.abspath(__file__))] ] if len(system.c_files) == 0: raise SystemBuildError("Zero C files in system definition") shared_args = [ '-shared', '-fPIC' ] if configuration['output_type'] == 'shared-library' else [] execute( 'gcc -std=c90 -Werror -Wall --all-warnings -Wpedantic -pedantic -Wextra -O -Winit-self -Wswitch-default \ -Wswitch-enum -fstrict-aliasing -fstrict-overflow -Wstrict-overflow=5 -Wundef -Wbad-function-cast -Wcast-qual \ -Wcast-align -Wwrite-strings -Wjump-misses-init -Wlogical-op -Waggregate-return -Wstrict-prototypes \ -Wmissing-prototypes -Wmissing-declarations -Wpacked -Wredundant-decls -o'. split() + [system.output_file] + shared_args + inc_path_args + system.c_files)
def system_build(system): inc_path_args = ['-I%s' % i for i in system.include_paths] common_flags = ['-g3'] a_flags = common_flags c_flags = common_flags # Compile all C files. c_obj_files = [os.path.join(system.output, os.path.basename(c.replace('.c', '.o'))) for c in system.c_files] for c, o in zip(system.c_files, c_obj_files): os.makedirs(os.path.dirname(o), exist_ok=True) # gcc options for the PowerPC e500 execute(['powerpc-linux-gnu-gcc', '-mcpu=8548', '-mfloat-gprs=double', '-meabi', '-mno-sdata', '-G', '0', '-ffreestanding', '-c', c, '-o', o, '-Wall', '-Werror'] + c_flags + inc_path_args) # Assemble all asm files. asm_obj_files = [os.path.join(system.output, os.path.basename(s.replace('.s', '.o'))) for s in system.asm_files] for s, o in zip(system.asm_files, asm_obj_files): os.makedirs(os.path.dirname(o), exist_ok=True) execute(['powerpc-linux-gnu-as', '-me500', '-o', o, s] + a_flags + inc_path_args) # Perform final link obj_files = asm_obj_files + c_obj_files execute(['powerpc-linux-gnu-ld', '-G', '0', '-T', system.linker_script, '-o', system.output_file] + obj_files)
def system_build(system): inc_path_args = ['-I%s' % i for i in system.include_paths] common_flags = ['-mthumb', '-march=armv7-m', '-g3'] a_flags = common_flags c_flags = common_flags + ['-Os'] # Compile all C files. c_obj_files = [ os.path.join(system.output, os.path.basename(c.replace('.c', '.o'))) for c in system.c_files ] for c, o in zip(system.c_files, c_obj_files): os.makedirs(os.path.dirname(o), exist_ok=True) execute([ 'arm-none-eabi-gcc', '-ffreestanding', '-c', c, '-o', o, '-Wall', '-Werror' ] + c_flags + inc_path_args) # Assemble all asm files. asm_obj_files = [ os.path.join(system.output, os.path.basename(s.replace('.s', '.o'))) for s in system.asm_files ] for s, o in zip(system.asm_files, asm_obj_files): os.makedirs(os.path.dirname(o), exist_ok=True) execute(['arm-none-eabi-as', '-o', o, s] + a_flags + inc_path_args) # Perform final link obj_files = asm_obj_files + c_obj_files execute([ 'arm-none-eabi-ld', '-T', system.linker_script, '-o', system.output_file ] + obj_files)
def system_build(system): inc_path_args = ['-I%s' % i for i in system.include_paths] common_flags = ['-mthumb', '-g3', '-mlittle-endian', '-mcpu=cortex-m4', '-mfloat-abi=hard', '-mfpu=fpv4-sp-d16'] a_flags = common_flags c_flags = common_flags + ['-Os'] all_input_files = system.c_files + system.asm_files all_input_files = [os.path.normpath(os.path.abspath(path)) for path in all_input_files] common_parent_path = commonpath(all_input_files) # Compile all C files. c_obj_files = [os.path.join(system.output, os.path.relpath(os.path.abspath(c_file_path.replace('.c', '.o')), common_parent_path)) for c_file_path in system.c_files] for c_file_path, obj_file_path in zip(system.c_files, c_obj_files): os.makedirs(os.path.dirname(obj_file_path), exist_ok=True) execute(['arm-none-eabi-gcc', '-ffreestanding', '-c', c_file_path, '-o', obj_file_path, '-Wall', '-Werror'] + c_flags + inc_path_args) # Assemble all asm files. asm_obj_files = [os.path.join(system.output, os.path.relpath(os.path.abspath(asm_file_path.replace('.s', '.o')), common_parent_path)) for asm_file_path in system.asm_files] for asm_file_path, obj_file_path in zip(system.asm_files, asm_obj_files): os.makedirs(os.path.dirname(obj_file_path), exist_ok=True) execute(['arm-none-eabi-as', '-o', obj_file_path, asm_file_path] + a_flags + inc_path_args) # Perform final link obj_files = asm_obj_files + c_obj_files execute(['arm-none-eabi-ld', '-T', system.linker_script, '-o', system.output_file] + obj_files)
def system_build(system): inc_path_args = ['-I%s' % i for i in system.include_paths] common_flags = [ '-mthumb', '-g', '-mlittle-endian', '-mcpu=cortex-m4', '-mfloat-abi=hard', '-mfpu=fpv4-sp-d16' ] a_flags = common_flags + [] c_flags = common_flags + ['-O0'] # Compile all C files. c_obj_files = [ os.path.join(system.output, os.path.basename(c.replace('.c', '.o'))) for c in system.c_files ] for c, o in zip(system.c_files, c_obj_files): os.makedirs(os.path.dirname(o), exist_ok=True) execute([ 'arm-none-eabi-gcc', '-ffreestanding', '-c', c, '-o', o, '-Wall', '-Werror' ] + c_flags + inc_path_args) # Assemble all asm files. asm_obj_files = [ os.path.join(system.output, os.path.basename(s.replace('.s', '.o'))) for s in system.asm_files ] for s, o in zip(system.asm_files, asm_obj_files): os.makedirs(os.path.dirname(o), exist_ok=True) execute(['arm-none-eabi-as', '-o', o, s] + a_flags + inc_path_args) # Put all the objects in an archive obj_files = asm_obj_files + c_obj_files execute(['arm-none-eabi-ar', '-cr', system.output_file + '.a'] + obj_files)
def system_build(system): inc_path_args = ['-I%s' % i for i in system.include_paths] common_flags = [ '-mthumb', '-g3', '-mlittle-endian', '-mcpu=cortex-m4', '-mfloat-abi=hard', '-mfpu=fpv4-sp-d16' ] a_flags = common_flags c_flags = common_flags + [ '-O0', '-fdata-sections', '-fno-common', '-fno-zero-initialized-in-bss' ] # '--print-memory-usage' is a very useful flag here if you are # memory-constrained, but only works with recent versions of ld ld_flags = [] all_input_files = system.c_files + system.asm_files all_input_files = [ os.path.normpath(os.path.abspath(path)) for path in all_input_files ] common_parent_path = commonpath(all_input_files) # Compile all C files. c_obj_files = [ os.path.join( system.output, os.path.relpath(os.path.abspath(c_file_path.replace('.c', '.o')), common_parent_path)) for c_file_path in system.c_files ] for c_path, obj_path in zip(system.c_files, c_obj_files): os.makedirs(os.path.dirname(obj_path), exist_ok=True) execute([ 'arm-none-eabi-gcc', '-ffreestanding', '-c', c_path, '-o', obj_path, '-Wall', '-Werror' ] + c_flags + inc_path_args) # Assemble all asm files. asm_obj_files = [ os.path.join( system.output, os.path.relpath(os.path.abspath(asm_file_path.replace('.s', '.o')), common_parent_path)) for asm_file_path in system.asm_files ] for asm_file_path, obj_file_path in zip(system.asm_files, asm_obj_files): os.makedirs(os.path.dirname(obj_file_path), exist_ok=True) execute(['arm-none-eabi-as', '-o', obj_file_path, asm_file_path] + a_flags + inc_path_args) # Perform final link obj_files = asm_obj_files + c_obj_files execute([ 'arm-none-eabi-ld', '-T', system.linker_script, '-o', system.output_file ] + ld_flags + obj_files)
def system_build(system): print("USING STELLARIS BUILD FUNCTION") inc_path_args = ['-I%s' % i for i in system.include_paths] common_flags = ['-mthumb', '-mcpu=cortex-m3', '-MD'] a_flags = common_flags c_flags = common_flags + [ '-ffunction-sections', '-fdata-sections', '-DPART_LM3S9B96', '-std=gnu99', '-DTARGET_IS_TEMPEST_RB1', '-g' ] stellaris = '/home/schnommos/Dev/echronos/packages/machine-stellaris-evalbot/stellarisware-min/' execute(['make', stellaris]) system.linker_script = stellaris + '../example/motor_demo.ld' # Compile all C files. c_obj_files = [ os.path.join(system.output, os.path.basename(c.replace('.c', '.o'))) for c in system.c_files ] for c, o in zip(system.c_files, c_obj_files): os.makedirs(os.path.dirname(o), exist_ok=True) execute( ['arm-none-eabi-gcc', '-ffreestanding', '-c', c, '-o', o, '-Wall' ] + c_flags + inc_path_args) # Assemble all asm files. asm_obj_files = [ os.path.join(system.output, os.path.basename(s.replace('.s', '.o'))) for s in system.asm_files ] for s, o in zip(system.asm_files, asm_obj_files): os.makedirs(os.path.dirname(o), exist_ok=True) execute(['arm-none-eabi-as', '-o', o, s] + a_flags + inc_path_args) # Perform final link obj_files = asm_obj_files + c_obj_files obj_files.append(stellaris + 'driverlib/gcc-cm3/libdriver-cm3.a') obj_files.append(stellaris + 'boards/ek-evalbot/motor_demo/gcc/io.o') execute([ 'arm-none-eabi-ld', '-T', system.linker_script, '-o', system.output_file ] + obj_files)
def system_build(system): inc_path_args = ['-I%s' % i for i in system.include_paths] # The device we emulate does not implement FPU instructions, however # ctxt-switch-preempt.s requires them. So, 'fake' a hardware FPU. # Qemu will gracefully ignore the FPU instructions. common_flags = [ '-mthumb', '-g3', '-mlittle-endian', '-mcpu=cortex-m3', '-mfloat-abi=hard', '-mfpu=fpv4-sp-d16' ] a_flags = common_flags c_flags = common_flags + ['-Os'] all_input_files = system.c_files + system.asm_files all_input_files = [ os.path.normpath(os.path.abspath(path)) for path in all_input_files ] common_parent_path = commonpath(all_input_files) # Compile all C files. c_obj_files = [ os.path.join( system.output, os.path.relpath(os.path.abspath(c_file_path.replace('.c', '.o')), common_parent_path)) for c_file_path in system.c_files ] for c_path, obj_path in zip(system.c_files, c_obj_files): os.makedirs(os.path.dirname(obj_path), exist_ok=True) execute([ 'arm-none-eabi-gcc', '-ffreestanding', '-c', c_path, '-o', obj_path, '-Wall', '-Werror' ] + c_flags + inc_path_args) # Assemble all asm files. asm_obj_files = [ os.path.join( system.output, os.path.relpath(os.path.abspath(asm_file_path.replace('.s', '.o')), common_parent_path)) for asm_file_path in system.asm_files ] for asm_file_path, obj_file_path in zip(system.asm_files, asm_obj_files): os.makedirs(os.path.dirname(obj_file_path), exist_ok=True) execute(['arm-none-eabi-as', '-o', obj_file_path, asm_file_path] + a_flags + inc_path_args) # Perform final link obj_files = asm_obj_files + c_obj_files execute([ 'arm-none-eabi-ld', '-T', system.linker_script, '-o', system.output_file ] + obj_files)
def system_build(system): inc_path_args = ['-I%s' % i for i in system.include_paths] common_flags = [ '-mthumb', '-mcpu=cortex-m23', '-march=armv8-m.base', '-g3' ] a_flags = common_flags # c_flags = common_flags + ['-Os'] + ['-D__SAML10E16A__'] c_flags = common_flags + ['-Og'] + ['-D__SAML10E16A__', '-std=gnu99'] ld_flags = ['-mthumb', '-mcpu=cortex-m23', \ '-march=armv8-m.base', '-Wl,--gc-sections', \ '-T', './share/packages/saml10/saml10e16a.ld'] all_input_files = system.c_files + system.asm_files all_input_files = [ os.path.normpath(os.path.abspath(path)) for path in all_input_files ] common_parent_path = commonpath(all_input_files) # Compile all C files. c_obj_files = [ os.path.join( system.output, os.path.relpath(os.path.abspath(c_file_path.replace('.c', '.o')), common_parent_path)) for c_file_path in system.c_files ] for c_path, obj_path in zip(system.c_files, c_obj_files): os.makedirs(os.path.dirname(obj_path), exist_ok=True) execute([ 'arm-none-eabi-gcc', '-c', c_path, '-o', obj_path, '-Wall', '-Werror' ] + c_flags + inc_path_args) # Assemble all asm files. asm_obj_files = [ os.path.join( system.output, os.path.relpath(os.path.abspath(asm_file_path.replace('.s', '.o')), common_parent_path)) for asm_file_path in system.asm_files ] for asm_file_path, obj_file_path in zip(system.asm_files, asm_obj_files): os.makedirs(os.path.dirname(obj_file_path), exist_ok=True) execute(['arm-none-eabi-as', '-o', obj_file_path, asm_file_path] + a_flags + inc_path_args) # Perform final link obj_files = asm_obj_files + c_obj_files execute(['arm-none-eabi-gcc', '-o', system.output_file] + ld_flags + obj_files)
def system_build(system, prx_config={}): inc_path_args = ['-I%s' % i for i in system.include_paths] common_flags = ['-g3'] a_flags = common_flags c_flags = common_flags if prx_config.get('double_precision_fp'): c_float_gprs_flag = '-mfloat-gprs=double' else: c_float_gprs_flag = '-mfloat-gprs=single' # Compile all C files. c_obj_files = [ os.path.join(system.output, os.path.basename(c.replace('.c', '.o'))) for c in system.c_files ] for c, o in zip(system.c_files, c_obj_files): os.makedirs(os.path.dirname(o), exist_ok=True) execute([ 'powerpc-eabispe-gcc', '-mcpu=8548', c_float_gprs_flag, '-meabi', '-mno-sdata', '-G', '0', '-mabi=spe', '-mspe', '-ffreestanding', '-c', c, '-o', o, '-Wall', '-Werror' ] + c_flags + inc_path_args) # Assemble all asm files. asm_obj_files = [ os.path.join(system.output, os.path.basename(s.replace('.s', '.o'))) for s in system.asm_files ] for s, o in zip(system.asm_files, asm_obj_files): os.makedirs(os.path.dirname(o), exist_ok=True) execute(['powerpc-eabispe-as', '-me500', '-mspe', '-o', o, s] + a_flags + inc_path_args) # Perform final link obj_files = asm_obj_files + c_obj_files execute([ 'powerpc-eabispe-ld', '-G', '0', '-T', system.linker_script, '-o', system.output_file ] + obj_files)
def system_build(system): inc_path_args = [ '-I%s' % i for i in system.include_paths + ['./gen', './include', './libsmaccmpilot/include', 'ivory'] ] common_flags = [ '-mthumb', '-g3', '-mlittle-endian', '-mcpu=cortex-m4', '-mfloat-abi=hard', '-mfpu=fpv4-sp-d16' ] a_flags = common_flags c_flags = common_flags + ['-Os'] # Compile all C files. c_obj_files = [ os.path.join(system.output, os.path.basename(c.replace('.c', '.o'))) for c in system.c_files ] for c, o in zip(system.c_files, c_obj_files): os.makedirs(os.path.dirname(o), exist_ok=True) execute([ 'arm-none-eabi-gcc', '-ffreestanding', '-c', c, '-o', o, '-Wall', '-Werror' ] + c_flags + inc_path_args) # Assemble all asm files. asm_obj_files = [ os.path.join(system.output, os.path.basename(s.replace('.s', '.o'))) for s in system.asm_files ] for s, o in zip(system.asm_files, asm_obj_files): os.makedirs(os.path.dirname(o), exist_ok=True) execute(['arm-none-eabi-as', '-o', o, s] + a_flags + inc_path_args) # Perform final link obj_files = asm_obj_files + c_obj_files execute([ 'arm-none-eabi-ld', '-T', system.linker_script, '-o', system.output_file ] + obj_files)
def system_build(system, prx_config=None): if prx_config is None: prx_config = {} inc_path_args = ['-I%s' % i for i in system.include_paths] common_flags = ['-g3'] a_flags = common_flags c_flags = common_flags if prx_config.get('double_precision_fp'): c_float_gprs_flag = '-mfloat-gprs=double' else: c_float_gprs_flag = '-mfloat-gprs=single' all_input_files = system.c_files + system.asm_files all_input_files = [os.path.normpath(os.path.abspath(path)) for path in all_input_files] common_parent_path = commonpath(all_input_files) # Compile all C files. c_obj_files = [os.path.join(system.output, os.path.relpath(os.path.abspath(c_file_path.replace('.c', '.o')), common_parent_path)) for c_file_path in system.c_files] for c_file_path, obj_file_path in zip(system.c_files, c_obj_files): os.makedirs(os.path.dirname(obj_file_path), exist_ok=True) execute(['powerpc-eabispe-gcc', '-mcpu=8548', c_float_gprs_flag, '-meabi', '-mno-sdata', '-G', '0', '-mabi=spe', '-mspe', '-ffreestanding', '-c', c_file_path, '-o', obj_file_path, '-Wall', '-Werror'] + c_flags + inc_path_args) # Assemble all asm files. asm_obj_files = [os.path.join(system.output, os.path.relpath(os.path.abspath(asm_file_path.replace('.s', '.o')), common_parent_path)) for asm_file_path in system.asm_files] for asm_file_path, obj_file_path in zip(system.asm_files, asm_obj_files): os.makedirs(os.path.dirname(obj_file_path), exist_ok=True) execute(['powerpc-eabispe-as', '-me500', '-mspe', '-o', obj_file_path, asm_file_path] + a_flags + inc_path_args) # Perform final link obj_files = asm_obj_files + c_obj_files execute(['powerpc-eabispe-ld', '-G', '0', '-T', system.linker_script, '-o', system.output_file] + obj_files)
def system_build(system): inc_path_args = ['-I%s' % i for i in system.include_paths + ['./gen', './include', './libsmaccmpilot/include', 'ivory']] common_flags = ['-mthumb', '-g3', '-mlittle-endian', '-mcpu=cortex-m4', '-mfloat-abi=hard', '-mfpu=fpv4-sp-d16'] a_flags = common_flags c_flags = common_flags + ['-Os'] # Compile all C files. c_obj_files = [os.path.join(system.output, os.path.basename(c.replace('.c', '.o'))) for c in system.c_files] for c, o in zip(system.c_files, c_obj_files): os.makedirs(os.path.dirname(o), exist_ok=True) execute(['arm-none-eabi-gcc', '-ffreestanding', '-c', c, '-o', o, '-Wall', '-Werror'] + c_flags + inc_path_args) # Assemble all asm files. asm_obj_files = [os.path.join(system.output, os.path.basename(s.replace('.s', '.o'))) for s in system.asm_files] for s, o in zip(system.asm_files, asm_obj_files): os.makedirs(os.path.dirname(o), exist_ok=True) execute(['arm-none-eabi-as', '-o', o, s] + a_flags + inc_path_args) # Perform final link obj_files = asm_obj_files + c_obj_files execute(['arm-none-eabi-ld', '-T', system.linker_script, '-o', system.output_file] + obj_files)