7 host = os.environ.get('HOST', 'arm-none-eabi-')
17 for k, v in d.items():
20 env.Append(CCFLAGS = [
21 '-mcpu=cortex-m0plus',
23 '-ffunction-sections',
28 env.Append(LINKFLAGS = [
29 '-mcpu=cortex-m0plus',
38 subprocess.check_output('{} -print-libgcc-file-name'.format(env['CC']),
41 env.Append(RUSTCFLAGS = [
43 '-C', 'link-arg={}'.format(libgcc_path),
44 '--target=thumbv6m-none-eabi',
49 env.Append(LINKFLAGS = [
53 SConscript('SConscript.libcommon', exports='env', duplicate=0)
55 bootloader_source_files = [
56 'src/bootloader/main.rs', # Must be listed first (see below).
57 'src/bootloader/bootloader.rs',
58 'src/bootloader/flash.rs',
61 for s in ['intermediate', 'final']:
62 bootloader_env = env.Clone()
64 bootloader_env.Append(RUSTCFLAGS = [
65 '-C', 'link-arg=-Tsrc/bootloader/bootloader-{}.ld'.format(s),
67 'bootloader_type=\\"{}\\"'.format(s)
71 bootloader_env.Rustc('gps-watch-bootloader-{}.elf'.format(s),
72 bootloader_source_files[0])
74 for f in bootloader_source_files:
75 Depends(bootloader_elf, f)
77 Depends(bootloader_elf, 'libcommon.rlib')
78 Depends(bootloader_elf, 'libcommon.a')
80 bootloader_bin = bootloader_env.Objcopy(bootloader_elf)
82 Default(bootloader_bin)
84 application_source_files = [
85 'src/application/main.rs', # Must be listed first (see below).
86 'src/application/uart0.rs',
89 application_env = env.Clone()
91 application_env.Append(RUSTCFLAGS = [
92 '-C', 'link-arg=-Tsrc/application/application.ld',
95 application_elf = application_env.Rustc('gps-watch-application.elf',
96 application_source_files[0])
98 for f in application_source_files:
99 Depends(application_elf, f)
101 Depends(application_elf, 'libcommon.rlib')
102 Depends(application_elf, 'libcommon.a')
104 application_bin = application_env.Objcopy(application_elf)
106 Default(application_bin)