Esempio n. 1
0
def board_power(
    lab: typing.Optional[tbot.selectable.LabHost] = None,
    board: typing.Optional[board.Board] = None,
    state='on',
) -> None:
    """
    power on or off the board without acquiring console.

    This is only hacky version, we should bring in this into
    tbot.
    """
    with contextlib.ExitStack() as cx:
        lh = cx.enter_context(lab or tbot.acquire_lab())

        fl = tbot.flags

        tbot.flags = {"no_console_check", "nopoweroff"}
        b = cx.enter_context(board or tbot.acquire_board(lh))

        tbot.flags = fl
        if state == 'on':
            b.poweron()
        else:
            b.poweroff()

        tbot.flags = {"no_console_check", "nopoweroff"}
Esempio n. 2
0
def ari_ub_check_multi_dtb_select(
    lab: typing.Optional[linux.LinuxShell] = None,
    board: typing.Optional[board.Board] = None,
    ubx: typing.Optional[board.UBootShell] = None,
) -> None:
    with lab or tbot.acquire_lab() as lh:
        with contextlib.ExitStack() as bx:
            b = bx.enter_context(tbot.acquire_board(lh))
            with contextlib.ExitStack() as cx:
                ub = cx.enter_context(tbot.acquire_uboot(b))

                cur_panel = ge.ub_get_var(ub, "panel")
                old_panel = cur_panel
                check_panel(ub, cur_panel)
                cur_panel = switch_panel(ub, cur_panel)
                ub.ch.sendline("res")

            with contextlib.ExitStack() as cx:
                ub = cx.enter_context(tbot.acquire_uboot(b))
                cur_panel = ge.ub_get_var(ub, "panel")
                if old_panel == cur_panel:
                    raise RuntimeError(
                        f"{cur_panel} == {old_panel}, should change")
                old_panel = cur_panel
                check_panel(ub, cur_panel)
                cur_panel = switch_panel(ub, cur_panel)
                ub.ch.sendline("res")

            with contextlib.ExitStack() as cx:
                ub = cx.enter_context(tbot.acquire_uboot(b))
                cur_panel = ge.ub_get_var(ub, "panel")
                if old_panel == cur_panel:
                    raise RuntimeError(
                        f"{cur_panel} == {old_panel}, should change")
                check_panel(ub, cur_panel)
Esempio n. 3
0
def test_linux(mach: typing.Optional[linux.LinuxShell] = None, ) -> None:
    with mach or tbot.acquire_lab() as lnx:
        p = lnx.workdir / "foobar"

        with tbot.acquire_lab() as lh:
            p2 = lh.workdir / "barfoo"

            # Should fail!
            lnx.exec0("echo", p2)
            lh.exec0("echo", p)

            with tbot.acquire_board(lh) as b:
                with tbot.acquire_linux(b) as lnx2:
                    p3 = lnx2.workdir / "barbarbar"

                    # Should fail!
                    lh.exec0("echo", p3)
                    lnx.exec0("echo", p3)
                    lnx2.exec0("echo", p)
                    lnx2.exec0("echo", p2)

                    # Should pass!
                    lnx.exec0("echo", p)
                    lh.exec0("echo", p2)
                    lnx2.exec0("echo", p3)
Esempio n. 4
0
def selftest_board_uboot(lab: typing.Optional[tbot.selectable.LabHost] = None) -> None:
    """Test if tbot intercepts U-Boot correctly."""

    with contextlib.ExitStack() as cx:
        lh = cx.enter_context(lab or tbot.acquire_lab())
        try:
            b: board.Board = cx.enter_context(tbot.acquire_board(lh))
            ub: board.UBootShell = cx.enter_context(
                tbot.acquire_uboot(b)  # type: ignore
            )
        except NotImplementedError:
            b = cx.enter_context(TestBoard(lh))
            ub = cx.enter_context(TestBoardUBoot(b))

        ub.exec0("version")
        env = ub.exec0("printenv").strip().split("\n")

        for line in env[:-1]:
            if line != "" and line[0].isalnum():
                assert "=" in line, repr(line)

        out = ub.exec0("echo", hex(0x1234)).strip()
        assert out == "0x1234", repr(out)

        mach.selftest_machine_shell(ub)
