diff --git a/toolkit/app-gen-toc.py b/toolkit/app-gen-toc.py index 4117854..f1cb601 100755 --- a/toolkit/app-gen-toc.py +++ b/toolkit/app-gen-toc.py @@ -616,7 +616,6 @@ def validateVersAttr(version): def updateDeviceConfig(file): - file = paths.CONFIG_INPUT_DIR / file # print('*** updateDeviceConfig: ', file) # Update the firewall configuration in the OEM DEVICE config file # This doesn't do anything except format the json file. @@ -685,10 +684,9 @@ def main(): ) parser.add_argument("-v", "--verbose", help="verbosity mode", action="store_true") parser.add_argument( - "--config-dir", + "--cfg-binary", type=str, - default=Path(os.path.dirname(__file__)) / "build/config", - help="directory with configuration files", + help="application device configuration file to use (overrides json 'binary' value)", ) parser.add_argument( "--output-dir", @@ -708,7 +706,6 @@ def main(): # Set paths given on command line. paths.TOOLKIT_DIR = Path(os.path.dirname(__file__)) paths.CERT_INPUT_DIR = paths.TOOLKIT_DIR / "cert" - paths.CONFIG_INPUT_DIR = Path(args.config_dir) paths.FIRMWARE_INPUT_DIR = Path(args.firmware_dir) paths.OUTPUT_DIR = Path(args.output_dir) @@ -769,12 +766,22 @@ def main(): sec["binary"] = (paths.FIRMWARE_INPUT_DIR / sec["binary"]).as_posix() continue - print("Generating Device Configuration for: " + sec["binary"]) - updateDeviceConfig(sec["binary"]) - gen_device_config(sec["binary"], False) - sec["binary"] = ( - (paths.OUTPUT_DIR / sec["binary"]).with_suffix(".bin").as_posix() - ) + # get app-device-config.json filename: either specified on command-line, or from config + if args.cfg_binary is not None: + input_device_config = args.cfg_binary + else: + input_device_config = sec["binary"] + if not os.path.isabs(input_device_config): + input_device_config = ( + paths.TOOLKIT_DIR / "build/config" / input_device_config + ) + + binary = os.path.basename(input_device_config) + + print("Generating Device Configuration for: " + binary) + updateDeviceConfig(input_device_config) + gen_device_config(input_device_config, False) + sec["binary"] = (paths.OUTPUT_DIR / binary).with_suffix(".bin").as_posix() # also check unmanaged images (mramAddress != 0) are between boundaries (OEM_BASE_ADDRESS - only in Rev_A as in Rev_B will be 0) # and images don't overlap... Also, advice is GAPs (big ones) exist - especially if tool can't create the layout... diff --git a/toolkit/utils/device_config.py b/toolkit/utils/device_config.py index adf4493..344cbd0 100644 --- a/toolkit/utils/device_config.py +++ b/toolkit/utils/device_config.py @@ -239,7 +239,6 @@ def processMiscellaneous(configuration): def gen_device_config(file, is_icv): - file = paths.CONFIG_INPUT_DIR / file cfg = read_global_config(file) validateSections(cfg, file) # request from SE-1938 f = createBinary((paths.OUTPUT_DIR / os.path.basename(file)).with_suffix(".bin")) diff --git a/toolkit/utils/paths.py b/toolkit/utils/paths.py index 2d0aa5c..433322e 100644 --- a/toolkit/utils/paths.py +++ b/toolkit/utils/paths.py @@ -2,6 +2,5 @@ TOOLKIT_DIR = "" CERT_INPUT_DIR = "" -CONFIG_INPUT_DIR = "" FIRMWARE_INPUT_DIR = "" OUTPUT_DIR = ""