Skip to content

Main

edgemark.main

check_package_requirements

check_package_requirements(requirements_file)

Check if the required packages are installed.

Parameters:

Name Type Description Default
requirements_file str

The path to the requirements file.

required

Returns:

Type Description
bool

True if all the required packages are installed, False otherwise.

Source code in edgemark/main.py
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
def check_package_requirements(requirements_file):
    """
    Check if the required packages are installed.

    Args:
        requirements_file (str): The path to the requirements file.

    Returns:
        bool: True if all the required packages are installed, False otherwise.
    """
    with open(requirements_file, 'r') as file:
        requirements = file.readlines()

    try:
        pkg_resources.require(requirements)
    except pkg_resources.UnknownExtra:  # Bug: we'll get this error even if everything is fine, so we'll ignore it
        pass
    except (pkg_resources.DistributionNotFound, pkg_resources.VersionConflict):
        return False

    return True

install_requirements

install_requirements(requirements_file)

Install the required packages.

Parameters:

Name Type Description Default
requirements_file str

The path to the requirements file.

required
Source code in edgemark/main.py
219
220
221
222
223
224
225
226
def install_requirements(requirements_file):
    """
    Install the required packages.

    Args:
        requirements_file (str): The path to the requirements file.
    """
    subprocess.run([sys.executable, '-m', 'pip', 'install', '-r', requirements_file, '--no-warn-script-location'])

main

main()

The main function to give a user-friendly interface to run the project.