Esempio n. 5
0
def socrates_ub_update_i(
    lab: typing.Optional[linux.LinuxShell] = None,
    uboot: typing.Optional[board.UBootShell] = None,
    interactive = True,
) -> None:
    with contextlib.ExitStack() as cx:
        lh = cx.enter_context(lab or tbot.acquire_lab())
        if uboot is not None:
            ub = uboot
        else:
            b = cx.enter_context(tbot.acquire_board(lh))
            ub = cx.enter_context(tbot.acquire_uboot(b))

        ret = ub.exec("ping", "192.168.1.1")
        while ret[0] != 0:
            ret = ub.exec("ping", "192.168.1.1")

        if "restore_old_ub" in tbot.flags:
            tbot.log.message("restore old U-Boot")
            ub.env("uboot_addr", "FFFA0000")
            ub.env("uboot_file", "socrates-abb/20190627/socrates-u-boot.bin-voncajus")
        else:
            ub.env("uboot_addr", "FFF60000")
            ub.env("uboot_file", f"socrates-abb/{b.date}/u-boot-socrates.bin")
            ub.env("update_uboot", "tftp 110000 ${uboot_file};protect off ${uboot_addr} ffffffff;era ${uboot_addr} ffffffff;cp.b 110000 ${uboot_addr} ${filesize}")

        ub.exec0("printenv")
        ub.exec0("run", "update_uboot")

        if interactive:
            ub.interactive()
Esempio n. 6
0
def ari_ub_check_version(
    lab: typing.Optional[linux.LinuxShell] = None,
    board: typing.Optional[board.Board] = None,
    ubx: typing.Optional[board.UBootShell] = None,
) -> None:
    """
    u-boot check if version on board is the same as in binary
    """
    with lab or tbot.acquire_lab() as lh:
        with contextlib.ExitStack() as cx:
            if board is not None:
                b = board
            else:
                b = cx.enter_context(tbot.acquire_board(lh))

            if ubx is not None:
                ub = ubx
            else:
                ub = cx.enter_context(tbot.acquire_uboot(b))

            t = lh.tftp_dir / "u-boot-dtb.imx.signed"

            #bin_vers = lh.exec0("strings", t, linux.Pipe, "grep", '"U-Boot 2"')
            bin_vers = lh.exec0(
                linux.Raw(
                    f"strings /tftpboot/aristainetos/tbot/u-boot-dtb.imx.signed | grep --color=never 'U-Boot 2'"
                ))
            ub_vers = ub.exec0("version")

            if bin_vers in ub_vers:
                tbot.log.message(
                    tbot.log.c("Info: U-Boot version is the same").green)
            else:
                raise RuntimeError(f"{bin_vers} != {ub_vers}")
Esempio n. 7
0
def socrates_ub_bdi_update(
    lab: typing.Optional[linux.LinuxShell] = None,
    board: typing.Optional[board.Board] = None,
    ubma: typing.Optional[board.UBootShell] = None,
) -> None:
    with contextlib.ExitStack() as cx:
        if lab is not None:
            lh = lab
        else:
            lh = cx.enter_context(tbot.acquire_lab())

        if board is not None:
            b = board
        else:
            b = cx.enter_context(tbot.acquire_board(lh))

        bd.bdi_connect(lh, b)

        bd.bdi_reset_board()

        bd.exec("era")
        if "restore_old_ub" in tbot.flags:
            bd.exec("prog", "0xfffa0000", f"socrates-abb/{b.date}/socrates-u-boot.bin-voncajus", "BIN")
        else:
            bd.exec("era", "0xfff60000")
            bd.exec("prog", "0xfff60000", f"socrates-abb/{b.date}/u-boot-socrates.bin", "BIN")

        bd.bdi_reset_board_run()
        if ubma is not None:
            ub = ubma
        else:
            ub = cx.enter_context(tbot.acquire_uboot(b))

        ub.interactive()
