def main():
    """AWS IoT EduKit MCU hardware device registration script
    Checkes environment is set correctly, generates ECDSA certificates,
    ensures all required python libraries are included, retrieves on-board 
    device certificate using the esp-cryptoauth library and utility, creates 
    an AWS IoT thing using the AWS CLI and Microchip Trust Platform Design Suite.
    """
    app_binary = 'sample_bins/secure_cert_mfg_esp32.bin'
    parser = argparse.ArgumentParser(
        description='''Provision the Core2 for AWS IoT EduKit with 
        device_certificate and signer_certificate required for TLS authentication'''
    )

    parser.add_argument(
        "--port",
        '-p',
        dest='port',
        metavar='[port]',
        required=True,
        help='Serial comm port of the Core2 for AWS IoT EduKit device')

    args = parser.parse_args()

    args.signer_cert = "output_files/signer_cert.crt"
    args.signer_privkey = "output_files/signer_key.pem"
    args.print_atecc608a_type = False
    check_environment()

    reqs = requirements_installer('requirements.txt')

    generate_signer_certificate()

    esp = esptool.ESP32ROM(args.port, baud=115200)
    esp_hs.serial.load_app_stub(app_binary, esp)
    init_mfg = esp_hs.serial.cmd_interpreter()

    retval = init_mfg.wait_for_init(esp._port)
    if retval is not True:
        print("CMD prompt timed out.")
        exit(0)

    retval = init_mfg.exec_cmd(esp._port, "init")
    esp_hs.serial.esp_cmd_check_ok(retval, "init")
    esp_hs.generate_manifest_file(esp, args, init_mfg)
    upload_manifest()
Ejemplo n.º 2
0
import sys, os
from requirements_helper import requirements_installer

obj = requirements_installer('requirements.txt')