forked from coredevices/PebbleOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwscript
More file actions
652 lines (533 loc) · 23.3 KB
/
Copy pathwscript
File metadata and controls
652 lines (533 loc) · 23.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
import collections
import json
import os
import waflib.Logs
from waflib import Build, Task
from waflib.Configure import conf
from waflib.TaskGen import before_method, feature
from waflib.Tools.ccroot import link_task
import waftools.compress
import waftools.generate_log_strings_json
import waftools.generate_timezone_data
import waftools.gitinfo
import waftools.ldscript
import waftools.objcopy
import waftools.pblboot
from tools.pebble_sdk_platform import pebble_platforms
@feature("c")
@before_method('apply_link')
def use_group_link(self):
"""
Use a link group to resolve dependencies
"""
if 'cprogram' in self.features and getattr(self, 'link_group', False):
self.features.insert(0, "group_cprogram")
class group_cprogram(link_task):
run_str = '${LINK_CC} ${LINKFLAGS} ${CCLNK_SRC_F}${SRC} ${CCLNK_TGT_F}${TGT[0].abspath()} ${RPATH_ST:RPATH} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${FRAMEWORK_ST:FRAMEWORK} ${ARCH_ST:ARCH} -Wl,--start-group ${STLIB_MARKER} ${STLIBPATH_ST:STLIBPATH} ${STLIB_ST:STLIB} ${SHLIB_MARKER} ${LIBPATH_ST:LIBPATH} ${LIB_ST:LIB} -Wl,--end-group'
ext_out=['.bin']
vars=['LINKDEPS']
inst_to='${BINDIR}'
@conf
def get_pbz_node(ctx, fw_type, board_type, version_string, slot=None):
return ctx.path.get_bld().make_node('{}_{}_{}{}.pbz'.format(
fw_type, board_type, version_string, "" if slot is None else f"_slot{slot}"
))
@conf
def get_pbpack_node(ctx):
return ctx.path.get_bld().make_node('system_resources.pbpack')
@conf
def get_tintin_fw_node(ctx, subdir=None):
subpath = 'src/fw/tintin_fw.bin'
if subdir:
subpath = os.path.join(subdir, subpath)
return ctx.path.get_bld().make_node(subpath)
def options(opt):
opt.add_option(
"--prf-as-firmware",
action='store_true',
help="Build PRF so that it links to the firmware region",
)
opt.add_option(
'--slot',
action='store',
type=int,
default=0,
choices=[0, 1],
help='Select for which slot to build the firmware. 0=primary, 1=secondary'
)
def configure(conf):
conf.load('binary_header')
platform = pebble_platforms[conf.env.PLATFORM_NAME]
define = 'MAX_FONT_GLYPH_SIZE={}'.format(platform['MAX_FONT_GLYPH_SIZE'])
conf.env.append_value('DEFINES', [define])
conf.env.NORMAL_SHELL = 'sdk' if conf.env.CONFIG_SHELL_SDK else 'normal'
conf.env.PRF_AS_FIRMWARE = conf.options.prf_as_firmware
if conf.options.prf_as_firmware:
conf.env.append_value('DEFINES', 'RECOVERY_FW_AS_FW')
if conf.env.CONFIG_PBLBOOT:
conf.env.SLOT = conf.options.slot
conf.env.append_value('DEFINES', f'FIRMWARE_SLOT_{conf.options.slot}')
else:
conf.env.SLOT = -1
def _generate_memory_layout(bld):
if bld.env.CONFIG_QEMU:
ldscript_template = bld.path.find_node('qemu_flash_fw.ld.template')
elif bld.env.CONFIG_BOARD_FAMILY_ASTERIX:
ldscript_template = bld.path.find_node('nrf52840_flash_fw.ld.template')
elif bld.env.CONFIG_BOARD_FAMILY_OBELIX or bld.env.CONFIG_BOARD_FAMILY_GETAFIX:
ldscript_template = bld.path.find_node('sf32lb52_flash_fw.ld.template')
# Determine sizes so we can later calculate FLASH_LENGTH_*
if bld.env.CONFIG_QEMU:
flash_size = 4 * 1024 * 1024
offset_size = 0
fw_max_size = flash_size
elif bld.env.CONFIG_SOC_SF32LB52:
flash_size = 32 * 1024 * 1024
ptable_size = 64 * 1024
bootloader_size = 64 * 1024
slot_size = 3072 * 1024
resources_size = 2048 * 1024
prf_size = 576 * 1024
if bld.env.VARIANT == 'prf' and not (bld.env.CONFIG_MFG or bld.env.PRF_AS_FIRMWARE):
offset_size = ptable_size + bootloader_size + 2 * slot_size + 2 * resources_size
fw_max_size = prf_size
else:
offset_size = ptable_size + bootloader_size
if bld.env.SLOT == 1:
offset_size += slot_size
offset_size = offset_size
fw_max_size = slot_size
elif bld.env.CONFIG_SOC_NRF52:
# Bootloader
offset_size = 32 * 1024
flash_size = 1024 * 1024
if bld.env.CONFIG_BOARD_FAMILY_ASTERIX and bld.env.VARIANT == 'prf' and not bld.env.CONFIG_MFG:
fw_max_size = flash_size // 2
else:
fw_max_size = flash_size
if bld.env.CONFIG_QEMU:
flash_size = 4 * 1024 * 1024
fw_max_size = flash_size
if bld.env.CONFIG_QEMU:
flash_origin = 0x00000000
elif bld.env.FLASH_ITCM:
flash_origin = 0x00200000
elif bld.env.CONFIG_SOC_NRF52:
flash_origin = 0x00000000
elif bld.env.CONFIG_SOC_SF32LB52:
flash_origin = 0x12000000
else:
flash_origin = 0x08000000
firmware_offset = 0
if bld.env.CONFIG_SOC_SF32LB52:
firmware_offset = 4096
bld.env.FIRMWARE_OFFSET = firmware_offset
bld.env.append_value('DEFINES', [f'FIRMWARE_OFFSET={firmware_offset}'])
# Determine FLASH_LENGTH_*
fw_flash_length = '%(fw_max_size)d - %(firmware_offset)d' % locals()
fw_flash_origin = '0x%(flash_origin)08x + %(offset_size)d + %(firmware_offset)d' % locals()
bootloader_symbol_definitions = ""
# Determine ram layout
# Each tuple defines the amount of RAM we give to apps (stack + text + data
# + bss + heap) and the amount of RAM reserved for the application runtime
# (AppState) for each SDK platform, respectively.
AppRamSize = collections.namedtuple('AppRamSize',
'app_segment runtime_reserved')
APP_RAM_SIZES = {
'aplite': AppRamSize(25952, 6820),
'basalt': AppRamSize(66 * 1024, 30 * 1024),
'chalk': AppRamSize(66 * 1024, 30 * 1024),
# FIXME: The runtime_reserved size could be reduced for diorite
'diorite': AppRamSize(66 * 1024, 30 * 1024),
'emery': AppRamSize(2048 * 1024, 62 * 1024),
'flint': AppRamSize(66 * 1024, 30 * 1024),
'gabbro': AppRamSize(2048 * 1024, 94 * 1024),
}
APP_UNSUPPORTED = AppRamSize(0, 0)
# The process loader enforces eight-byte alignment on all segments, so
# configuring a segment with a size that is not a multiple of eight will
# result in segments being smaller than expected. The runtime_reserved
# size is not checked as its value isn't currently used anywhere.
for platform, sizes in APP_RAM_SIZES.items():
if sizes.app_segment % 8 != 0:
bld.fatal("The app_segment size for APP_RAM_SIZES[%r] is not a "
"multiple of eight bytes. You're gonna have a bad "
"time." % platform)
# In the FW, the app execution environment is based on the major FW version with which the SDK
# is associated. Each model supports a different set of SDK platforms, and determines the SDK
# platform of an app using these major FW version associations (and also by considering the
# hardware capabilities watch model itself - i.e. chalk vs basalt). We want to define
# APP_RAM_*X_SIZE macros for each app execution environment supported by the model so we
# don't need to hard-code these in the FW itself.
if bld.env.CONFIG_PLATFORM_EMERY:
app_ram_size_2x = APP_RAM_SIZES['aplite']
app_ram_size_3x = APP_RAM_SIZES['basalt']
app_ram_size_4x = APP_RAM_SIZES['emery']
# We have 512K of SRAM, last 1K reserved for LCPU IPC
sram = (0x20000000, (512 - 1) * 1024)
psram = (0x60000000, 16 * 1024 * 1024)
elif bld.env.CONFIG_PLATFORM_FLINT:
app_ram_size_2x = APP_RAM_SIZES['aplite']
app_ram_size_3x = APP_RAM_SIZES['aplite']
app_ram_size_4x = APP_RAM_SIZES['flint']
retained_size = 256
sram = (0x20000000 + retained_size, 256 * 1024 - retained_size)
psram = None
elif bld.env.CONFIG_PLATFORM_GABBRO:
app_ram_size_2x = APP_UNSUPPORTED
app_ram_size_3x = APP_RAM_SIZES['chalk']
app_ram_size_4x = APP_RAM_SIZES['gabbro']
# We have 512K of SRAM, last 1K reserved for LCPU IPC
sram = (0x20000000, (512 - 1) * 1024)
psram = (0x60000000, 16 * 1024 * 1024)
else:
bld.fatal("No set of supported SDK platforms defined for this board")
# Allocate RAM from the end to the start. Do the app first, then the worker, then give whatever
# is left to the kernel.
all_app_ram_sizes = [app_ram_size_2x, app_ram_size_3x, app_ram_size_4x]
app_ram_size = max(sum(x) for x in all_app_ram_sizes)
system_app_segment_size = max(x.app_segment for x in all_app_ram_sizes)
app_runtime_size = max(x.runtime_reserved for x in all_app_ram_sizes)
if app_ram_size <= 0 or app_runtime_size <= 0:
bld.fatal("App RAM is too small!")
worker_ram_size = 12 * 1024 # The worker always gets 12k of RAM.
if psram:
kernel_ram = sram
ram_end = sum(psram)
app_ram = (ram_end - app_ram_size, app_ram_size)
worker_ram = (ram_end - app_ram_size - worker_ram_size, worker_ram_size)
else:
ram_end = sum(sram)
app_ram = (ram_end - app_ram_size, app_ram_size)
worker_ram = (ram_end - app_ram_size - worker_ram_size, worker_ram_size)
kernel_ram_size = sram[1] - app_ram_size - worker_ram_size
kernel_ram = (sram[0], kernel_ram_size)
# As a basic sanity check, make sure we're giving the kernel at least 64k.
if kernel_ram[1] < 64 * 1024:
bld.fatal("Kernel RAM is too small!")
ldscript_result = ldscript_template.get_bld().change_ext('.ld', ext_in='.ld.template')
bld(features='subst',
source=ldscript_template,
target=ldscript_result,
KERNEL_RAM_ADDR="0x{:x}".format(kernel_ram[0]),
KERNEL_RAM_SIZE=kernel_ram[1],
APP_RAM_ADDR="0x{:x}".format(app_ram[0]),
APP_RAM_SIZE=app_ram[1],
WORKER_RAM_ADDR="0x{:x}".format(worker_ram[0]),
WORKER_RAM_SIZE=worker_ram[1],
FLASH_ORIGIN="0x{:x}".format(flash_origin),
FW_FLASH_ORIGIN=fw_flash_origin,
FW_FLASH_LENGTH=fw_flash_length,
FLASH_SIZE=flash_size,
BOOTLOADER_SYMBOLS=bootloader_symbol_definitions)
bld(features='subst',
source=bld.path.find_node('process_management/sdk_memory_limits.template.h'),
target=bld.path.get_bld().make_node('process_management/sdk_memory_limits.auto.h'),
APP_RAM_2X_SIZE=str(app_ram_size_2x.app_segment),
APP_RAM_3X_SIZE=str(app_ram_size_3x.app_segment),
APP_RAM_4X_SIZE=str(app_ram_size_4x.app_segment),
APP_RAM_SYSTEM_SIZE=str(system_app_segment_size))
return ldscript_result
def _link_firmware(bld, sources):
if bld.env.CONFIG_QEMU:
if bld.env.CONFIG_BOARD_QEMU_GABBRO:
# qemu_gabbro needs the getafix round display row info data
sources += ['board/displays/display_getafix.c']
elif bld.env.CONFIG_BOARD_FAMILY_GETAFIX:
sources += ['board/displays/display_getafix.c']
fw_linkflags = ['-Wl,--cref',
'-Wl,-Map=tintin_fw.map',
'-Wl,--gc-sections',
'-Wl,--undefined=uxTopUsedPriority',
'-Wl,--build-id=sha1',
'-Wl,--sort-section=alignment',
'-nostdlib']
fw_linkflags.extend(['-Wl,--wrap=malloc',
'-Wl,--undefined=__wrap_malloc',
'-Wl,--wrap=realloc',
'-Wl,--undefined=__wrap_realloc',
'-Wl,--wrap=calloc',
'-Wl,--undefined=__wrap_calloc',
'-Wl,--wrap=free',
'-Wl,--undefined=__wrap_free'])
uses = ['applib',
'board',
'bt_driver',
'drivers',
'freertos',
'fw_services',
'gcc',
'proto_schemas',
'libbtutil',
'libos',
'libutil',
'nanopb',
'pblibc',
'pbl_includes',
'soc',
'speex',
'startup',
'tinymt32',
'upng']
uses.extend(bld.env.FW_APPS)
if bld.env.CONFIG_MEMFAULT:
fw_linkflags.append('-Wl,--require-defined=g_memfault_build_id')
uses.append('memfault')
ldscript = _generate_memory_layout(bld)
ldscripts = [ldscript, 'fw_common.ld']
if bld.env.CONFIG_MEMFAULT:
ldscripts.append(bld.srcnode.find_node(
'third_party/memfault/port/memfault_compact_log.ld'))
if bld.env.NO_LINK:
# Only build the object files
bld.objects(source=sources,
use=uses,
includes='fonts')
else:
# ..and actually build and link the firmware ELF
elf_node = bld.path.get_bld().make_node('tintin_fw.elf')
x = bld.program(source=sources,
use=uses,
link_group=True,
lib=['gcc'],
target=elf_node,
includes='fonts',
ldscript=ldscripts,
linkflags=fw_linkflags)
x.env.append_value('LINKFLAGS', fw_linkflags)
if bld.env.FLASH_ITCM:
# 0x07E00000 is the difference between the flash memory address and the flash ITCM
# address. We need to add this because otherwise OpenOCD is unable to write the
# image into the flash chip.
extra_args = '--change-addresses 0x07E00000'
else:
extra_args = ''
if bld.env.CONFIG_PBLBOOT:
nohdr_hex_node = elf_node.change_ext('.nohdr.hex')
bld(rule=waftools.objcopy.objcopy_hex, source=elf_node, target=nohdr_hex_node, extra_args=extra_args)
hex_node = elf_node.change_ext('.hex')
bld(rule=waftools.pblboot.insert_header_hex, source=nohdr_hex_node, target=hex_node)
nohdr_bin_node = elf_node.change_ext('.nohdr.bin')
bld(rule=waftools.objcopy.objcopy_bin, source=elf_node, target=nohdr_bin_node)
bin_node = elf_node.change_ext('.bin')
bld(rule=waftools.pblboot.insert_header_bin, source=nohdr_bin_node, target=bin_node)
else:
hex_node = elf_node.change_ext('.hex')
bld(rule=waftools.objcopy.objcopy_hex, source=elf_node, target=hex_node, extra_args=extra_args)
bin_node = elf_node.change_ext('.bin')
bld(rule=waftools.objcopy.objcopy_bin, source=elf_node, target=bin_node)
# Create the log_strings .elf and check the format specifier rules
if bld.env.CONFIG_LOG_HASHED:
fw_loghash_node = bld.path.get_bld().make_node('tintin_fw_loghash_dict.json')
bld(rule=waftools.generate_log_strings_json.wafrule,
source=elf_node, target=fw_loghash_node)
bld.LOGHASH_DICTS.append(fw_loghash_node)
def _get_mfg_paths(bld):
"""Return a list of directories we want to build to support manufacturing on a platform"""
if bld.env.CONFIG_QEMU:
return ('mfg/qemu',)
elif bld.env.CONFIG_BOARD_FAMILY_ASTERIX:
return ('mfg/asterix',)
elif bld.env.CONFIG_BOARD_FAMILY_OBELIX:
return ('mfg/obelix',)
elif bld.env.CONFIG_BOARD_FAMILY_GETAFIX:
return ('mfg/getafix',)
else:
bld.fatal('No MFG configuration for board %s' % bld.env.BOARD)
def _get_dbg_paths(bld):
"""Return a list of directories we want to build to support debug logging on a platform"""
return ('debug/default',)
def _get_comm_sources(bld, is_recovery):
excl = []
if bld.env.CONFIG_QEMU:
excl.append('comm/internals/profiles/ispp.c')
if is_recovery:
excl.append('comm/ble/kernel_le_client/ancs/*.c')
excl.append('comm/ble/kernel_le_client/ams/*.c')
else:
excl.append('comm/prf_stubs/*')
return bld.path.ant_glob('comm/**/*.c', excl=excl)
def _build_recovery(bld):
source_dirs = ['apps/core/**',
'apps/prf/**',
'process_management',
'process_state/**',
'console',
'debug',
'flash_region',
'graphics',
'kernel/**',
'mfg',
'mfg/mfg_apps',
'mfg/mfg_mode',
'resource',
'syscall',
'system',
'shell',
'shell/prf/**',
'util/**']
source_dirs.extend(_get_mfg_paths(bld))
source_dirs.extend(_get_dbg_paths(bld))
excludes = ['process_management/app_custom_icon.c',
'process_management/app_menu_data_source.c',
'resource/resource_storage_file.c']
if not bld.env.CONFIG_BOARD_FAMILY_ASTERIX:
excludes.extend([
'apps/prf/mfg_speaker_asterix.c',
'apps/prf/mfg_mic_asterix.c',
])
if not bld.env.CONFIG_BOARD_FAMILY_OBELIX:
excludes.extend([
'apps/prf/mfg_speaker_obelix.c',
'apps/prf/mfg_mic_obelix.c',
])
if not bld.env.CONFIG_BOARD_FAMILY_OBELIX or not bld.env.CONFIG_MFG:
excludes.extend([
'apps/prf/mfg_hrm_ctr_leakage_obelix.c',
])
if not bld.env.CONFIG_BOARD_FAMILY_GETAFIX:
excludes.extend([
'apps/prf/mfg_mic_getafix.c',
])
# Exclude magnetometer test for platforms without magnetometer
if not bld.env.CONFIG_MAG:
excludes.extend([
'apps/prf/mfg_mag.c',
])
if not bld.env.CONFIG_TOUCH:
excludes.extend([
'apps/prf/mfg_touch.c',
])
sources = sum([bld.path.ant_glob('%s/*.c' % d, excl=excludes) for d in source_dirs], [])
sources.extend(_get_comm_sources(bld, True))
sources.extend(bld.path.ant_glob('*.c'))
sources.extend(bld.path.ant_glob('*.[sS]'))
sources.append(bld.path.make_node('popups/bluetooth_pairing_ui.c'))
sources.append(bld.path.get_bld().make_node('builtin_resources.auto.c'))
if not bld.env.CONFIG_PROMPT:
sources = [ x for x in sources if not x.abspath().endswith('console/prompt.c') ]
sources = [ x for x in sources if not x.abspath().endswith('console/prompt_commands.c') ]
_link_firmware(bld, sources)
def _get_launcher_globs_to_exclude(bld):
system_launchers_root_path = 'apps/system/launcher/'
legacy_launcher_glob = system_launchers_root_path + 'legacy/**'
default_launcher_glob = system_launchers_root_path + 'default/**'
launcher_globs_to_exclude = [legacy_launcher_glob, default_launcher_glob]
launcher_glob_to_use = default_launcher_glob
launcher_globs_to_exclude.remove(launcher_glob_to_use)
return launcher_globs_to_exclude
def _build_normal(bld):
# Generate timezone data
olson_txt = bld.srcnode.make_node('resources/normal/base/tzdata/timezones_olson.txt')
tzdata_bin = bld.bldnode.make_node('resources/normal/base/tzdata/tzdata.bin.reso')
bld(rule=waftools.generate_timezone_data.wafrule,
source=olson_txt,
target=tzdata_bin)
bld.DYNAMIC_RESOURCES.append(tzdata_bin)
source_dirs = ['process_management',
'process_state/**',
'console',
'debug',
'flash_region',
'graphics',
'kernel/**',
'launcher/**',
'mfg',
'popups/**',
'resource',
'syscall',
'system',
'shell',
'shell/%s/**' % bld.env.NORMAL_SHELL,
'util/**']
excludes = []
source_dirs.append('apps/core/**')
if bld.env.NORMAL_SHELL == 'sdk':
source_dirs.append('apps/sdk/**')
source_dirs.append('apps/system/timeline')
source_dirs.append('apps/system/launcher/default/**')
else:
source_dirs.extend(('apps/%s/**' % d for d in ('system', 'watch')))
if bld.env.CONFIG_BOARD_FAMILY_GETAFIX:
excludes.append('apps/watch/tictoc/default')
excludes.append('apps/watch/tictoc/bw')
elif bld.env.CONFIG_SCREEN_COLOR_DEPTH_BITS == 1:
excludes.append('apps/watch/tictoc/default')
excludes.append('apps/watch/tictoc/round')
else:
excludes.append('apps/watch/tictoc/bw')
excludes.append('apps/watch/tictoc/round')
source_dirs.extend(_get_mfg_paths(bld))
source_dirs.extend(_get_dbg_paths(bld))
excludes.extend(_get_launcher_globs_to_exclude(bld))
if not bld.env.CONFIG_HRM:
excludes.append('popups/ble_hrm/**')
sources = sum([bld.path.ant_glob('%s/*.c' % d, excl=excludes) for d in source_dirs], [])
sources.extend(_get_comm_sources(bld, False))
sources.extend(bld.path.ant_glob('*.c'))
sources.extend(bld.path.ant_glob('*.[sS]'))
if bld.env.NORMAL_SHELL == 'sdk':
sources.append('apps/system/app_fetch_ui.c')
sources.append('apps/system/watchfaces.c')
gettexts = []
gettexts.extend(sources)
gettexts.extend(bld.path.ant_glob('**/*.h'))
gettexts.extend(bld.path.ant_glob('**/*.def'))
bld.gettext(source=gettexts, target='fw.pot')
bld.msgcat(
source='fw.pot services/services.pot applib/applib.pot',
target='tintin.pot')
sources.append(bld.path.get_bld().make_node('pebble.auto.c'))
sources.append(bld.path.get_bld().make_node('resource/pfs_resource_table.auto.c'))
sources.append(bld.path.get_bld().make_node('resource/timeline_resource_table.auto.c'))
sources.append(bld.path.get_bld().make_node('builtin_resources.auto.c'))
if not bld.env.CONFIG_PROMPT:
sources = [ x for x in sources if not x.abspath().endswith('console/prompt.c') ]
sources = [ x for x in sources if not x.abspath().endswith('console/prompt_commands.c') ]
_link_firmware(bld, sources)
def build(bld):
bld.env.FW_APPS = []
# FIXME create applib_includes or something like that
fw_includes_use=['libbtutil_includes',
'libos_includes',
'libutil_includes',
'pbl_includes',
'freertos_includes',
'idl_includes',
'nanopb_includes']
if bld.env.CONFIG_MEMFAULT:
fw_includes_use.append('memfault_includes')
if bld.env.CONFIG_SOC_NRF52:
fw_includes_use.append('hal_nordic')
elif bld.env.CONFIG_SOC_SF32LB52:
fw_includes_use.append('hal_sifli')
bld(export_includes=['.',
'applib/vendor/uPNG',
'applib/vendor/tinflate'],
use=fw_includes_use,
name='fw_includes')
# Truncate the commit to fit in our versions struct. This may cause an ambiguous commit
# hash, but it's better than killing the build because the commit doesn't fit.
git_rev = waftools.gitinfo.get_git_revision(bld)
git_rev['COMMIT'] = git_rev['COMMIT'][:7]
git_rev['PATCH_VERBOSE_STRING']
if len(git_rev['TAG']) > 31:
waflib.Logs.warn('Git tag {} is too long, truncating'.format(git_rev['TAG']))
git_rev['TAG'] = git_rev['TAG'][:31]
bld(features='subst',
source='git_version.auto.h.in',
target='git_version.auto.h',
**git_rev)
bld.recurse('startup')
bld.recurse('drivers')
bld.recurse('board')
bld.recurse('shell')
bld.recurse('services')
bld.recurse('applib')
bld.recurse('soc')
if bld.env.VARIANT == 'prf':
_build_recovery(bld)
else:
bld.recurse('apps')
_build_normal(bld)
# vim:filetype=python