Esempio n. 8
0
def ub_check_version(
    resfiles: list,
    lab: typing.Optional[linux.LinuxShell] = None,
    board: typing.Optional[board.Board] = None,
    ubx: typing.Optional[board.UBootShell] = None,
) -> None:
    """
    check if installed U-Boot version is the same as in
    tftp directory.
    """
    with lab or tbot.acquire_lab() as lh:
        r = get_path(lh.tftp_root_path) + "/" + get_path(lh.tftp_dir_board)
        spl_vers = None
        ub_vers = None
        splfiles = ["MLO", "SPL"]
        ubfiles = ["u-boot.img", "u-boot-socrates.bin", "u-boot.bin", "u-boot-dtb.imx", "u-boot-dtb.bin"]
        for f in resfiles:
            if spl_vers == None:
                if any(s in f for s in splfiles):
                    log_event.doc_begin("get_spl_vers")
                    spl_vers = lh.exec0(linux.Raw(f'strings {r}/{f} | grep --color=never "U-Boot SPL 2"'))
                    spl_vers = spl_vers.strip()
                    log_event.doc_tag("ub_spl_new_version", spl_vers)
                    log_event.doc_end("get_spl_vers")
                    tbot.log.message(tbot.log.c(f"found in image U-Boot SPL version {spl_vers}").green)
            if ub_vers == None:
                if any(s in f for s in ubfiles):
                    log_event.doc_begin("get_ub_vers")
                    ub_vers = lh.exec0(linux.Raw(f'strings {r}/{f} | grep --color=never "U-Boot 2"'))
                    for l in ub_vers.split('\n'):
                        if ":" in l:
                            ub_vers = l.strip()
                    if ub_vers[0] == 'V':
                        ub_vers = ub_vers[1:]
                    log_event.doc_tag("ub_ub_new_version", ub_vers)
                    log_event.doc_end("get_ub_vers")
                    tbot.log.message(tbot.log.c(f"found in image U-Boot version {ub_vers}").green)

        with contextlib.ExitStack() as cx:
            if board is not None:
                b = board
            else:
                b = cx.enter_context(tbot.acquire_board(lh))
            if ubx is not None:
                ub = ubx
            else:
                ub = cx.enter_context(tbot.acquire_uboot(b))
            if spl_vers != None:
                if spl_vers not in ub.bootlog:
                    raise RuntimeError(f"{spl_vers} not found.")
                tbot.log.message(tbot.log.c(f"found U-Boot SPL version {spl_vers} installed").green)
            if ub_vers == None:
                raise RuntimeError(f"No U-Boot version defined")
            else:
                if ub_vers not in ub.bootlog:
                    raise RuntimeError(f"{ub_vers} not found.")
                tbot.log.message(tbot.log.c(f"found U-Boot version {ub_vers} installed").green)
Esempio n. 9
0
def gettarget(mach: typing.Optional[linux.LinuxMachine] = None, ) -> None:
    with contextlib.ExitStack() as cx:
        if mach is None:
            lh = cx.enter_context(tbot.acquire_lab())
            b = cx.enter_context(tbot.acquire_board(lh))
            lnx = cx.enter_context(tbot.acquire_linux(b))
        else:
            lnx = mach

        tc.testsuite(getcpu, getlinuxversion, getyoctoversion, mach=lnx)
Esempio n. 10
0
def getcpu(mach: typing.Optional[linux.LinuxMachine] = None, ) -> None:
    with contextlib.ExitStack() as cx:
        if mach is None:
            lh = cx.enter_context(tbot.acquire_lab())
            b = cx.enter_context(tbot.acquire_board(lh))
            lnx = cx.enter_context(tbot.acquire_linux(b))
        else:
            lnx = mach

        lnx.exec0("cat", "/proc/cpuinfo")
Esempio n. 11
0
def getyoctoversion(
    mach: typing.Optional[linux.LinuxMachine] = None, ) -> None:
    with contextlib.ExitStack() as cx:
        if mach is None:
            lh = cx.enter_context(tbot.acquire_lab())
            b = cx.enter_context(tbot.acquire_board(lh))
            lnx = cx.enter_context(tbot.acquire_linux(b))
        else:
            lnx = mach

        lnx.exec0("cat", "/etc/os_release")
Esempio n. 12
0
def selftest_board_linux(lab: typing.Optional[tbot.selectable.LabHost] = None) -> None:
    """Test board's linux."""

    with contextlib.ExitStack() as cx:
        lh = cx.enter_context(lab or tbot.acquire_lab())

        try:
            b = cx.enter_context(tbot.acquire_board(lh))
        except NotImplementedError:
            tbot.skip("No board available")

        lnx = cx.enter_context(tbot.acquire_linux(b))

        mach.selftest_machine_shell(lnx)
