diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2ee1ce5..728520d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,6 +28,11 @@ jobs: steps: - uses: actions/checkout@v3 + - name: test + run: | + ls -l + pwd + - name: Install packages if: ${{ env.ACT }} run: | @@ -37,13 +42,26 @@ jobs: - name: Run scripts in Renode uses: antmicro/renode-linux-runner-action@v1 with: + board: custom + resc: /home/runner/work/protoplaster/protoplaster/test_platform/init.resc + repl: /home/runner/work/protoplaster/protoplaster/test_platform/platform.repl + arch: riscv64 + kernel: /home/runner/work/protoplaster/protoplaster/test_platform/kernel-riscv64-hifive_unleashed_virtio.tar.xz + image-type: native + image: /home/runner/work/protoplaster/protoplaster/test_platform/image-riscv64-default.tar.xz shared-dirs: ./ renode-run: | - python -m venv .venv - source .venv/bin/activate - pip install . - protoplaster -t tests/basic.yml + ls /dev + mount /dev/sdb /mnt + ls /mnt + cat mnt/test.txt + # python -m venv .venv + # source .venv/bin/activate + # pip install . + # protoplaster -t tests/basic.yml devices: | vivid gpio 0 32 i2c 0x1C + tasks: | + /home/runner/work/protoplaster/protoplaster/test_platform/renode_network.yml \ No newline at end of file diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 6e1d9e8..941d5c0 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -2,8 +2,8 @@ name: Generate and publish docs on: push: - branches: - - main + # branches: + # - main pull_request: workflow_dispatch: schedule: @@ -35,6 +35,9 @@ jobs: - name: Generate test report from yml run: | + sudo modprobe i2c-stub chip_addr=0x3C + sudo modprobe vivid + sudo modprobe gpio-mockup gpio_mockup_ranges=0,32 protoplaster -t example.yml --csv report.csv protoplaster-test-report report.csv -t md diff --git a/test_platform/drive.img b/test_platform/drive.img new file mode 100644 index 0000000..34b4246 Binary files /dev/null and b/test_platform/drive.img differ diff --git a/test_platform/image-riscv64-default.tar.xz b/test_platform/image-riscv64-default.tar.xz new file mode 100644 index 0000000..3ad44ea Binary files /dev/null and b/test_platform/image-riscv64-default.tar.xz differ diff --git a/test_platform/init.resc b/test_platform/init.resc new file mode 100644 index 0000000..6475028 --- /dev/null +++ b/test_platform/init.resc @@ -0,0 +1,30 @@ +$name?="hifive-unleashed" + +using sysbus +mach create $name +machine LoadPlatformDescription @action/device/hifive_unleashed/platform.repl + +# rootfs +machine LoadPlatformDescriptionFromString 'virtio: Storage.VirtIOBlockDevice @ sysbus 0x100d0000 { IRQ -> plic@50 }' +virtio LoadImage @images/rootfs.img + +machine LoadPlatformDescriptionFromString 'virtio2: Storage.VirtIOBlockDevice @ sysbus 0x100e0000 { IRQ -> plic@51 }' +virtio2 LoadImage @/home/runner/work/protoplaster/protoplaster/test_platform/drive.img + + +showAnalyzer uart0 +e51 LogFunctionNames true + +$fdt ?= @images/hifive-unleashed-a00.dtb +$elf ?= @images/fw_payload.elf +$image ?= @images/Image +$rootfs ?= @images/rootfs.cpio + +macro reset +""" + sysbus LoadELF $elf + sysbus LoadFdt $fdt 0x88000000 "earlycon=sbi console=ttyS0 root=/dev/ram init=/sbin/init initrd=0x8d000000,28M" + sysbus LoadBinary $rootfs 0x8D000000 + sysbus LoadBinary $image 0x8B000000 +""" +runMacro $reset diff --git a/test_platform/kernel-riscv64-hifive_unleashed.tar.xz b/test_platform/kernel-riscv64-hifive_unleashed.tar.xz new file mode 100644 index 0000000..e5e3a11 Binary files /dev/null and b/test_platform/kernel-riscv64-hifive_unleashed.tar.xz differ diff --git a/test_platform/kernel-riscv64-hifive_unleashed_virtio.tar.xz b/test_platform/kernel-riscv64-hifive_unleashed_virtio.tar.xz new file mode 100644 index 0000000..a4cb5b4 Binary files /dev/null and b/test_platform/kernel-riscv64-hifive_unleashed_virtio.tar.xz differ diff --git a/test_platform/platform.repl b/test_platform/platform.repl new file mode 100644 index 0000000..378c44f --- /dev/null +++ b/test_platform/platform.repl @@ -0,0 +1,83 @@ +// Custom board - HiFive Unleashed singlecore +// Three u54 cores are disabled here to increase emulation speed + +e51: CPU.RiscV64 @ sysbus + cpuType: "rv64imac" + hartId: 0 + privilegeArchitecture: PrivilegeArchitecture.Priv1_10 + timeProvider: clint + +u54_1: CPU.RiscV64 @ sysbus + cpuType: "rv64gc" + hartId: 1 + privilegeArchitecture: PrivilegeArchitecture.Priv1_10 + timeProvider: clint + +debug: Memory.MappedMemory @sysbus 0x0 + size: 0x1000 + +e51DTim: Memory.MappedMemory @ sysbus 0x01000000 + size: 0x2000 + +u54Hart1ITim: Memory.MappedMemory @ sysbus 0x01808000 + size: 0x7000 + +clint: IRQControllers.CoreLevelInterruptor @ sysbus 0x2000000 + frequency: 1000000 + numberOfTargets: 2 + [0, 1] -> e51@[3, 7] + [2, 3] -> u54_1@[3, 7] + +plic: IRQControllers.PlatformLevelInterruptController @ sysbus 0xc000000 + 0 -> e51@11 + [1,2] -> u54_1@[11,9] + numberOfSources: 53 + numberOfContexts: 9 + prioritiesEnabled : false + +uart0: UART.SiFive_UART @ sysbus 0x10010000 + IRQ -> plic@4 + +uart1: UART.SiFive_UART @ sysbus 0x10011000 + IRQ -> plic@5 + +qspi0Flash: Memory.MappedMemory @ sysbus 0x20000000 + size: 0x2000000 + +ddr: Memory.MappedMemory @ sysbus 0x80000000 + size: 0x200000000 + +ethernet: Network.CadenceGEM @ sysbus 0x10090000 + moduleRevision: 0x0109 + moduleId: 0x1007 + IRQ -> plic@53 + +phy: Network.EthernetPhysicalLayer @ ethernet 0 + Id1: 0x0141 + Id2: 0x0e40 + BasicStatus: 0x62A4 + AutoNegotiationAdvertisement: 0x1e1 + AutoNegotiationLinkPartnerBasePageAbility: 0x1e1 + MasterSlaveControl: 0x300 + MasterSlaveStatus: 0x3000 + +qspi0: SPI.HiFive_SPI @ sysbus 0x10040000 + IRQ -> plic@51 + numberOfSupportedSlaves: 1 + +// The registration address value is taken from the device tree. +// It is different in the documentation (0x10140000). +qspi1: SPI.HiFive_SPI @ sysbus 0x10041000 + IRQ -> plic@52 + numberOfSupportedSlaves: 4 + +qspi2: SPI.HiFive_SPI @ sysbus 0x10050000 + IRQ -> plic@6 + numberOfSupportedSlaves: 1 + +pwm0: HiFive_PWM @ sysbus 0x10020000 + IRQ -> plic@42 + +pwm1: HiFive_PWM @ sysbus 0x10021000 + IRQ -> plic@46 + diff --git a/test_platform/renode_network.yml b/test_platform/renode_network.yml new file mode 100644 index 0000000..b65fd58 --- /dev/null +++ b/test_platform/renode_network.yml @@ -0,0 +1,15 @@ +name: renode_network +shell: renode +requires: [renode_config] +echo: true +timeout: 10 +fail-fast: true +sleep: 0 +commands: + - emulation CreateSwitch "${{SWITCH_NAME}}" + - emulation CreateTap "${{TAP_INTERFACE}}" "tap" + - connector Connect host.tap ${{SWITCH_NAME}} + - connector Connect sysbus.ethernet ${{SWITCH_NAME}} +vars: + SWITCH_NAME: switch0 + TAP_INTERFACE: tap0