Source code in edgemark/main.py
 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
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
def main():
    """
    The main function to give a user-friendly interface to run the project.
    """
    # configs
    reqirements_file = "requirements.txt"
    ei_converter_config_path = "edgemark/models/platforms/EI/configs/EI_converter_config.yaml"
    stm32_automate_config_path = "edgemark/models/automate/hardware_types/NUCLEO-L4R5ZI/configs/hardware_config.yaml"
    renesas_automate_config_path = "edgemark/models/automate/hardware_types/RenesasRX65N/configs/hardware_config.yaml"
    target_dir = "target_models"

    time_tag = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
    save_dir = os.path.join("benchmarking_results", time_tag)

    _clear_console()
    page = ""

    # check the all the required packages are installed
    installed_requirements = False
    while not check_package_requirements(reqirements_file):
        q = _Question("Packages are missing. What do you want to do",
                      description="Please make sure that you are in the correct environment.\nIt's best to create a new Conda environment with 'python 3.11.7'. The command would be 'conda create -n edgemark python=3.11.7'. Then activate the environment with 'conda activate edgemark' and run the project again.",
                      options=["Install packages for me", "I will install them myself"],
                      one_line_options=False,
                      default="Install packages for me")
        response = q.ask()
        _clear_console()
        page = q.summarize() + "\n"

        if response == "Install packages for me":
            install_requirements(reqirements_file)
            installed_requirements = True

        else:
            page += "You can find the requirements in the file '{}'. Please install them manually.".format(reqirements_file)
            print(page)
            return

    if installed_requirements:
        page += "Requirements are installed successfully.\n"
        page += "Please run the script again."
        _clear_console()
        print(page)
        return

    if import_error:
        page += "There was an " + COLOR_TERTIARY +  "error" + COLOR_RESET + " while importing the required modules.\n"
        page += "Please check the error below and fix the issue.\n"
        page += import_error_traceback
        _clear_console()
        print(page)
        return

    page = ""
    _clear_console()

    page += "Hello " + COLOR_SECONDARY + ":)" + COLOR_RESET + "\n"
    print(page)

    # get the modules to run

    available_modules = [
        "Generate TF models",
        "Generate Ekkono models",
        "Convert to TFLite",
        "Convert to TFLM",
        "Convert to Edge Impulse",
        "Convert to eAI Translator",
        "Test on NUCLEO-L4R5ZI (TFLM)",
        "Test on NUCLEO-L4R5ZI (Edge Impulse)",
        "Test on NUCLEO-L4R5ZI (Ekkono)",
        "Test on RenesasRX65N (TFLM)",
        "Test on RenesasRX65N (Edge Impulse)",
        "Test on RenesasRX65N (Ekkono)",
        "Test on RenesasRX65N (eAI Translator)"
    ]

    q = _Question("What do you want to do",
                  description="Here you can see the options for running the full pipeline (generating models, converting, testing). Choose 'Others' if you want to run specific modules.",
                  options=[
                      "TFLM + NUCLEO-L4R5ZI",
                      "TFLM + RenesasRX65N",
                      "Edge Impulse + NUCLEO-L4R5ZI",
                      "Edge Impulse + RenesasRX65N",
                      "Ekkono + NUCLEO-L4R5ZI",
                      "Ekkono + RenesasRX65N",
                      "eAI Translator + RenesasRX65N",
                      "Others"
                  ])
    response = q.ask()
    _clear_console()
    page += q.summarize() + "\n"
    print(page)

    if response == "TFLM + NUCLEO-L4R5ZI":
        modules = [
            "Generate TF models",
            "Convert to TFLite",
            "Convert to TFLM",
            "Test on NUCLEO-L4R5ZI (TFLM)"
        ]

    elif response == "TFLM + RenesasRX65N":
        modules = [
            "Generate TF models",
            "Convert to TFLite",
            "Convert to TFLM",
            "Test on RenesasRX65N (TFLM)"
        ]

    elif response == "Edge Impulse + NUCLEO-L4R5ZI":
        modules = [
            "Generate TF models",
            "Convert to TFLite",
            "Convert to Edge Impulse",
            "Test on NUCLEO-L4R5ZI (Edge Impulse)"
        ]

    elif response == "Edge Impulse + RenesasRX65N":
        modules = [
            "Generate TF models",
            "Convert to TFLite",
            "Convert to Edge Impulse",
            "Test on RenesasRX65N (Edge Impulse)"
        ]

    elif response == "Ekkono + NUCLEO-L4R5ZI":
        modules = [
            "Generate Ekkono models",
            "Test on NUCLEO-L4R5ZI (Ekkono)"
        ]

    elif response == "Ekkono + RenesasRX65N":
        modules = [
            "Generate Ekkono models",
            "Test on RenesasRX65N (Ekkono)"
        ]

    elif response == "eAI Translator + RenesasRX65N":
        modules = [
            "Generate TF models",
            "Convert to TFLite",
            "Convert to eAI Translator",
            "Test on RenesasRX65N (eAI Translator)"
        ]

    elif response == "Others":
        q = _Question("Which module(s) do you want to run",
                      description="You can choose multiple options by separating them with a plus sign (+). Example: 1+2\nThe rationality of the sequence of the modules is user's responsibility.",
                      options=available_modules)
        def _check_response(response):
            valid = True
            for m in response.split("+"):
                if not m.isdigit() or int(m) < 1 or int(m) > len(available_modules):
                    valid = False
                    break
            if valid:
                response = [available_modules[int(m) - 1] for m in response.split("+")]
                response = " + ".join(response)
            return valid, response
        q.check_response = _check_response
        response = q.ask()
        _clear_console()
        page += q.summarize() + "\n"
        print(page)

        modules = [module.strip() for module in response.split("+")]

    # check requirements of the modules
    modules_requiremets = []

    if "Generate Ekkono models" in modules:
        if "ekkono_sdk" not in modules_requiremets:
            modules_requiremets.append("ekkono_sdk")

    if "Convert to Edge Impulse" in modules:
        if "edge_impulse_secrets" not in modules_requiremets:
            modules_requiremets.append("edge_impulse_secrets")

    if ("Test on NUCLEO-L4R5ZI (TFLM)" in modules or
        "Test on NUCLEO-L4R5ZI (Edge Impulse)" in modules or
        "Test on NUCLEO-L4R5ZI (Ekkono)" in modules):
        if "stm32cubeide" not in modules_requiremets:
            modules_requiremets.append("stm32cubeide")
        if "stm32_programmer_cli" not in modules_requiremets:
            modules_requiremets.append("stm32_programmer_cli")

    if ("Test on RenesasRX65N (TFLM)" in modules or
        "Test on RenesasRX65N (Edge Impulse)" in modules or
        "Test on RenesasRX65N (Ekkono)" in modules or
        "Test on RenesasRX65N (eAI Translator)" in modules):
        if "e2studio" not in modules_requiremets:
            modules_requiremets.append("e2studio")
        if "rfp" not in modules_requiremets:
            modules_requiremets.append("rfp")

    # check if the requirements are satisfied
    if "ekkono_sdk" in modules_requiremets:
        while not _check_ekkono_installation():
            _clear_console()
            print(page)
            q = _Question("Ekkono is not installed. Please provide the path to the wheel file",
                          description="Ekkono is not free. If you want to use it, you need to buy this product from https://www.ekkono.ai, download the its files and provide the wheel path here.\nFor example, put the files in 'edgemark/models/platforms/Ekkono' and provide the path 'edgemark/models/platforms/Ekkono/ekkono-sdk/primer/python/{distribution}/{python-version}/ekkono.primer-{name-suffix}.whl'")
            q.check_response = lambda response: (True, response) if (os.path.exists(response) and response.endswith(".whl")) else (False, None)
            response = q.ask()
            subprocess.run([sys.executable, '-m', 'pip', 'install', response])
            print("Ekkono has been installed. Please run the script again.")
            return
        _clear_console()
        print(page)

    if "edge_impulse_secrets" in modules_requiremets:
        ei_converter_config = OmegaConf.load(ei_converter_config_path)
        if os.path.exists(ei_converter_config.user_config):
            ei_converter_user_config = OmegaConf.load(ei_converter_config.user_config)
        else:
            ei_converter_user_config = OmegaConf.create()

        valid_ei_api_key = False
        if "ei_api_key" in ei_converter_user_config:
            if ei_converter_user_config.ei_api_key.startswith("ei_"):
                valid_ei_api_key = True

        if not valid_ei_api_key:
            q = _Question("Edge Impulse information is missing. Please provide the API key",
                          description="If you don't have an account, please create one at https://www.edgeimpulse.com. The API key can be found in the 'Keys' section of the project. You can also access this page by its address: https://studio.edgeimpulse.com/studio/{project_id}/keys")
            q.check_response = lambda response: (True, response) if response.startswith("ei_") else (False, None)
            response = q.ask()
            _clear_console()
            print(page)

            ei_converter_user_config.ei_api_key = response
            OmegaConf.save(ei_converter_user_config, ei_converter_config.user_config)

        valid_ei_project_id = False
        if "ei_project_id" in ei_converter_user_config:
            valid_ei_project_id = True

        if not valid_ei_project_id:
            q = _Question("Edge Impulse information is missing. Please provide the project ID",
                          description="The project ID can be found in the main page of the project ('project info' section). You can also find it by looking at the URL of the page: https://studio.edgeimpulse.com/studio/{project_id}")
            q.check_response = lambda response: (True, response) if response.isdigit() else (False, None)
            response = q.ask()
            _clear_console()
            print(page)

            ei_converter_user_config.ei_project_id = response
            OmegaConf.save(ei_converter_user_config, ei_converter_config.user_config)

    if "stm32cubeide" in modules_requiremets:
        stm32_automate_config = OmegaConf.load(stm32_automate_config_path)
        if os.path.exists(stm32_automate_config.user_config):
            stm32_automate_user_config = OmegaConf.load(stm32_automate_config.user_config)
        else:
            stm32_automate_user_config = OmegaConf.create()

        valid_stm32cubeide_path = False
        if "stm32cubeide_path" in stm32_automate_user_config:
            if os.path.exists(stm32_automate_user_config.stm32cubeide_path) or os.path.exists(stm32_automate_user_config.stm32cubeide_path + ".exe"):
                valid_stm32cubeide_path = True

        if not valid_stm32cubeide_path:
            q = _Question("Could not find a valid STM32CubeIDE path. Please provide the path to the STM32CubeIDE executable",
                          description="If you don't have STM32CubeIDE, you can download it from https://www.st.com/en/development-tools/stm32cubeide.html\nIf you have already installed it, the executable path will be {installation_dir}/STM32CubeIDE_{version}/STM32CubeIDE/stm32cubeide.exe. For example, C:/ST/STM32CubeIDE_1.14.1/STM32CubeIDE/stm32cubeide.exe\nThe project was tested against STM32CubeIDE version 1.14.1")
            q.check_response = lambda response: (True, response) if os.path.exists(response) or os.path.exists(response + ".exe") else (False, None)
            response = q.ask()
            _clear_console()
            print(page)

            stm32_automate_user_config.stm32cubeide_path = response
            OmegaConf.save(stm32_automate_user_config, stm32_automate_config.user_config)

        valid_workspace_dir = False
        if "workspace_dir" in stm32_automate_user_config:
            if os.path.exists(stm32_automate_user_config.workspace_dir):
                valid_workspace_dir = True

        if not valid_workspace_dir:
            q = _Question("STM32CubeIDE workspace directory does not exist. Please provide the workspace directory",
                          description="When STM32CubeIDE is open, you can find the workspace directory in File > Switch Workspace > Other...")
            q.check_response = lambda response: (True, response) if os.path.exists(response) else (False, None)
            response = q.ask()
            _clear_console()
            print(page)

            stm32_automate_user_config.workspace_dir = response
            OmegaConf.save(stm32_automate_user_config, stm32_automate_config.user_config)

        if "Test on NUCLEO-L4R5ZI (TFLM)" in modules:
            stm32_automate_config.project_name = "NUCLEO-L4R5ZI_TFLM"
            q = _Question("Can you confirm that the NUCLEO-L4R5ZI_TFLM project exists in your STM32CubeIDE's projects and also in this location: {}".format(stm32_automate_config.project_dir),
                          description="If you don't have the project in the specified location, probably you can find the zipped project in that directory. You can extract it and import it in STM32CubeIDE.",
                          options=["y", "n"],
                          one_line_options=True,
                          default="y")
            response = q.ask()
            if response == "n":
                print("Please create the project and run the script again.")
                return
            _clear_console()
            print(page)

        if "Test on NUCLEO-L4R5ZI (Edge Impulse)" in modules:
            stm32_automate_config.project_name = "NUCLEO-L4R5ZI_EI"
            q = _Question("Can you confirm that the NUCLEO-L4R5ZI_EI project exists in your STM32CubeIDE's projects and also in this location: {}".format(stm32_automate_config.project_dir),
                          description="If you don't have the project in the specified location, probably you can find the zipped project in that directory. You can extract it and import it in STM32CubeIDE.",
                          options=["y", "n"],
                          one_line_options=True,
                          default="y")
            response = q.ask()
            if response == "n":
                print("Please create the project and run the script again.")
                return
            _clear_console()
            print(page)

        if "Test on NUCLEO-L4R5ZI (Ekkono)" in modules:
            stm32_automate_config.project_name = "NUCLEO-L4R5ZI_Ekkono"
            q = _Question("Can you confirm that the NUCLEO-L4R5ZI_Ekkono project exists in your STM32CubeIDE's projects and also in this location: {}".format(stm32_automate_config.project_dir),
                          description="If you don't have the project in the specified location, probably you can find the zipped project in that directory. You can extract it and import it in STM32CubeIDE.",
                          options=["y", "n"],
                          one_line_options=True,
                          default="y")
            response = q.ask()
            if response == "n":
                print("Please create the project and run the script again.")
                return
            _clear_console()
            print(page)

    if "stm32_programmer_cli" in modules_requiremets:
        stm32_automate_config = OmegaConf.load(stm32_automate_config_path)
        if os.path.exists(stm32_automate_config.user_config):
            stm32_automate_user_config = OmegaConf.load(stm32_automate_config.user_config)
        else:
            stm32_automate_user_config = OmegaConf.create()

        valid_stm32_programmer_path = False
        if "stm32_programmer_path" in stm32_automate_user_config:
            if os.path.exists(stm32_automate_user_config.stm32_programmer_path) or os.path.exists(stm32_automate_user_config.stm32_programmer_path + ".exe"):
                valid_stm32_programmer_path = True

        if not valid_stm32_programmer_path:
            q = _Question("Could not find a valid STM32 Programmer CLI path. Please provide the path to the STM32 Programmer CLI executable",
                          description="STM32 Programmer CLI is a part of STM32CubeCLT. So, if you don't have STM32 Programmer CLI, you can download the STM32CubeCLT from https://www.st.com/en/development-tools/stm32cubeclt.html\nOnce you have installed it, the executable should be in {installation_dir}/STM32CubeCLT_{version}/STM32CubeProgrammer/bin/STM32_programmer_CLI.exe. For example, C:/ST/STM32CubeCLT_1.15.1/STM32CubeProgrammer/bin/STM32_programmer_CLI.exe\nThe project was tested against STM32CubeProgrammer version 2.16.0")
            q.check_response = lambda response: (True, response) if os.path.exists(response) or os.path.exists(response + ".exe") else (False, None)
            response = q.ask()
            _clear_console()
            print(page)

            stm32_automate_user_config.stm32_programmer_path = response
            OmegaConf.save(stm32_automate_user_config, stm32_automate_config.user_config)

    if "e2studio" in modules_requiremets:
        renesas_automate_config = OmegaConf.load(renesas_automate_config_path)
        if os.path.exists(renesas_automate_config.user_config):
            renesas_automate_user_config = OmegaConf.load(renesas_automate_config.user_config)
        else:
            renesas_automate_user_config = OmegaConf.create()

        valid_e2studio_path = False
        if "e2studio_path" in renesas_automate_user_config:
            if os.path.exists(renesas_automate_user_config.e2studio_path) or os.path.exists(renesas_automate_user_config.e2studio_path + ".exe"):
                valid_e2studio_path = True

        if not valid_e2studio_path:
            q = _Question("Could not find a valid e2 studio path. Please provide the path to the e2 studio executable",
                          description="If you don't have e2 studio, you can download it from https://www.renesas.com/us/en/software-tool/e-studio\nOnce you have installed it, the executable should be {installation_dir}/Renesas/e2_studio/eclipse/e2studioc.exe. For example, C:/Renesas/e2_studio/eclipse/e2studioc.exe\nThe project was tested against e2 studio version 24.1.1")
            q.check_response = lambda response: (True, response) if os.path.exists(response) or os.path.exists(response + ".exe") else (False, None)
            response = q.ask()
            _clear_console()
            print(page)

            renesas_automate_user_config.e2studio_path = response
            OmegaConf.save(renesas_automate_user_config, renesas_automate_config.user_config)

        valid_workspace_dir = False
        if "workspace_dir" in renesas_automate_user_config:
            if os.path.exists(renesas_automate_user_config.workspace_dir):
                valid_workspace_dir = True

        if not valid_workspace_dir:
            q = _Question("e2 studio workspace directory does not exist. Please provide the workspace directory",
                          description="When e2 studio is open, you can find the workspace directory in File > Switch Workspace > Other...")
            q.check_response = lambda response: (True, response) if os.path.exists(response) else (False, None)
            response = q.ask()
            _clear_console()
            print(page)

            renesas_automate_user_config.workspace_dir = response
            OmegaConf.save(renesas_automate_user_config, renesas_automate_config.user_config)

        if "Test on RenesasRX65N (TFLM)" in modules:
            renesas_automate_config.project_name = "RenesasRX_TFLM"
            q = _Question("Can you confirm that the RenesasRX_TFLM project exists in your e2 studio's projects and also in this location: {}".format(renesas_automate_config.project_dir),
                          description="If you don't have the project in the specified location, probably you can find the zipped project in that directory. You can extract it and import it in e2 studio.",
                          options=["y", "n"],
                          one_line_options=True,
                          default="y")
            response = q.ask()
            if response == "n":
                print("Please create the project and run the script again.")
                return
            _clear_console()
            print(page)

        if "Test on RenesasRX65N (Edge Impulse)" in modules:
            renesas_automate_config.project_name = "RenesasRX_EI"
            q = _Question("Can you confirm that the RenesasRX_EI project exists in your e2 studio's projects and also in this location: {}".format(renesas_automate_config.project_dir),
                          description="If you don't have the project in the specified location, probably you can find the zipped project in that directory. You can extract it and import it in e2 studio.",
                          options=["y", "n"],
                          one_line_options=True,
                          default="y")
            response = q.ask()
            if response == "n":
                print("Please create the project and run the script again.")
                return
            _clear_console()
            print(page)

        if "Test on RenesasRX65N (Ekkono)" in modules:
            renesas_automate_config.project_name = "RenesasRX_Ekkono"
            q = _Question("Can you confirm that the RenesasRX_Ekkono project exists in your e2 studio's projects and also in this location: {}".format(renesas_automate_config.project_dir),
                          description="If you don't have the project in the specified location, probably you can find the zipped project in that directory. You can extract it and import it in e2 studio.",
                          options=["y", "n"],
                          one_line_options=True,
                          default="y")
            response = q.ask()
            if response == "n":
                print("Please create the project and run the script again.")
                return
            _clear_console()
            print(page)

        if "Test on RenesasRX65N (eAI Translator)" in modules:
            renesas_automate_config.project_name = "RenesasRX_eAI_Translator"
            q = _Question("Can you confirm that the RenesasRX_eAI_Translator project exists in your e2 studio's projects and also in this location: {}".format(renesas_automate_config.project_dir),
                          description="If you don't have the project in the specified location, probably you can find the zipped project in that directory. You can extract it and import it in e2 studio.",
                          options=["y", "n"],
                          one_line_options=True,
                          default="y")
            response = q.ask()
            if response == "n":
                print("Please create the project and run the script again.")
                return
            _clear_console()
            print(page)

    if "rfp" in modules_requiremets:
        renesas_automate_config = OmegaConf.load(renesas_automate_config_path)
        if os.path.exists(renesas_automate_config.user_config):
            renesas_automate_user_config = OmegaConf.load(renesas_automate_config.user_config)
        else:
            renesas_automate_user_config = OmegaConf.create()

        valid_rfp_path = False
        if "rfp_path" in renesas_automate_user_config:
            if os.path.exists(renesas_automate_user_config.rfp_path) or os.path.exists(renesas_automate_user_config.rfp_path + ".exe"):
                valid_rfp_path = True

        if not valid_rfp_path:
            q = _Question("Could not find a valid Renesas Flash Programmer path. Please provide the path to the Renesas Flash Programmer executable",
                          description="If you don't have Renesas Flash Programmer, you can download it from https://www.renesas.com/us/en/software-tool/renesas-flash-programmer-programming-gui#downloads\nOnce you have installed it, the executable should be {installation_dir}/Renesas Electronics/Programming Tools/Renesas Flash Programmer V{version}/RFPV{version}.exe. For example, C:/Program Files (x86)/Renesas Electronics/Programming Tools/Renesas Flash Programmer V3.15/RFPV3.exe\nThe project was tested against Renesas Flash Programmer version 3.15.00")
            q.check_response = lambda response: (True, response) if os.path.exists(response) or os.path.exists(response + ".exe") else (False, None)
            response = q.ask()
            _clear_console()
            print(page)

            renesas_automate_user_config.rfp_path = response
            OmegaConf.save(renesas_automate_user_config, renesas_automate_config.user_config)

        valid_rfp_project_path = False
        if "rfp_project_path" in renesas_automate_user_config:
            if os.path.exists(renesas_automate_user_config.rfp_project_path):
                valid_rfp_project_path = True

        if not valid_rfp_project_path:
            q = _Question("Could not find a valid Renesas Flash Programmer project path. Please provide the path to the Renesas Flash Programmer project file",
                          description="The project file is a '.rpj' file that you can create in Renesas Flash Programmer.\nTo create a project file, open Renesas Flash Programmer and do the following steps:\n- File > New Project...\n- Microcontroller: RX65x\n- Tool: E2 emulator Lite\n- Interface: FINE\n- Tool Details... > Reset Settings > Reset signal at Disconnect: Reset Pin as Hi-Z\nOnce you have created the project, enter the path to the project file here")
            q.check_response = lambda response: (True, response) if response.endswith(".rpj") and os.path.exists(response) else (False, None)
            response = q.ask()
            _clear_console()
            print(page)

            renesas_automate_user_config.rfp_project_path = response
            OmegaConf.save(renesas_automate_user_config, renesas_automate_config.user_config)

    if ("Generate TF models" in modules or
        "Generate Ekkono models" in modules):
        while True:
            q = _Question("Please put all your model files in the {} directory. Can you confirm that this is done".format(target_dir),
                          description="You can follow the instructions in the {}. In short, the files that do not have dot (.) in their path will be generated".format(target_dir + "/README.md"),
                          options=["y"],
                          one_line_options=True,
                          default="y")
            response = q.ask()
            _clear_console()
            print(page)
            if response == "y":
                break

    if ("Test on NUCLEO-L4R5ZI (TFLM)" in modules or
        "Test on NUCLEO-L4R5ZI (Edge Impulse)" in modules or
        "Test on NUCLEO-L4R5ZI (Ekkono)" in modules):
        while True:
            q = _Question("Please\n- Connect the NUCLEO-L4R5ZI board to the computer\n- Close STM32CubeIDE\n- Close any serial monitor applications (e.g. PuTTY)\nCan you confirm that these items are addressed",
                        options=["y"],
                        one_line_options=True,
                        default="y")
            response = q.ask()
            _clear_console()
            print(page)
            if response == "y":
                break

    if ("Test on RenesasRX65N (TFLM)" in modules or
        "Test on RenesasRX65N (Edge Impulse)" in modules or
        "Test on RenesasRX65N (Ekkono)" in modules or
        "Test on RenesasRX65N (eAI Translator)" in modules):
        while True:
            q = _Question("Please\n- Connect the Renesas RX65N board to the computer\n- Connect a USB to TTL cable between your computer and the board\n- Close e2 studio\n- Close Renesas Flash Programmer\n- Close any serial monitor applications (e.g. PuTTY)\nCan you confirm that these items are addressed",
                        options=["y"],
                        one_line_options=True,
                        default="y")
            response = q.ask()
            _clear_console()
            print(page)
            if response == "y":
                break

    # run the modules
    page += "\n" + COLOR_TERTIARY + "Running the modules" + COLOR_RESET + "\n"
    _clear_console()
    print(page)

    flawless = True
    for i, module in enumerate(modules):
        page += colorama.Style.DIM + "[{}/{}]".format(i + 1, len(modules)) + COLOR_RESET + " "

        if module == "Generate TF models":
            page += "Generating TensorFlow models"
            _clear_console()
            print(page)

            print(colorama.Style.DIM + "\n\n\n" + "="*80 + "\n" + "Module output:")
            output = tf_model_generator.main()

            n_targets = len(output)
            n_success = 0
            failures = []
            for target in output:
                if target["result"] == "success":
                    n_success += 1
                else:
                    report = "Model: {}\n\n".format(target["name"])
                    report += "Traceback:\n{}".format(target["traceback"])

                    report_name = target["name"].replace("/", " - ").replace("\\", " - ")
                    report_path = os.path.join(save_dir, "errors/Generate TF models", "{}.txt".format(report_name))
                    os.makedirs(os.path.dirname(report_path), exist_ok=True)
                    with open(report_path, "w") as file:
                        file.write(report)

                    failures.append({
                        "name": target["name"],
                        "error": target["error"],
                        "report_path": report_path.replace("\\", "/")
                    })

            if n_success == n_targets:
                page += COLOR_SECONDARY + " ({}/{})\n".format(n_success, n_targets) + COLOR_RESET
            else:
                flawless = False
                page += COLOR_TERTIARY + " ({}/{})\n".format(n_success, n_targets) + COLOR_RESET
                page += "Failed models:\n"
                for failure in failures:
                    page += "- Model: {}\n".format(failure["name"])
                    page += "  Error: {}\n".format(failure["error"])
                    page += "  Details: {}\n".format(failure["report_path"])

            _clear_console()
            print(page)

            if n_success == 0 and i < len(modules) - 1:
                q = _Question("No model has survived. Do you want to continue",
                              description="If the following modules are dependent on the output of this module, this will probably lead to errors.",
                              options=["y", "n"],
                              one_line_options=True,
                              default="n")
                response = q.ask()
                if response == "n":
                    return

            _clear_console()
            print(page)

        elif module == "Generate Ekkono models":
            page += "Generating Ekkono models"
            _clear_console()
            print(page)

            print(colorama.Style.DIM + "\n\n\n" + "="*80 + "\n" + "Module output:")
            output = ekkono_model_generator.main()

            n_targets = len(output)
            n_success = 0
            failures = []
            for target in output:
                if target["result"] == "success":
                    n_success += 1
                else:
                    report = "Model: {}\n\n".format(target["name"])
                    report += "Traceback:\n{}".format(target["traceback"])

                    report_name = target["name"].replace("/", " - ").replace("\\", " - ")
                    report_path = os.path.join(save_dir, "errors/Generate Ekkono models", "{}.txt".format(report_name))
                    os.makedirs(os.path.dirname(report_path), exist_ok=True)
                    with open(report_path, "w") as file:
                        file.write(report)

                    failures.append({
                        "name": target["name"],
                        "error": target["error"],
                        "report_path": report_path.replace("\\", "/")
                    })

            if n_success == n_targets:
                page += COLOR_SECONDARY + " ({}/{})\n".format(n_success, n_targets) + COLOR_RESET
            else:
                flawless = False
                page += COLOR_TERTIARY + " ({}/{})\n".format(n_success, n_targets) + COLOR_RESET
                page += "Failed models:\n"
                for failure in failures:
                    page += "- Model: {}\n".format(failure["name"])
                    page += "  Error: {}\n".format(failure["error"])
                    page += "  Details: {}\n".format(failure["report_path"])

            _clear_console()
            print(page)

            if n_success == 0 and i < len(modules) - 1:
                q = _Question("No model has survived. Do you want to continue",
                              description="If the following modules are dependent on the output of this module, this will probably lead to errors.",
                              options=["y", "n"],
                              one_line_options=True,
                              default="n")
                response = q.ask()
                if response == "n":
                    return

            _clear_console()
            print(page)

        elif module == "Convert to TFLite":
            page += "Converting TensorFlow models to TFLite"
            _clear_console()
            print(page)

            print(colorama.Style.DIM + "\n\n\n" + "="*80 + "\n" + "Module output:")
            output = tflite_converter.main()

            n_targets = 0
            n_success = 0
            failures = []
            for target in output:
                for flavor in target["flavors"]:
                    n_targets += 1
                    if flavor["result"] == "success":
                        n_success += 1
                    else:
                        report = "Model: {}\nFlavor: {}\n\n".format(target["dir"], flavor["flavor"])
                        if "traceback" in flavor:
                            report += "Traceback:\n{}".format(flavor["traceback"])
                        else:
                            report += "Exception file path: {}\n".format(flavor["exception_file"])

                        report_name = os.path.basename(target["dir"])
                        report_name += "_" + flavor["flavor"]
                        report_name = report_name.replace("/", " - ").replace("\\", " - ")
                        report_path = os.path.join(save_dir, "errors/Convert to TFLite", "{}.txt".format(report_name))
                        os.makedirs(os.path.dirname(report_path), exist_ok=True)
                        with open(report_path, "w") as file:
                            file.write(report)

                        failures.append({
                            "dir": target["dir"],
                            "flavor": flavor["flavor"],
                            "error": flavor["error"],
                            "report_path": report_path.replace("\\", "/")
                        })

            if n_success == n_targets:
                page += COLOR_SECONDARY + " ({}/{})\n".format(n_success, n_targets) + COLOR_RESET
            else:
                flawless = False
                page += COLOR_TERTIARY + " ({}/{})\n".format(n_success, n_targets) + COLOR_RESET
                page += "Failed models:\n"
                for failure in failures:
                    page += "- Model: {} >> {}\n".format(failure["dir"], failure["flavor"])
                    page += "  Error: {}\n".format(failure["error"])
                    page += "  Details: {}\n".format(failure["report_path"])

            _clear_console()
            print(page)

            if n_success == 0 and i < len(modules) - 1:
                q = _Question("No model has survived. Do you want to continue",
                              description="If the following modules are dependent on the output of this module, this will probably lead to errors.",
                              options=["y", "n"],
                              one_line_options=True,
                              default="n")
                response = q.ask()
                if response == "n":
                    return

            _clear_console()
            print(page)

        elif module == "Convert to TFLM":
            page += "Converting TFLite models to TFLM"
            _clear_console()
            print(page)

            print(colorama.Style.DIM + "\n\n\n" + "="*80 + "\n" + "Module output:")
            output = tflm_converter.main()

            n_targets = 0
            n_success = 0
            failures = []
            for target in output:
                for flavor in target["flavors"]:
                    n_targets += 1
                    if flavor["result"] == "success":
                        n_success += 1
                    else:
                        report = "Model: {}\nFlavor: {}\n\n".format(target["dir"], flavor["flavor"])
                        report += "Traceback:\n{}".format(flavor["traceback"])

                        report_name = os.path.basename(target["dir"])
                        report_name += "_" + flavor["flavor"]
                        report_name = report_name.replace("/", " - ").replace("\\", " - ")
                        report_path = os.path.join(save_dir, "errors/Convert to TFLM", "{}.txt".format(report_name))
                        os.makedirs(os.path.dirname(report_path), exist_ok=True)
                        with open(report_path, "w") as file:
                            file.write(report)

                        failures.append({
                            "dir": target["dir"],
                            "flavor": flavor["flavor"],
                            "error": flavor["error"],
                            "report_path": report_path.replace("\\", "/")
                        })

            if n_success == n_targets:
                page += COLOR_SECONDARY + " ({}/{})\n".format(n_success, n_targets) + COLOR_RESET
            else:
                flawless = False
                page += COLOR_TERTIARY + " ({}/{})\n".format(n_success, n_targets) + COLOR_RESET
                page += "Failed models:\n"
                for failure in failures:
                    page += "- Model: {} >> {}\n".format(failure["dir"], failure["flavor"])
                    page += "  Error: {}\n".format(failure["error"])
                    page += "  Details: {}\n".format(failure["report_path"])

            _clear_console()
            print(page)

            if n_success == 0 and i < len(modules) - 1:
                q = _Question("No model has survived. Do you want to continue",
                              description="If the following modules are dependent on the output of this module, this will probably lead to errors.",
                              options=["y", "n"],
                              one_line_options=True,
                              default="n")
                response = q.ask()
                if response == "n":
                    return

            _clear_console()
            print(page)

        elif module == "Convert to Edge Impulse":
            page += "Converting TFLite models to Edge Impulse"
            _clear_console()
            print(page)

            print(colorama.Style.DIM + "\n\n\n" + "="*80 + "\n" + "Module output:")
            output = ei_converter.main()

            n_targets = 0
            n_success = 0
            failures = []
            for target in output:
                for flavor in target["flavors"]:
                    n_targets += 1
                    if flavor["result"] == "success":
                        n_success += 1
                    else:
                        report = "Model: {}\nFlavor: {}\n\n".format(target["dir"], flavor["flavor"])
                        report += "Traceback:\n{}".format(flavor["traceback"])

                        report_name = os.path.basename(target["dir"])
                        report_name += "_" + flavor["flavor"]
                        report_name = report_name.replace("/", " - ").replace("\\", " - ")
                        report_path = os.path.join(save_dir, "errors/Convert to Edge Impulse", "{}.txt".format(report_name))
                        os.makedirs(os.path.dirname(report_path), exist_ok=True)
                        with open(report_path, "w") as file:
                            file.write(report)

                        failures.append({
                            "dir": target["dir"],
                            "flavor": flavor["flavor"],
                            "error": flavor["error"],
                            "report_path": report_path.replace("\\", "/")
                        })

            if n_success == n_targets:
                page += COLOR_SECONDARY + " ({}/{})\n".format(n_success, n_targets) + COLOR_RESET
            else:
                flawless = False
                page += COLOR_TERTIARY + " ({}/{})\n".format(n_success, n_targets) + COLOR_RESET
                page += "Failed models:\n"
                for failure in failures:
                    page += "- Model: {} >> {}\n".format(failure["dir"], failure["flavor"])
                    page += "  Error: {}\n".format(failure["error"])
                    page += "  Details: {}\n".format(failure["report_path"])

            _clear_console()
            print(page)

            if n_success == 0 and i < len(modules) - 1:
                q = _Question("No model has survived. Do you want to continue",
                              description="If the following modules are dependent on the output of this module, this will probably lead to errors.",
                              options=["y", "n"],
                              one_line_options=True,
                              default="n")
                response = q.ask()
                if response == "n":
                    return

            _clear_console()
            print(page)

        elif module == "Convert to eAI Translator":
            page += "Converting TFLite models to eAI Translator"
            _clear_console()
            print(page)

            print(colorama.Style.DIM + "\n\n\n" + "="*80 + "\n" + "Module output:")
            output = eai_translator_converter.main()

            n_targets = 0
            n_success = 0
            failures = []
            for target in output:
                for flavor in target["flavors"]:
                    n_targets += 1
                    if flavor["result"] == "success":
                        n_success += 1
                    else:
                        report = "Model: {}\nFlavor: {}\n\n".format(target["dir"], flavor["flavor"])
                        report += "Traceback:\n{}".format(flavor["traceback"])

                        report_name = os.path.basename(target["dir"])
                        report_name += "_" + flavor["flavor"]
                        report_name = report_name.replace("/", " - ").replace("\\", " - ")
                        report_path = os.path.join(save_dir, "errors/Convert to eAI Translator", "{}.txt".format(report_name))
                        os.makedirs(os.path.dirname(report_path), exist_ok=True)
                        with open(report_path, "w") as file:
                            file.write(report)

                        failures.append({
                            "dir": target["dir"],
                            "flavor": flavor["flavor"],
                            "error": flavor["error"],
                            "report_path": report_path.replace("\\", "/")
                        })

            if n_success == n_targets:
                page += COLOR_SECONDARY + " ({}/{})\n".format(n_success, n_targets) + COLOR_RESET
            else:
                flawless = False
                page += COLOR_TERTIARY + " ({}/{})\n".format(n_success, n_targets) + COLOR_RESET
                page += "Failed models:\n"
                for failure in failures:
                    page += "- Model: {} >> {}\n".format(failure["dir"], failure["flavor"])
                    page += "  Error: {}\n".format(failure["error"])
                    page += "  Details: {}\n".format(failure["report_path"])

            _clear_console()
            print(page)

            if n_success == 0 and i < len(modules) - 1:
                q = _Question("No model has survived. Do you want to continue",
                              description="If the following modules are dependent on the output of this module, this will probably lead to errors.",
                              options=["y", "n"],
                              one_line_options=True,
                              default="n")
                response = q.ask()
                if response == "n":
                    return

            _clear_console()
            print(page)

        elif module == "Test on NUCLEO-L4R5ZI (TFLM)":
            page += "Testing TFLM models on NUCLEO-L4R5ZI"
            _clear_console()
            print(page)

            print(colorama.Style.DIM + "\n\n\n" + "="*80 + "\n" + "Module output:")
            output = automate.main(software_platform="TFLM", hardware_platform="NUCLEO-L4R5ZI", save_path=os.path.join(save_dir, "TFLM + NUCLEO-L4R5ZI.xlsx"))

            n_targets = len(output)
            n_success = 0
            failures = []
            for target in output:
                if target["result"] == "success":
                    n_success += 1
                else:
                    report = "Model: {}\n\n".format(target["dir"])
                    if "traceback" in target:
                        report += "Traceback:\n{}".format(target["traceback"])
                    else:
                        report += "Error file path: {}\n".format(target["error_file"])

                    report_name = target["dir"]
                    report_name = report_name.replace("/", " - ").replace("\\", " - ")
                    report_path = os.path.join(save_dir, "errors/Test on NUCLEO-L4R5ZI (TFLM)", "{}.txt".format(report_name))
                    os.makedirs(os.path.dirname(report_path), exist_ok=True)
                    with open(report_path, "w") as file:
                        file.write(report)

                    failures.append({
                        "dir": target["dir"],
                        "error": target["error"],
                        "report_path": report_path.replace("\\", "/")
                    })

            if n_success == n_targets:
                page += COLOR_SECONDARY + " ({}/{})\n".format(n_success, n_targets) + COLOR_RESET
            else:
                flawless = False
                page += COLOR_TERTIARY + " ({}/{})\n".format(n_success, n_targets) + COLOR_RESET
                page += "Failed models:\n"
                for failure in failures:
                    page += "- Model: {}\n".format(failure["dir"])
                    page += "  Error: {}\n".format(failure["error"])
                    page += "  Details: {}\n".format(failure["report_path"])

            _clear_console()
            print(page)

        elif module == "Test on NUCLEO-L4R5ZI (Edge Impulse)":
            page += "Testing Edge Impulse models on NUCLEO-L4R5ZI"
            _clear_console()
            print(page)

            print(colorama.Style.DIM + "\n\n\n" + "="*80 + "\n" + "Module output:")
            output = automate.main(software_platform="EI", hardware_platform="NUCLEO-L4R5ZI", save_path=os.path.join(save_dir, "Edge Impulse + NUCLEO-L4R5ZI.xlsx"))

            n_targets = len(output)
            n_success = 0
            failures = []
            for target in output:
                if target["result"] == "success":
                    n_success += 1
                else:
                    report = "Model: {}\n\n".format(target["dir"])
                    if "traceback" in target:
                        report += "Traceback:\n{}".format(target["traceback"])
                    else:
                        report += "Error file path: {}\n".format(target["error_file"])

                    report_name = target["dir"]
                    report_name = report_name.replace("/", " - ").replace("\\", " - ")
                    report_path = os.path.join(save_dir, "errors/Test on NUCLEO-L4R5ZI (Edge Impulse)", "{}.txt".format(report_name))
                    os.makedirs(os.path.dirname(report_path), exist_ok=True)
                    with open(report_path, "w") as file:
                        file.write(report)

                    failures.append({
                        "dir": target["dir"],
                        "error": target["error"],
                        "report_path": report_path.replace("\\", "/")
                    })

            if n_success == n_targets:
                page += COLOR_SECONDARY + " ({}/{})\n".format(n_success, n_targets) + COLOR_RESET
            else:
                flawless = False
                page += COLOR_TERTIARY + " ({}/{})\n".format(n_success, n_targets) + COLOR_RESET
                page += "Failed models:\n"
                for failure in failures:
                    page += "- Model: {}\n".format(failure["dir"])
                    page += "  Error: {}\n".format(failure["error"])
                    page += "  Details: {}\n".format(failure["report_path"])

            _clear_console()
            print(page)

        elif module == "Test on NUCLEO-L4R5ZI (Ekkono)":
            page += "Testing Ekkono models on NUCLEO-L4R5ZI"
            _clear_console()
            print(page)

            print(colorama.Style.DIM + "\n\n\n" + "="*80 + "\n" + "Module output:")
            output = automate.main(software_platform="Ekkono", hardware_platform="NUCLEO-L4R5ZI", save_path=os.path.join(save_dir, "Ekkono + NUCLEO-L4R5ZI.xlsx"))

            n_targets = len(output)
            n_success = 0
            failures = []
            for target in output:
                if target["result"] == "success":
                    n_success += 1
                else:
                    report = "Model: {}\n\n".format(target["dir"])
                    if "traceback" in target:
                        report += "Traceback:\n{}".format(target["traceback"])
                    else:
                        report += "Error file path: {}\n".format(target["error_file"])

                    report_name = target["dir"]
                    report_name = report_name.replace("/", " - ").replace("\\", " - ")
                    report_path = os.path.join(save_dir, "errors/Test on NUCLEO-L4R5ZI (Ekkono)", "{}.txt".format(report_name))
                    os.makedirs(os.path.dirname(report_path), exist_ok=True)
                    with open(report_path, "w") as file:
                        file.write(report)

                    failures.append({
                        "dir": target["dir"],
                        "error": target["error"],
                        "report_path": report_path.replace("\\", "/")
                    })

            if n_success == n_targets:
                page += COLOR_SECONDARY + " ({}/{})\n".format(n_success, n_targets) + COLOR_RESET
            else:
                flawless = False
                page += COLOR_TERTIARY + " ({}/{})\n".format(n_success, n_targets) + COLOR_RESET
                page += "Failed models:\n"
                for failure in failures:
                    page += "- Model: {}\n".format(failure["dir"])
                    page += "  Error: {}\n".format(failure["error"])
                    page += "  Details: {}\n".format(failure["report_path"])

            _clear_console()
            print(page)

        elif module == "Test on RenesasRX65N (TFLM)":
            page += "Testing TFLM models on RenesasRX65N"
            _clear_console()
            print(page)

            print(colorama.Style.DIM + "\n\n\n" + "="*80 + "\n" + "Module output:")
            output = automate.main(software_platform="TFLM", hardware_platform="RenesasRX65N", save_path=os.path.join(save_dir, "TFLM + RenesasRX65N.xlsx"))

            n_targets = len(output)
            n_success = 0
            failures = []
            for target in output:
                if target["result"] == "success":
                    n_success += 1
                else:
                    report = "Model: {}\n\n".format(target["dir"])
                    if "traceback" in target:
                        report += "Traceback:\n{}".format(target["traceback"])
                    else:
                        report += "Error file path: {}\n".format(target["error_file"])

                    report_name = target["dir"]
                    report_name = report_name.replace("/", " - ").replace("\\", " - ")
                    report_path = os.path.join(save_dir, "errors/Test on RenesasRX65N (TFLM)", "{}.txt".format(report_name))
                    os.makedirs(os.path.dirname(report_path), exist_ok=True)
                    with open(report_path, "w") as file:
                        file.write(report)

                    failures.append({
                        "dir": target["dir"],
                        "error": target["error"],
                        "report_path": report_path.replace("\\", "/")
                    })

            if n_success == n_targets:
                page += COLOR_SECONDARY + " ({}/{})\n".format(n_success, n_targets) + COLOR_RESET
            else:
                flawless = False
                page += COLOR_TERTIARY + " ({}/{})\n".format(n_success, n_targets) + COLOR_RESET
                page += "Failed models:\n"
                for failure in failures:
                    page += "- Model: {}\n".format(failure["dir"])
                    page += "  Error: {}\n".format(failure["error"])
                    page += "  Details: {}\n".format(failure["report_path"])

            _clear_console()
            print(page)

        elif module == "Test on RenesasRX65N (Edge Impulse)":
            page += "Testing Edge Impulse models on RenesasRX65N"
            _clear_console()
            print(page)

            print(colorama.Style.DIM + "\n\n\n" + "="*80 + "\n" + "Module output:")
            output = automate.main(software_platform="EI", hardware_platform="RenesasRX65N", save_path=os.path.join(save_dir, "Edge Impulse + RenesasRX65N.xlsx"))

            n_targets = len(output)
            n_success = 0
            failures = []
            for target in output:
                if target["result"] == "success":
                    n_success += 1
                else:
                    report = "Model: {}\n\n".format(target["dir"])
                    if "traceback" in target:
                        report += "Traceback:\n{}".format(target["traceback"])
                    else:
                        report += "Error file path: {}\n".format(target["error_file"])

                    report_name = target["dir"]
                    report_name = report_name.replace("/", " - ").replace("\\", " - ")
                    report_path = os.path.join(save_dir, "errors/Test on RenesasRX65N (Edge Impulse)", "{}.txt".format(report_name))
                    os.makedirs(os.path.dirname(report_path), exist_ok=True)
                    with open(report_path, "w") as file:
                        file.write(report)

                    failures.append({
                        "dir": target["dir"],
                        "error": target["error"],
                        "report_path": report_path.replace("\\", "/")
                    })

            if n_success == n_targets:
                page += COLOR_SECONDARY + " ({}/{})\n".format(n_success, n_targets) + COLOR_RESET
            else:
                flawless = False
                page += COLOR_TERTIARY + " ({}/{})\n".format(n_success, n_targets) + COLOR_RESET
                page += "Failed models:\n"
                for failure in failures:
                    page += "- Model: {}\n".format(failure["dir"])
                    page += "  Error: {}\n".format(failure["error"])
                    page += "  Details: {}\n".format(failure["report_path"])

            _clear_console()
            print(page)

        elif module == "Test on RenesasRX65N (Ekkono)":
            page += "Testing Ekkono models on RenesasRX65N"
            _clear_console()
            print(page)

            print(colorama.Style.DIM + "\n\n\n" + "="*80 + "\n" + "Module output:")
            output = automate.main(software_platform="Ekkono", hardware_platform="RenesasRX65N", save_path=os.path.join(save_dir, "Ekkono + RenesasRX65N.xlsx"))

            n_targets = len(output)
            n_success = 0
            failures = []
            for target in output:
                if target["result"] == "success":
                    n_success += 1
                else:
                    report = "Model: {}\n\n".format(target["dir"])
                    if "traceback" in target:
                        report += "Traceback:\n{}".format(target["traceback"])
                    else:
                        report += "Error file path: {}\n".format(target["error_file"])

                    report_name = target["dir"]
                    report_name = report_name.replace("/", " - ").replace("\\", " - ")
                    report_path = os.path.join(save_dir, "errors/Test on RenesasRX65N (Ekkono)", "{}.txt".format(report_name))
                    os.makedirs(os.path.dirname(report_path), exist_ok=True)
                    with open(report_path, "w") as file:
                        file.write(report)

                    failures.append({
                        "dir": target["dir"],
                        "error": target["error"],
                        "report_path": report_path.replace("\\", "/")
                    })

            if n_success == n_targets:
                page += COLOR_SECONDARY + " ({}/{})\n".format(n_success, n_targets) + COLOR_RESET
            else:
                flawless = False
                page += COLOR_TERTIARY + " ({}/{})\n".format(n_success, n_targets) + COLOR_RESET
                page += "Failed models:\n"
                for failure in failures:
                    page += "- Model: {}\n".format(failure["dir"])
                    page += "  Error: {}\n".format(failure["error"])
                    page += "  Details: {}\n".format(failure["report_path"])

            _clear_console()
            print(page)

        elif module == "Test on RenesasRX65N (eAI Translator)":
            page += "Testing eAI Translator models on RenesasRX65N"
            _clear_console()
            print(page)

            print(colorama.Style.DIM + "\n\n\n" + "="*80 + "\n" + "Module output:")
            output = automate.main(software_platform="eAI_Translator", hardware_platform="RenesasRX65N", save_path=os.path.join(save_dir, "eAI_Translator + RenesasRX65N.xlsx"))

            n_targets = len(output)
            n_success = 0
            failures = []
            for target in output:
                if target["result"] == "success":
                    n_success += 1
                else:
                    report = "Model: {}\n\n".format(target["dir"])
                    if "traceback" in target:
                        report += "Traceback:\n{}".format(target["traceback"])
                    else:
                        report += "Error file path: {}\n".format(target["error_file"])

                    report_name = target["dir"]
                    report_name = report_name.replace("/", " - ").replace("\\", " - ")
                    report_path = os.path.join(save_dir, "errors/Test on RenesasRX65N (eAI Translator)", "{}.txt".format(report_name))
                    os.makedirs(os.path.dirname(report_path), exist_ok=True)
                    with open(report_path, "w") as file:
                        file.write(report)

                    failures.append({
                        "dir": target["dir"],
                        "error": target["error"],
                        "report_path": report_path.replace("\\", "/")
                    })

            if n_success == n_targets:
                page += COLOR_SECONDARY + " ({}/{})\n".format(n_success, n_targets) + COLOR_RESET
            else:
                flawless = False
                page += COLOR_TERTIARY + " ({}/{})\n".format(n_success, n_targets) + COLOR_RESET
                page += "Failed models:\n"
                for failure in failures:
                    page += "- Model: {}\n".format(failure["dir"])
                    page += "  Error: {}\n".format(failure["error"])
                    page += "  Details: {}\n".format(failure["report_path"])

            _clear_console()
            print(page)

    if flawless:
        page += "\nAll the modules were " + COLOR_SECONDARY + "successfully" + COLOR_RESET + " executed\n"
    else:
        page += "\nAll the modules are executed. Some of them " + COLOR_TERTIARY + "failed" + COLOR_RESET + " in this process\n"

    if ("Test on NUCLEO-L4R5ZI (TFLM)" in modules or
        "Test on NUCLEO-L4R5ZI (Edge Impulse)" in modules or
        "Test on NUCLEO-L4R5ZI (Ekkono)" in modules or
        "Test on RenesasRX65N (TFLM)" in modules or
        "Test on RenesasRX65N (Edge Impulse)" in modules or
        "Test on RenesasRX65N (Ekkono)" in modules or
        "Test on RenesasRX65N (eAI Translator)" in modules):
        page += "You can find the results in the {} directory\n".format(save_dir)
    _clear_console()
    print(page)