1*** Keywords ***
2Write To Uart And Wait
3    [Arguments]            ${input}            ${expected_output}
4    Write Line To Uart            ${input}
5    Wait For Line On Uart         ${expected_output}
6
7*** Test Cases ***
8List Fomu in Linux
9    Execute Command               using sysbus
10
11    # Create an USB connector
12    Execute Command               emulation CreateUSBConnector "usb_connector"
13
14    # Create FOMU board
15    Execute Command               mach create "fomu"
16    Execute Command               machine LoadPlatformDescription @platforms/cpus/fomu.repl
17    Execute Command               sysbus LoadELF @https://dl.antmicro.com/projects/renode/fomu--foboot.elf-s_112080-c31fe1f32fba7894338f3cf4bfb82ec2a8265683
18    Execute Command               connector Connect valenty usb_connector
19
20    # Create Linux board
21    Execute Command               mach clear
22    Execute Command               set fdt @https://dl.antmicro.com/projects/renode/hifive_unleashed_usb--devicetree_with_pse_usb.dtb-s_8894-5e4fb8fcdadcd8e35c841a430a83bf66df192c69
23    Execute Command               set bin @https://dl.antmicro.com/projects/renode/hifive_unleashed_usb--bbl.elf-s_17285160-88e89cf2bb6dc92d176cfffcabb06b0d8b28c1cc
24    Execute Command               include @scripts/single-node/hifive_unleashed.resc
25    Execute Command               machine LoadPlatformDescriptionFromString 'usb: USB.MPFS_USB @ sysbus 0x30020000 { MainIRQ -> plic@0x20 }'
26
27    Create Terminal Tester
28    ...                           sysbus.uart0
29    ...                           machine=hifive-unleashed
30
31    Start Emulation
32
33    Wait For Prompt On Uart       buildroot login:
34    Write Line To Uart            root
35
36    Wait For Prompt On Uart       Password:
37    Write Line To Uart            root             waitForEcho=False
38
39    Wait For Prompt On Uart       \#
40
41    Execute Command               usb_connector RegisterInController usb
42    Wait For Line On Uart         usb 1-1: new high-speed USB device number 2 using musb-hdrc
43    Write Line To Uart            cd /sys/bus/usb/devices
44
45    # it might take a while for the USB device to show up
46    Wait Until Keyword Succeeds   10x    0
47    ...  Write To Uart And Wait   ls -l
48    ...                           1-1
49
50    Write Line To Uart            cd 1-1
51
52    Write Line To Uart            cat manufacturer
53    Wait For Line On Uart         Foosn
54
55    Write Line To Uart            cat product
56    Wait For Line On Uart         Fomu PVT running DFU Bootloader v1.9-11-gc7ee25b
57
58