@@ -616,7 +616,6 @@ def validateVersAttr(version):
616616
617617
618618def  updateDeviceConfig (file ):
619-     file  =  paths .CONFIG_INPUT_DIR  /  file 
620619    # print('*** updateDeviceConfig: ', file) 
621620    # Update the firewall configuration in the OEM DEVICE config file 
622621    # This doesn't do anything except format the json file. 
@@ -685,10 +684,9 @@ def main():
685684    )
686685    parser .add_argument ("-v" , "--verbose" , help = "verbosity mode" , action = "store_true" )
687686    parser .add_argument (
688-         "--config-dir " ,
687+         "--config-file " ,
689688        type = str ,
690-         default = Path (os .path .dirname (__file__ )) /  "build/config" ,
691-         help = "directory with configuration files" ,
689+         help = "application device configuration file to use" ,
692690    )
693691    parser .add_argument (
694692        "--output-dir" ,
@@ -708,7 +706,6 @@ def main():
708706    # Set paths given on command line. 
709707    paths .TOOLKIT_DIR  =  Path (os .path .dirname (__file__ ))
710708    paths .CERT_INPUT_DIR  =  paths .TOOLKIT_DIR  /  "cert" 
711-     paths .CONFIG_INPUT_DIR  =  Path (args .config_dir )
712709    paths .FIRMWARE_INPUT_DIR  =  Path (args .firmware_dir )
713710    paths .OUTPUT_DIR  =  Path (args .output_dir )
714711
@@ -769,12 +766,22 @@ def main():
769766            sec ["binary" ] =  (paths .FIRMWARE_INPUT_DIR  /  sec ["binary" ]).as_posix ()
770767            continue 
771768
772-         print ("Generating Device Configuration for: "  +  sec ["binary" ])
773-         updateDeviceConfig (sec ["binary" ])
774-         gen_device_config (sec ["binary" ], False )
775-         sec ["binary" ] =  (
776-             (paths .OUTPUT_DIR  /  sec ["binary" ]).with_suffix (".bin" ).as_posix ()
777-         )
769+         # get app-device-config.json filename: either specified on command-line, or from config 
770+         if  args .config_file  is  not   None :
771+             input_device_config  =  args .config_file 
772+         else :
773+             input_device_config  =  sec ["binary" ]
774+             if  not  os .path .isabs (input_device_config ):
775+                 input_device_config  =  (
776+                     paths .TOOLKIT_DIR  /  "build/config"  /  input_device_config 
777+                 )
778+ 
779+         binary  =  os .path .basename (input_device_config )
780+ 
781+         print ("Generating Device Configuration for: "  +  binary )
782+         updateDeviceConfig (input_device_config )
783+         gen_device_config (input_device_config , False )
784+         sec ["binary" ] =  (paths .OUTPUT_DIR  /  binary ).with_suffix (".bin" ).as_posix ()
778785
779786    #     also check unmanaged images (mramAddress != 0) are between boundaries (OEM_BASE_ADDRESS - only in Rev_A as in Rev_B will be 0) 
780787    #     and images don't overlap... Also, advice is GAPs (big ones) exist - especially if tool can't create the layout... 
0 commit comments