Esempio n. 13
0
def selftest_with_linux(lab: typing.Optional[tbot.selectable.LabHost] = None) -> None:
    """Test the tbot.with_linux decorator."""
    with lab or selftest.SelftestHost() as lh:
        with SubstituteBoard():
            # Call without anything
            selftest_decorated_linux()

            # Call with labhost
            selftest_decorated_linux(lh)

            # Call with Linux
            with tbot.acquire_board(lh) as b:
                with tbot.acquire_linux(b) as lnx:
                    selftest_decorated_linux(lnx)
Esempio n. 14
0
def selftest_with_uboot(lab: typing.Optional[tbot.selectable.LabHost] = None) -> None:
    """Test the tbot.with_uboot decorator."""
    with lab or selftest.SelftestHost() as lh:
        with SubstituteBoard():
            # Call without anything
            selftest_decorated_uboot()

            # Call with labhost
            selftest_decorated_uboot(lh)

            # Call with U-Boot
            with tbot.acquire_board(lh) as b:
                with tbot.acquire_uboot(b) as ub:
                    selftest_decorated_uboot(ub)
Esempio n. 15
0
def checkswupdate(
    mach: typing.Optional[linux.LinuxMachine] = None,
    **kwargs: typing.Any,
) -> None:
    with contextlib.ExitStack() as cx:
        if mach is None:
            lh = cx.enter_context(tbot.acquire_lab())
            b = cx.enter_context(tbot.acquire_board(lh))
            lnx = cx.enter_context(tbot.acquire_linux(b))
        else:
            lnx = mach

        version = lnx.exec("/usr/bin/swupdate", "--version")
        tbot.log.message(f"SWUpdate detected version {version}")
def qemu_uboot_testcases(
        lab: typing.Optional[tbot.selectable.LabHost] = None) -> None:
    with contextlib.ExitStack() as cx:
        lh = cx.enter_context(lab or tbot.acquire_lab())
        try:
            b = cx.enter_context(tbot.acquire_board(lh))
            ub = cx.enter_context(tbot.acquire_uboot(b))
        except NotImplementedError:
            b = cx.enter_context(QemuBoard(lh))
            ub = cx.enter_context(QemuUBoot(b))

        tbot.tc.testsuite(
            uboot_verify_version,
            ub=ub,
        )
Esempio n. 17
0
def ari_ub_check_hab(
    lab: typing.Optional[linux.LinuxShell] = None,
    board: typing.Optional[board.Board] = None,
    ubx: typing.Optional[board.UBootShell] = None,
) -> None:
    """
    u-boot check hab_auth works as expected
    """
    with lab or tbot.acquire_lab() as lh:
        with contextlib.ExitStack() as cx:
            if board is not None:
                b = board
            else:
                b = cx.enter_context(tbot.acquire_board(lh))

            if ubx is not None:
                ub = ubx
            else:
                ub = cx.enter_context(tbot.acquire_uboot(b))

            load_addr = "10000000"
            t = lh.tftp_dir / "testhabfile-pad-ivt.bin.signed"
            ub.exec0("tftp", load_addr, ge.get_ub_tftp_path(lh, t))
            ret = ub.exec0("hab_auth_img", load_addr,
                           linux.special.Raw("${filesize}"))
            if "No HAB Events Found" in ret:
                tbot.log.message(tbot.log.c("Info: no HAB events.").green)
            else:
                raise RuntimeError("HAB events found")

            t = lh.tftp_dir / "boot-pad-ivt.scr.bin.signed"
            ub.exec0("tftp", load_addr, ge.get_ub_tftp_path(lh, t))
            ret = ub.exec0("hab_auth_img", load_addr,
                           linux.special.Raw("${filesize}"))
            if "No HAB Events Found" in ret:
                tbot.log.message(tbot.log.c("Info: no HAB events.").green)
            else:
                raise RuntimeError("HAB events found")

            t = lh.tftp_dir / "testhabfile-pad-ivt.bin.signed.error"
            ub.exec0("tftp", load_addr, ge.get_ub_tftp_path(lh, t))
            ret = ub.exec0("hab_auth_img", load_addr,
                           linux.special.Raw("${filesize}"))
            if "HAB_FAILURE" in ret:
                tbot.log.message(
                    tbot.log.c("Info: HAB events, expected!").green)
            else:
                raise RuntimeError("HAB events not found")
