Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
Signed-off-by: kimpaller <[email protected]>
  • Loading branch information
kimpaller committed Oct 5, 2023
1 parent dd9d324 commit 2cebbef
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 65 deletions.
6 changes: 3 additions & 3 deletions doc/manager_recovery.pu
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ if (Is Linux is accessible?) then (yes)
#palegreen: Home sweet home;
kill
else (no)

if (usbsdmux enabled) then (yes)
partition #yellow "SD Card Mux"{
: power down board using PDU
__power.power_down_board()__;
if (SD card mode) then (yes)
: update boot files
: update boot files
from within sdcard
via usb-sd-mux;
else (no)
: update boot files
: update boot files
from external sources
via usb-sd-mux;
endif
Expand Down
1 change: 1 addition & 0 deletions nebula/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class LinuxNotReached(Error):

pass


class UbootNotReached(Error):
"""U-boot menu not reachable"""

Expand Down
8 changes: 6 additions & 2 deletions nebula/jtag.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def target_set_str(self, target_name):
+ "}} ; "
)

def boot_to_uboot(self, fsblpath="fsbl.elf" ,ubootpath="u-boot.elf"):
def boot_to_uboot(self, fsblpath="fsbl.elf", ubootpath="u-boot.elf"):
"""From JTAG reset board and load up FSBL and uboot
This should be followed by uboot interaction to stop it"""
assert os.path.isfile(fsblpath)
Expand Down Expand Up @@ -143,7 +143,11 @@ def boot_to_uboot(self, fsblpath="fsbl.elf" ,ubootpath="u-boot.elf"):
cmd += "after 1000; "

cmd += "puts {Loading U-BOOT}; "
cmd += "if {[catch {dow " + ubootpath + "} result]} {puts {Error loading FSBL... u-boot is probably loaded}; }; "
cmd += (
"if {[catch {dow "
+ ubootpath
+ "} result]} {puts {Error loading FSBL... u-boot is probably loaded}; }; "
)
cmd += "con; "
self.run_xsdb(cmd)

Expand Down
35 changes: 22 additions & 13 deletions nebula/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
class manager:
"""Board Manager"""

def __init__(
def __init__( # noqa:C901
self,
monitor_type="uart",
configfilename=None,
Expand Down Expand Up @@ -112,7 +112,9 @@ def __init__(
self.tftp = False

if "usbmux-config" in configs:
self.usbsdmux = usbmux(yamlfilename=self.configfilename, board_name=board_name)
self.usbsdmux = usbmux(
yamlfilename=self.configfilename, board_name=board_name
)
else:
self.usbsdmux = None

Expand Down Expand Up @@ -201,15 +203,15 @@ def network_check(self):
raise ne.SSHNotFunctionalAfterBootFileUpdate

@_release_thread_lock
def recover_board(
self,
def recover_board( # noqa:C901
self,
system_top_bit_path,
bootbinpath,
uimagepath,
devtreepath,
fsblpath=None,
ubootpath=None,
sdcard=False
sdcard=False,
):
"""Recover boards with UART, PDU, JTAG, USB-SD-Mux and Network if available"""
self._check_files_exist(
Expand Down Expand Up @@ -263,7 +265,7 @@ def recover_board(
self.usbsdmux.update_boot_files_from_external(
bootbin_loc=bootbinpath,
kernel_loc=uimagepath,
devicetree_loc=devtreepath
devicetree_loc=devtreepath,
)
# if devtreepath:
# self.usbsdmux.update_devicetree_for_mux(devtreepath)
Expand Down Expand Up @@ -305,7 +307,8 @@ def recover_board(
devtree_filename=devtreepath,
)
results = self.monitor[0]._read_until_done_multi(
done_strings=["Starting kernel", "root@analog"], max_time=100
done_strings=["Starting kernel", "root@analog"],
max_time=100,
)

if len(results) == 1:
Expand All @@ -332,7 +335,7 @@ def recover_board(
devtreepath,
fsblpath,
ubootpath,
sdcard
sdcard,
)
log.info("Linux fully recovered")
else:
Expand All @@ -348,7 +351,7 @@ def board_reboot_jtag_uart(
devtreepath,
fsblpath=None,
ubootpath=None,
sdcard=False
sdcard=False,
):
"""Reset board and load fsbl, uboot, bitstream, and kernel
over JTAG. Then over UART boot
Expand All @@ -362,7 +365,7 @@ def board_reboot_jtag_uart(
log.info("u-boot accessible after JTAG reset")
else:
log.info("u-boot not reachable, manually loading u-boot over JTAG")
self.jtag.boot_to_uboot(fsblpath,ubootpath)
self.jtag.boot_to_uboot(fsblpath, ubootpath)
log.info("Taking over UART control")
if not self.monitor[0]._enter_uboot_menu_from_power_cycle():
raise ne.UbootNotReached
Expand Down Expand Up @@ -538,7 +541,7 @@ def board_reboot_sdmux_pdu(
self.usbsdmux.update_boot_files_from_external(
bootbin_loc=bootbinpath,
kernel_loc=uimagepath,
devicetree_loc=devtreepath
devicetree_loc=devtreepath,
)
# if devtreepath:
# self.usbsdmux.update_devicetree_for_mux(devtreepath)
Expand Down Expand Up @@ -753,10 +756,16 @@ def board_reboot_auto_folder(
)

def board_reboot_auto(
self, system_top_bit_path, bootbinpath, uimagepath, devtreepath, sdcard=False, recover=False
self,
system_top_bit_path,
bootbinpath,
uimagepath,
devtreepath,
sdcard=False,
recover=False,
):
"""Automatically select loading mechanism
based on current class setup"""
based on current class setup"""
if recover:
self.recover_board(
system_top_bit_path=system_top_bit_path,
Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def power_off_dut(config, board):
p.power_down_board()
yield


@pytest.fixture()
def power_on_dut(config, board):
p = pdu(
Expand Down
2 changes: 1 addition & 1 deletion tests/nebula_config/nebula-manager-usbmux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,4 @@ zynqmp-zcu102-rev10-adrv9002-vcmos:
- baudrate: 115200
- logfilename: zynqmp-zcu102-rev10-adrv9002-vcmos.log
usbmux-config:
- target_mux: id-000000001358
- target_mux: id-000000001358
Loading

0 comments on commit 2cebbef

Please sign in to comment.