@@ -34,6 +34,17 @@ def OsEnv(self):
34
34
else :
35
35
raise Exception ('Unknown OS type: %r' % self )
36
36
37
+ class NxpBuildSystem (Enum ):
38
+ GN = auto ()
39
+ CMAKE = auto ()
40
+
41
+ def BuildSystem (self ):
42
+ if self == NxpBuildSystem .GN :
43
+ return 'gn'
44
+ elif self == NxpBuildSystem .CMAKE :
45
+ return 'cmake'
46
+ else :
47
+ raise Exception ('Unknown build system: %r' % self )
37
48
38
49
class NxpBoard (Enum ):
39
50
K32W0 = auto ()
@@ -124,6 +135,7 @@ def __init__(self,
124
135
app : NxpApp = NxpApp .LIGHTING ,
125
136
board : NxpBoard = NxpBoard .K32W0 ,
126
137
os_env : NxpOsUsed = NxpOsUsed .FREERTOS ,
138
+ build_system : NxpBuildSystem = NxpBuildSystem .GN ,
127
139
low_power : bool = False ,
128
140
smu2 : bool = False ,
129
141
enable_factory_data : bool = False ,
@@ -148,6 +160,7 @@ def __init__(self,
148
160
self .app = app
149
161
self .board = board
150
162
self .os_env = os_env
163
+ self .build_system = build_system
151
164
self .low_power = low_power
152
165
self .smu2 = smu2
153
166
self .enable_factory_data = enable_factory_data
@@ -221,6 +234,7 @@ def GnBuildArgs(self):
221
234
222
235
def CmakeBuildFlags (self ):
223
236
flags = []
237
+
224
238
if self .enable_factory_data :
225
239
if self .os_env == NxpOsUsed .ZEPHYR :
226
240
flags .append ('-DFILE_SUFFIX=fdata' )
@@ -304,7 +318,7 @@ def generate(self):
304
318
elif p .sdk_name == 'common' :
305
319
cmd += 'export NXP_SDK_ROOT="' + str (p .sdk_storage_location_abspath ) + '" \n '
306
320
307
- if self .board == NxpBoard . RW61X :
321
+ if self .build_system == NxpBuildSystem . CMAKE :
308
322
cmd += '''
309
323
cmake -GNinja {build_flags} -H{example_folder} -B{out_folder}
310
324
''' .format (
@@ -313,7 +327,7 @@ def generate(self):
313
327
out_folder = self .output_dir ).strip ()
314
328
self ._Execute (['bash' , '-c' , cmd ], title = 'Generating ' + self .identifier )
315
329
316
- else :
330
+ elif self . build_system == NxpBuildSystem . GN :
317
331
# add empty space at the end to avoid concatenation issue when there is no --args
318
332
cmd += 'gn gen --check --fail-on-unused-args --export-compile-commands --root=%s ' % self .root
319
333
@@ -349,10 +363,19 @@ def build_outputs(self):
349
363
os .path .join (self .output_dir , 'zephyr' , 'zephyr.map' ),
350
364
f'{ name } .map' )
351
365
else :
352
- yield BuilderOutput (
353
- os .path .join (self .output_dir , name ),
354
- f'{ name } .elf' )
355
- if self .options .enable_link_map_file :
366
+ if self .build_system == NxpBuildSystem .GN :
356
367
yield BuilderOutput (
357
- os .path .join (self .output_dir , f'{ name } .map' ),
358
- f'{ name } .map' )
368
+ os .path .join (self .output_dir , name ),
369
+ f'{ name } .elf' )
370
+ if self .options .enable_link_map_file :
371
+ yield BuilderOutput (
372
+ os .path .join (self .output_dir , f'{ name } .map' ),
373
+ f'{ name } .map' )
374
+ elif self .build_system == NxpBuildSystem .CMAKE :
375
+ yield BuilderOutput (
376
+ os .path .join (self .output_dir , 'out/debug' , name ),
377
+ f'{ name } .elf' )
378
+ if self .options .enable_link_map_file :
379
+ yield BuilderOutput (
380
+ os .path .join (self .output_dir , 'out/debug' , f'{ name } .map' ),
381
+ f'{ name } .map' )
0 commit comments