Esempio n. 18
0
def ari_ub_update(
    lab: typing.Optional[linux.LinuxShell] = None,
    board: typing.Optional[board.Board] = None,
    ubx: typing.Optional[board.UBootShell] = None,
) -> None:
    """
    update u-boot
    """
    with lab or tbot.acquire_lab() as lh:
        # now we know what we have normally as bootmode
        # we want to update this bootmode with new U-Boot
        # so delete bootmode in flags and set other bootmode
        if "bootmodesd" in tbot.flags:
            bm = "sd"
            tbot.flags.remove("bootmodesd")
            lh.set_bootmode("spi")
        elif "bootmodespi" in tbot.flags:
            bm = "spi"
            tbot.flags.remove("bootmodespi")
            lh.set_bootmode("sd")
        else:
            raise RuntimeError("Set bootmode")

        with contextlib.ExitStack() as cx:
            if board is not None:
                b = board
            else:
                b = cx.enter_context(tbot.acquire_board(lh))

            if ubx is not None:
                ub = ubx
            else:
                ub = cx.enter_context(tbot.acquire_uboot(b))

            ari_ub_set_env(ub)
            loadaddr = "0x12000000"
            ret = ub.exec("ping", "192.168.1.1")
            while ret[0] != 0:
                ret = ub.exec("ping", "192.168.1.1")
            ub.exec0("mw", loadaddr, "0", "0x4000")
            ub.exec0("tftp", loadaddr, b.envdir)
            ub.exec0("env", "import", "-t", loadaddr)
            if bm == "sd":
                ub.exec0("run", "upd_uboot_sd")
            else:
                ub.exec0("run", "upd_uboot")

    return
Esempio n. 19
0
def selftest_board_linux(lab: typing.Optional[tbot.selectable.LabHost] = None) -> None:
    """Test board's linux."""
    with contextlib.ExitStack() as cx:
        lh = cx.enter_context(lab or tbot.acquire_lab())

        try:
            b = cx.enter_context(tbot.acquire_board(lh))
        except NotImplementedError:
            tbot.log.message(
                tbot.log.c("Skipped").yellow.bold + " because no board available."
            )
            return

        lnx = cx.enter_context(tbot.acquire_linux(b))

        mach.selftest_machine_shell(lnx)
Esempio n. 20
0
def qemu_linux_testcases(
    lab: typing.Optional[tbot.selectable.LabHost] = None,
    board_linux: typing.Optional[board.LinuxMachine] = None,
) -> None:
    with contextlib.ExitStack() as cx:
        lh = cx.enter_context(lab or tbot.acquire_lab())
        if board_linux is not None:
            lnx = board_linux
        else:
            b = cx.enter_context(tbot.acquire_board(lh))
            lnx = cx.enter_context(tbot.acquire_linux(b))

        tbot.tc.testsuite(
            linux_verify_uname,
            linux_regular_file_operations,
            lnx=lnx,
        )
Esempio n. 21
0
def swupdateweb(
    mach: typing.Optional[linux.LinuxMachine] = None,
    ip=None,
    path=None,
) -> None:
    with contextlib.ExitStack() as cx:
        if mach is None:
            lh = cx.enter_context(tbot.acquire_lab())
            b = cx.enter_context(tbot.acquire_board(lh))
            lnx = cx.enter_context(tbot.acquire_linux(b))
        else:
            lnx = mach

        if ip is None:
            raise RuntimeError(f"IP Address is not set")
        if path is None:
            raise RuntimeError(f"Path to SWU is not set")

        return SWUpdater(path, ip).update()
