@@ -84,68 +84,56 @@ def __print_dev_conf(device_list):
8484 print (table )
8585
8686
87- def __build_cmd_get (core : Core , device : AudioDevice , build : BuildType ,
88- pristine , child_image , options ):
89- if core == Core .app :
90- build_cmd = (f"west build { TARGET_CORE_APP_FOLDER } "
91- f"-b { TARGET_BOARD_NRF5340_AUDIO_DK_APP_NAME } "
92- f"--sysbuild" )
93- if device == AudioDevice .headset :
94- device_flag = "-DCONFIG_AUDIO_DEV=1"
95- dest_folder = TARGET_DEV_HEADSET_FOLDER
96- elif device == AudioDevice .gateway :
97- device_flag = "-DCONFIG_AUDIO_DEV=2"
98- dest_folder = TARGET_DEV_GATEWAY_FOLDER
99- else :
100- raise Exception ("Invalid device!" )
101-
102- if build == BuildType .debug :
103- release_flag = ""
104- dest_folder /= TARGET_DEBUG_FOLDER
105- elif build == BuildType .release :
106- release_flag = " -DFILE_SUFFIX=release"
107- dest_folder /= TARGET_RELEASE_FOLDER
108- else :
109- raise Exception ("Invalid build type!" )
110-
111- if not child_image :
112- device_flag += " -DCONFIG_NCS_INCLUDE_RPMSG_CHILD_IMAGE=n"
113-
114- if options .nrf21540 :
115- device_flag += " -Dnrf5340_audio_SHIELD=nrf21540ek"
116- device_flag += " -Dipc_radio_SHIELD=nrf21540ek"
117-
118- if options .custom_bt_name is not None and options .user_bt_name :
119- raise Exception (
120- "User BT name option is invalid when custom BT name is set" )
121-
122- if options .custom_bt_name is not None :
123- custom_bt_name = "_" .join (options .custom_bt_name )[
124- :MAX_USER_NAME_LEN ].upper ()
125- device_flag += " -DCONFIG_BT_DEVICE_NAME=\\ \" " + custom_bt_name + "\\ \" "
126-
127- if options .user_bt_name :
128- user_specific_bt_name = (
129- "AUDIO_DEV_" + getpass .getuser ())[:MAX_USER_NAME_LEN ].upper ()
130- device_flag += " -DCONFIG_BT_DEVICE_NAME=\\ \" " + user_specific_bt_name + "\\ \" "
131-
132- if os .name == 'nt' :
133- release_flag = release_flag .replace ('\\ ' , '/' )
134-
135- if pristine :
136- build_cmd += " -p"
137-
138- elif core == Core .net :
139- if build == BuildType .debug :
140- dest_folder /= TARGET_DEBUG_FOLDER
141- elif build == BuildType .release :
142- dest_folder /= TARGET_RELEASE_FOLDER
143- else :
144- raise Exception ("Invalid build type!" )
145-
146- build_cmd = ""
147- device_flag = ""
87+ def __build_cmd_get (cores : Core , device : AudioDevice , build : BuildType ,
88+ pristine , options ):
89+
90+ build_cmd = (f"west build { TARGET_CORE_APP_FOLDER } "
91+ f"-b { TARGET_BOARD_NRF5340_AUDIO_DK_APP_NAME } "
92+ f"--sysbuild" )
93+ if Core .app in cores and Core .net in cores :
94+ # No changes to build command, build both cores
95+ pass
96+ elif Core .app in cores :
97+ build_cmd += " --domain nrf5340_audio"
98+ elif Core .net in cores :
99+ build_cmd += " --domain ipc_radio"
100+ else :
101+ raise Exception ("Invalid core!" )
102+
103+ if device == AudioDevice .headset :
104+ device_flag = "-DCONFIG_AUDIO_DEV=1"
105+ dest_folder = TARGET_DEV_HEADSET_FOLDER
106+ elif device == AudioDevice .gateway :
107+ device_flag = "-DCONFIG_AUDIO_DEV=2"
108+ dest_folder = TARGET_DEV_GATEWAY_FOLDER
109+ else :
110+ raise Exception ("Invalid device!" )
111+ if build == BuildType .debug :
148112 release_flag = ""
113+ dest_folder /= TARGET_DEBUG_FOLDER
114+ elif build == BuildType .release :
115+ release_flag = " -DFILE_SUFFIX=release"
116+ dest_folder /= TARGET_RELEASE_FOLDER
117+ else :
118+ raise Exception ("Invalid build type!" )
119+ if options .nrf21540 :
120+ device_flag += " -Dnrf5340_audio_SHIELD=nrf21540ek"
121+ device_flag += " -Dipc_radio_SHIELD=nrf21540ek"
122+ if options .custom_bt_name is not None and options .user_bt_name :
123+ raise Exception (
124+ "User BT name option is invalid when custom BT name is set" )
125+ if options .custom_bt_name is not None :
126+ custom_bt_name = "_" .join (options .custom_bt_name )[
127+ :MAX_USER_NAME_LEN ].upper ()
128+ device_flag += " -DCONFIG_BT_DEVICE_NAME=\\ \" " + custom_bt_name + "\\ \" "
129+ if options .user_bt_name :
130+ user_specific_bt_name = (
131+ "AUDIO_DEV_" + getpass .getuser ())[:MAX_USER_NAME_LEN ].upper ()
132+ device_flag += " -DCONFIG_BT_DEVICE_NAME=\\ \" " + user_specific_bt_name + "\\ \" "
133+ if os .name == 'nt' :
134+ release_flag = release_flag .replace ('\\ ' , '/' )
135+ if pristine :
136+ build_cmd += " -p"
149137
150138 return build_cmd , dest_folder , device_flag , release_flag
151139
@@ -156,7 +144,6 @@ def __build_module(build_config, options):
156144 build_config .device ,
157145 build_config .build ,
158146 build_config .pristine ,
159- build_config .child_image ,
160147 options ,
161148 )
162149 west_str = f"{ build_cmd } -d { dest_folder } "
@@ -190,11 +177,11 @@ def __find_snr():
190177 return list (map (int , snrs ))
191178
192179
193- def __populate_hex_paths (dev , options , child_image ):
180+ def __populate_hex_paths (dev , options ):
194181 """Poplulate hex paths where relevant"""
195182
196183 _ , temp_dest_folder , _ , _ = __build_cmd_get (
197- Core .app , dev .nrf5340_audio_dk_dev , options .build , options .pristine , child_image , options
184+ Core .app , dev .nrf5340_audio_dk_dev , options .build , options .pristine , options
198185 )
199186
200187 dev .hex_path_app = temp_dest_folder / "merged.hex"
@@ -364,38 +351,29 @@ def __main():
364351
365352 # Reboot step finished
366353 # Build step start
367- child_image = True
368354
369355 if options .build is not None :
370356 print ("Invoking build step" )
371357 build_configs = []
372- if Core .app in cores :
373- if not Core .net in cores :
374- child_image = False
375-
376- if AudioDevice .headset in devices :
377- build_configs .append (
378- BuildConf (
379- core = Core .app ,
380- device = AudioDevice .headset ,
381- pristine = options .pristine ,
382- build = options .build ,
383- child_image = child_image ,
384- )
358+
359+ if AudioDevice .headset in devices :
360+ build_configs .append (
361+ BuildConf (
362+ core = cores ,
363+ device = AudioDevice .headset ,
364+ pristine = options .pristine ,
365+ build = options .build ,
385366 )
386- if AudioDevice .gateway in devices :
387- build_configs .append (
388- BuildConf (
389- core = Core .app ,
390- device = AudioDevice .gateway ,
391- pristine = options .pristine ,
392- build = options .build ,
393- child_image = child_image ,
394- )
367+ )
368+ if AudioDevice .gateway in devices :
369+ build_configs .append (
370+ BuildConf (
371+ core = cores ,
372+ device = AudioDevice .gateway ,
373+ pristine = options .pristine ,
374+ build = options .build ,
395375 )
396-
397- if Core .net in cores :
398- print ("Net core uses precompiled hex or child image" )
376+ )
399377
400378 for build_cfg in build_configs :
401379 __build_module (build_cfg , options )
@@ -406,7 +384,7 @@ def __main():
406384 if options .program :
407385 for dev in device_list :
408386 if dev .snr_connected :
409- __populate_hex_paths (dev , options , child_image )
387+ __populate_hex_paths (dev , options )
410388 program_threads_run (device_list , sequential = options .sequential_prog )
411389
412390 # Program step finished
0 commit comments