Esempio n. 22
0
def ari_ub_basic_checks(
    lab: typing.Optional[linux.LinuxShell] = None,
    board: typing.Optional[board.Board] = None,
    ubx: typing.Optional[board.UBootShell] = None,
) -> None:
    """
    u-boot check basic stuff
    """
    with lab or tbot.acquire_lab() as lh:
        with contextlib.ExitStack() as cx:
            if board is not None:
                b = board
            else:
                b = cx.enter_context(tbot.acquire_board(lh))

            if ubx is not None:
                ub = ubx
            else:
                ub = cx.enter_context(tbot.acquire_uboot(b))

            ari_ub_set_env(ub)
            ari_ub_check_bootlog(ub)

            # check version
            ari_ub_check_version(lh, b, ub)
            # ethernet works?
            ub.exec0("ping", lh.serverip)
            # mmc work
            ub.exec0("mmc", "info")
            # check led / gpio
            ari_ub_check_led(ub)
            # check i2c
            ari_ub_check_i2c(lh, b, ub)
            # check hab_auth_img command
            ari_ub_check_hab(lh, b, ub)

    # must start from scratch
    # check multi dtb select
    ari_ub_check_multi_dtb_select()
    ari_ub_check_empty_environment()
Esempio n. 23
0
def ari_ub_check_i2c(
    lab: typing.Optional[linux.LinuxShell] = None,
    board: typing.Optional[board.Board] = None,
    ubx: typing.Optional[board.UBootShell] = None,
) -> None:
    """
    check i2c probe and dumps
    """
    with lab or tbot.acquire_lab() as lh:
        with contextlib.ExitStack() as cx:
            if board is not None:
                b = board
            else:
                b = cx.enter_context(tbot.acquire_board(lh))

            if ubx is not None:
                ub = ubx
            else:
                ub = cx.enter_context(tbot.acquire_uboot(b))

            ub.exec0("i2c", "dev", "0")
            log = ub.exec0("i2c", "probe")
            if "58 59 71" not in log:
                raise RuntimeError("Probing bus 0 failed res: {log}")

            ub.exec0("i2c", "dev", "1")
            log = ub.exec("i2c", "probe")
            if log[0] == 0:
                raise RuntimeError("Probing bus 1 failed res: {log}")

            ub.exec0("i2c", "dev", "2")
            log = ub.exec0("i2c", "probe")
            dump_file = i2c_dump_0_58_7
            if "20 4D 68" not in log:
                if "20 4B 68" not in log:
                    raise RuntimeError("Probing bus 2 failed res: {log}")
                else:
                    dump_file = i2c_dump_0_58_4

            ge.ub_check_i2c_dump(ub, "0", "0x58", dump_file)
Esempio n. 24
0
def socrates_ub_usb(
    lab: typing.Optional[linux.LinuxShell] = None,
    board: typing.Optional[board.Board] = None,
    ubma: typing.Optional[board.UBootShell] = None,
) -> None:
    """
    start usb and check if there is a usb storage device
    """
    with contextlib.ExitStack() as cx:
        if lab is not None:
            lh = lab
        else:
            lh = cx.enter_context(tbot.acquire_lab())

        if board is not None:
            b = board
        else:
            b = cx.enter_context(tbot.acquire_board(lh))

        if ubma is not None:
            ub = ubma
        else:
            ub = cx.enter_context(tbot.acquire_uboot(b))

        ret = ub.exec0("usb", "start")
        if "1 Storage Device" not in ret:
            raise RuntimeError("no usb storage device found")

        ret = ub.exec0("usb", "storage")
        if "Vendor: Kingston" not in ret:
            raise RuntimeError("vendor not Kingston")
        if "Capacity: 954.0 MB" not in ret:
            raise RuntimeError("wrong Capacity")

        ub.exec0("usb", "read", "100000", "0", "1000")

        ret = ub.exec0("crc", "100000", "80000")
        if "e336ee43" not in ret:
            raise RuntimeError(f"wrong checksum f{ret}")
Esempio n. 25
0
def wandboard_check_iperf(
    lab: linux.LinuxShell = None,
    board: board.Board = None,
    blx: linux.LinuxShell = None,
    cycles: str = "5",
    minval: str = "70",
    intervall: str = "5",
) -> bool:
    """
    check networkperformance with iperf
    """
    with contextlib.ExitStack() as cx:
        if lab is not None:
            lh = lab
        else:
            lh = cx.enter_context(tbot.acquire_lab())

        if board is not None:
            b = board
        else:
            b = cx.enter_context(tbot.acquire_board(lh))

        if blx is not None:
            lnx = blx
        else:
            lnx = cx.enter_context(tbot.acquire_linux(b))

        ge.lx_check_iperf(lh,
                          lnx,
                          intervall=intervall,
                          cycles=cycles,
                          minval=minval,
                          filename="iperf.dat",
                          showlog=True)

    return True
Esempio n. 26
0
def interactive_linux() -> None:
    with tbot.acquire_lab() as lh:
        with tbot.acquire_board(lh) as b:
            with tbot.acquire_linux(b) as lnx:
                lnx.interactive()
Esempio n. 27
0
def interactive_uboot() -> None:
    with tbot.acquire_lab() as lh:
        with tbot.acquire_board(lh) as b:
            with tbot.acquire_uboot(b) as ub:
                ub.interactive()
Esempio n. 28
0
def interactive_board() -> None:
    with tbot.acquire_lab() as lh:
        with tbot.acquire_board(lh) as b:
            b.channel.attach_interactive()
Esempio n. 29
0
def ari_ub_dump_register(
    lab: typing.Optional[linux.LinuxShell] = None,
    board: typing.Optional[board.Board] = None,
    ubx: typing.Optional[board.UBootShell] = None,
) -> None:
    """
    dump U-Boot register into file
    """
    with lab or tbot.acquire_lab() as lh:
        with contextlib.ExitStack() as cx:
            if board is not None:
                b = board
            else:
                b = cx.enter_context(tbot.acquire_board(lh))

            if ubx is not None:
                ub = ubx
            else:
                ub = cx.enter_context(tbot.acquire_uboot(b))

            ge.ub_create_revfile(ub, path + "ccm.dump", "0x20c4000",
                                 "0x20c408c")
            ge.ub_create_revfile(ub, path + "ccm_an.dump", "0x20c8000",
                                 "0x20c8190")

            ge.ub_create_revfile(ub, path + "pinmux.dump", "0x20e0000",
                                 "0x20e093c")
            ge.ub_create_revfile(ub, path + "usdhc1.dump", "0x2190000",
                                 "0x21900cc")
            ge.ub_create_revfile(ub, path + "usdhc2.dump", "0x2194000",
                                 "0x21940cc")

            ge.ub_create_revfile(ub, path + "gpio1.dump", "0x209c000",
                                 "0x209c020")
            ge.ub_create_revfile(ub, path + "gpio2.dump", "0x20a0000",
                                 "0x20a0020")
            ge.ub_create_revfile(ub, path + "gpio3.dump", "0x20a4000",
                                 "0x20a4020")
            ge.ub_create_revfile(ub, path + "gpio4.dump", "0x20a8000",
                                 "0x20a8020")
            ge.ub_create_revfile(ub, path + "gpio5.dump", "0x20ac000",
                                 "0x20ac020")
            ge.ub_create_revfile(ub, path + "gpio6.dump", "0x20b0000",
                                 "0x20b0020")
            ge.ub_create_revfile(ub, path + "gpio7.dump", "0x20b4000",
                                 "0x20b4020")

            ge.ub_create_revfile(ub, path + "pwm1.dump", "0x2080000",
                                 "0x2080018")
            ge.ub_create_revfile(ub, path + "pwm2.dump", "0x2084000",
                                 "0x2084018")
            ge.ub_create_revfile(ub, path + "pwm3.dump", "0x2088000",
                                 "0x2088018")
            ge.ub_create_revfile(ub, path + "pwm4.dump", "0x208c000",
                                 "0x208c018")

            ge.ub_create_revfile(ub, path + "ecspi1.dump", "0x2008000",
                                 "0x2008044")
            ge.ub_create_revfile(ub, path + "ecspi2.dump", "0x200c000",
                                 "0x200c044")
            ge.ub_create_revfile(ub, path + "ecspi3.dump", "0x2010000",
                                 "0x2010044")
            ge.ub_create_revfile(ub, path + "ecspi4.dump", "0x2014000",
                                 "0x2014044")

            ge.ub_create_revfile(ub, path + "enet1.dump", "0x2188000",
                                 "0x21881c4")

            ge.ub_create_revfile(ub, path + "ipu1.dump", "0x2600000",
                                 "0x260028c")
            ge.ub_create_revfile(ub, path + "ipu1_dmac.dump", "0x2608000",
                                 "0x2608108")
            ge.ub_create_revfile(ub, path + "ipu1_dp.dump", "0x2618000",
                                 "0x2618118")
            ge.ub_create_revfile(ub, path + "ipu1_ic.dump", "0x2620000",
                                 "0x262028")
            ge.ub_create_revfile(ub, path + "ipu1_csi0.dump", "0x2630000",
                                 "0x26300f0")
            ge.ub_create_revfile(ub, path + "ipu1_csi1.dump", "0x2638000",
                                 "0x26380f0")
            ge.ub_create_revfile(ub, path + "ipu1_diu0.dump", "0x2640000",
                                 "0x2640178")
            ge.ub_create_revfile(ub, path + "ipu1_diu1.dump", "0x2648000",
                                 "0x2648178")
            ge.ub_create_revfile(ub, path + "ipu1_dc.dump", "0x2658000",
                                 "0x26581cc")
Esempio n. 30
0
def ari_ub_check_register(
    lab: typing.Optional[linux.LinuxShell] = None,
    board: typing.Optional[board.Board] = None,
    ubx: typing.Optional[board.UBootShell] = None,
) -> None:
    """
    check U-Boot register
    """
    with lab or tbot.acquire_lab() as lh:
        with contextlib.ExitStack() as cx:
            if board is not None:
                b = board
            else:
                b = cx.enter_context(tbot.acquire_board(lh))

            if ubx is not None:
                ub = ubx
            else:
                ub = cx.enter_context(tbot.acquire_uboot(b))

            if "lg4573" in ub.bootlog:
                ub.exec0("lgset")
            path = "tc/aristainetos/files/"
            files = [
                "ccm.dump",
                "ccm_an.dump",
                "pinmux.dump",
                "usdhc1.dump",
                "usdhc2.dump",
                "gpio1.dump",
                "gpio2.dump",
                "gpio3.dump",
                "gpio4.dump",
                "gpio5.dump",
                "gpio6.dump",
                "gpio7.dump",
                "pwm1.dump",
                "pwm2.dump",
                "pwm3.dump",
                "pwm4.dump",
                "ecspi1.dump",
                "ecspi2.dump",
                "ecspi3.dump",
                "ecspi4.dump",
                "enet1.dump",
                "ipu1.dump",
                "ipu1_dmac.dump",
                "ipu1_dp.dump",
                "ipu1_ic.dump",
                "ipu1_csi0.dump",
                "ipu1_csi1.dump",
                "ipu1_diu0.dump",
                "ipu1_diu1.dump",
                "ipu1_dc.dump",
                "ldb.dump",
            ]
            files = ["pinmux.dump"]
            files = [
                "ipu1.dump",
                "ipu1_dmac.dump",
                "ipu1_dp.dump",
                "ipu1_ic.dump",
                "ipu1_csi0.dump",
                "ipu1_csi1.dump",
                "ipu1_diu0.dump",
                "ipu1_diu1.dump",
                "ipu1_dc.dump",
                "ldb.dump",
            ]
            files = [
                "gpio1.dump",
                "gpio2.dump",
                "gpio3.dump",
                "gpio4.dump",
                "gpio5.dump",
                "gpio6.dump",
                "gpio7.dump",
            ]
            files = [
                "ccm.dump",
                "ccm_an.dump",
            ]
            files = [
                "ipu1.dump",
                "ipu1_dmac.dump",
                "ipu1_dp.dump",
                "ipu1_ic.dump",
                "ipu1_csi0.dump",
                "ipu1_csi1.dump",
                "ipu1_diu0.dump",
                "ipu1_diu1.dump",
                "ipu1_dc.dump",
                "ldb.dump",
                "ccm.dump",
                "ccm_an.dump",
            ]
            files = ["pinmux.dump"]
            for f in files:
                #ge.ub_check_revfile(ub, path + f, "diff_pinmux.txt", "/home/hs/data/Entwicklung/prozessordoku/imx6/IMX6SDLRM.txt")
                ge.ub_check_revfile(ub, path + f)