Skip to content

Commit

Permalink
Adds arm32 device (antmicro#44)
Browse files Browse the repository at this point in the history
* Adds arm32 device

Adds zynq_7000 - new default arm32 device
Adds default kernel and image for arm32
Adds new release tests
Updates documentation and readme

* Adds arm32 tests to pull-request workflow
  • Loading branch information
WiktorOgrodnik authored Jun 13, 2023
1 parent 8819fd4 commit 4a7519e
Show file tree
Hide file tree
Showing 21 changed files with 563 additions and 14 deletions.
47 changes: 42 additions & 5 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ jobs:
strategy:
fail-fast: false
matrix:
arch: [riscv64]
board: [hifive_unleashed]
arch: [riscv64, arm32]
include:
- arch: riscv64
board: hifive_unleashed
- arch: arm32
board: zynq_7000

steps:
- uses: actions/checkout@v3

Expand All @@ -33,7 +38,7 @@ jobs:
strategy:
fail-fast: false
matrix:
arch: [riscv64]
arch: [riscv64, arm32]
steps:
- uses: actions/checkout@v3

Expand All @@ -51,7 +56,7 @@ jobs:
with:
path: images/

pr-test:
pr-riscv64-test:
runs-on: ubuntu-latest
needs: [pr-build-kernel, pr-build-image]
if: ${{ !failure() && !github.event.act }}
Expand All @@ -71,7 +76,39 @@ jobs:
image: artifact/image-riscv64-default.tar.xz
renode-run: |
wget example.org
gpiodetect
sh gpio.sh
sh i2c.sh
python pyrav4l2/.github/save_examples.py pyrav4l2/README.md
python examples/controls-enumeration.py
devices: |
vivid
gpio 0 16
i2c 0x1C
python-packages: |
git+https://github.com/antmicro/pyrav4l2.git@3c071a7494b6b67263c4dddb87b47025338fd960
git+https://github.com/antmicro/tuttest.git@c44309e0365c54759fb36864fb77bf8b347bd647
repos: https://github.com/antmicro/pyrav4l2.git pyrav4l2

pr-arm32-test:
runs-on: ubuntu-latest
needs: [pr-build-kernel, pr-build-image]
if: ${{ !failure() && !github.event.act }}
steps:
- uses: actions/checkout@v3

- uses: actions/download-artifact@v3
with:
path: ./

- name: test
uses: ./
with:
shared-dirs: tests
arch: arm32
kernel: artifact/kernel-arm32-zynq_7000.tar.xz
image: artifact/image-arm32-default.tar.xz
renode-run: |
wget example.org
sh gpio.sh
sh i2c.sh
python pyrav4l2/.github/save_examples.py pyrav4l2/README.md
Expand Down
58 changes: 55 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ jobs:
strategy:
fail-fast: false
matrix:
arch: [riscv64]
board: [hifive_unleashed]
arch: [riscv64, arm32]
include:
- arch: riscv64
board: hifive_unleashed
- arch: arm32
board: zynq_7000

steps:
- uses: actions/checkout@v3
Expand All @@ -72,7 +76,7 @@ jobs:
strategy:
fail-fast: false
matrix:
arch: [riscv64]
arch: [riscv64, arm32]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -137,6 +141,33 @@ jobs:
git+https://github.com/antmicro/tuttest.git@c44309e0365c54759fb36864fb77bf8b347bd647
repos: https://github.com/antmicro/pyrav4l2.git pyrav4l2

arm32-test:
runs-on: ubuntu-latest
needs: send-to-releases
if: ${{ !failure() && !github.event.act }}
steps:
- uses: actions/checkout@v3

- name: test
uses: ./
with:
arch: arm32
shared-dirs: tests
renode-run: |
wget example.org
sh gpio.sh
sh i2c.sh
python pyrav4l2/.github/save_examples.py pyrav4l2/README.md
python examples/controls-enumeration.py
devices: |
vivid
gpio 0 16
i2c 0x1C
python-packages: |
git+https://github.com/antmicro/pyrav4l2.git@3c071a7494b6b67263c4dddb87b47025338fd960
git+https://github.com/antmicro/tuttest.git@c44309e0365c54759fb36864fb77bf8b347bd647
repos: https://github.com/antmicro/pyrav4l2.git pyrav4l2

riscv64-docker-test:
runs-on: ubuntu-latest
needs: send-to-releases
Expand All @@ -156,6 +187,27 @@ jobs:
bash bash_test.sh
devices: vivid

arm32-docker-test:
runs-on: ubuntu-latest
needs: send-to-releases
if: ${{ !failure() && !github.event.act }}
steps:
- uses: actions/checkout@v3

- name: test
uses: ./
with:
arch: arm32
image-type: docker
image: arm32v7/ubuntu
shared-dirs: tests
renode-run: |
ls /dev | grep video
bash bash_test.sh
uname -a
cat /etc/os-release
devices: vivid

should-fail-test:
runs-on: ubuntu-latest
needs: send-to-releases
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ The Linux emulation runs on the RISC-V/HiFive Unleashed single core platform in

### Architecture

Currently, the only supported architecture of the emulated system is RISC-V. You can specify the architecture with the `arch` parameter:
You can specify the architecture with the `arch` parameter. The default architecture is `riscv64`.

```yaml
- uses: antmicro/renode-linux-runner-action@v0
Expand All @@ -128,6 +128,11 @@ Currently, the only supported architecture of the emulated system is RISC-V. You
renode-run: ...
```

Available architectures:

- riscv64
- arm32 (armv7)

We are working on `arm64` support.

## Shared directories
Expand Down Expand Up @@ -323,5 +328,6 @@ It is possible to replace the Linux image on which the tests are run and mount t
The action allows you to select your own board and choose its configuration. You can select a board from the list (remember that you also need to select the matching processor architecture). Here are the available boards:

- [riscv64 - hifive_unleashed](action/device/hifive_unleashed/init.resc)
- [arm32 - zynq_7000](action/device/zynq_7000/init.resc)

You can also choose the default board: `default` or your own board: `custom`. In the latter case, you have to provide your own resc and repl files, which will configure the emulation. Configuration files can be selected using [`resc`](https://renode.readthedocs.io/en/latest/introduction/using.html#resc-scripts) and [`repl`](https://renode.readthedocs.io/en/latest/advanced/platform_description_format.html) parameters. You can read more about these files in the [Renode documentation](https://renode.readthedocs.io/en/latest/index.html).
6 changes: 6 additions & 0 deletions action/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ class Architecture:
default_board="hifive_unleashed",
network_available=True,
),
"arm32": Architecture(
python_name="armv7l",
docker_name="arm32v7",
default_board="zynq_7000",
network_available=True,
),
}


Expand Down
39 changes: 39 additions & 0 deletions action/device/zynq_7000/init.resc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
:name: Zynq-7000 SoC
:description: This script runs Linux on Zynq-7000 SoC.

using sysbus
$name?="Zynq"
mach create $name

machine LoadPlatformDescription @action/device/zynq_7000/platform.repl
showAnalyzer uart0
sysbus Redirect 0xC0000000 0x0 0x10000000

$bin?=@images/vmlinux
$rootfs?=@images/rootfs.cpio
$dtb?=@images/zynq-test.dtb

# Set timer frequency
ttc0 Frequency 33333333
ttc1 Frequency 33333333

# rootfs
machine LoadPlatformDescriptionFromString 'virtio: Storage.VirtIOBlockDevice @ sysbus 0xe0104000 { IRQ -> gic@63 }'
virtio LoadImage @images/rootfs.img

# This setting increases emulation speed, thus mitigates networks errors and speedup user scripts.
machine SetAdvanceImmediately true

# Set registers
cpu SetRegisterUnsafe 0 0x000
cpu SetRegisterUnsafe 1 0xD32 # processor variant (cortex-a9)
cpu SetRegisterUnsafe 2 0x100 # device tree address

macro reset
"""
sysbus LoadELF $bin
sysbus LoadFdt $dtb 0x100 "console=ttyPS0,115200 root=/dev/ram0 rw init=/init initrd=0x1a000000,32M" false
sysbus ZeroRange 0x1a000000 0x800000
sysbus LoadBinary $rootfs 0x1a000000
"""
runMacro $reset
145 changes: 145 additions & 0 deletions action/device/zynq_7000/platform.repl
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
usbEhci2: USBDeprecated.EHCIHostController @ sysbus <0xE0003000, +0x1000>
-> gic@44

usbEhci: USBDeprecated.EHCIHostController @ sysbus <0xE0002000, +0x1000>
-> gic@21

pl310: Cache.PL310 @ sysbus <0xF8F02000, +0x1000>

gem0: Network.CadenceGEM @ sysbus <0xE000B000, +0x1000>
-> gic@22

gem1: Network.CadenceGEM @ sysbus <0xE000C000, +0x1000>
-> gic@45

phy: Network.EthernetPhysicalLayer @ gem0 3
BasicStatus: 0x62A4
Id1: 0x0022
Id2: 0x1611
AutoNegotiationAdvertisement: 0x1e1
AutoNegotiationLinkPartnerBasePageAbility: 0x1e1
MasterSlaveControl: 0x300
MasterSlaveStatus: 0x3000

uart0: UART.Cadence_UART @ sysbus 0xE0000000
-> gic@27

uart1: UART.Cadence_UART @ sysbus 0xE0001000
-> gic@50

i2c1: I2C.Cadence_I2C @ sysbus 0xE0005000
-> gic@48

i2c0: I2C.Cadence_I2C @ sysbus 0xE0004000
-> gic@25

spi0: SPI.Cadence_SPI @ sysbus 0xE0006000
-> gic@26

spi1: SPI.Cadence_SPI @ sysbus 0xE0007000
-> gic@49

sdhci0: SD.SDHCI @ sysbus <0xE0100000, +0x1000>

sdhci1: SD.SDHCI @ sysbus <0xE0101000, +0x1000>

memory: Memory.MappedMemory @ sysbus 0x0
size: 0x40000000

onChipMemory: Memory.MappedMemory @ sysbus 0xFFFC0000
size:0x40000

ttc0: Timers.Cadence_TTC @ sysbus 0xF8001000
[0-2] -> gic@[10-12]

ttc1: Timers.Cadence_TTC @ sysbus 0xF8002000
[0-2] -> gic@[37-39]

privateTimer: Timers.CortexAPrivateTimer @ sysbus <0xF8F00600, +0x200>
-> gic#0@29

globalTimer: Timers.CortexAGlobalTimer @ sysbus 0xF8F00200
-> gic#0@27
frequency: 433333333

gic: IRQControllers.GIC @ {
sysbus new Bus.BusMultiRegistration { address: 0xF8F01000; size: 0x1000; region: "distributor" };
sysbus new Bus.BusMultiRegistration { address: 0xF8F00100; size: 0x100; region: "cpuInterface" }
}
0 -> cpu@0
numberOfCPUs: 1
CpuInterfaceImplementer: 0x3901243B

scu: Miscellaneous.SnoopControlUnit @ sysbus <0xF8F00000, +0x100>

cpu: CPU.Arm @ sysbus
cpuType: "cortex-a9"

qspi: SPI.XilinxQSPI @ sysbus <0xE000D000, +0x1000>
-> gic@19

gpio: GPIOPort.XilinxGPIOPS @ sysbus 0xE000A000

xadc: Analog.Xilinx_XADC @ sysbus 0xF8007100
-> gic@7

armPllCtrl: Python.PythonPeripheral @ sysbus 0xF8000100
size: 0x4
initable: false
script: "request.value = 0x0001A008"

ddrPllCtrl: Python.PythonPeripheral @ sysbus 0xF8000104
size: 0x4
initable: false
script: "request.value = 0x0001A008"

ioPllCtrl: Python.PythonPeripheral @ sysbus 0xF8000108
size: 0x4
initable: false
script: "request.value = 0x0001A008"

pllStatus: Python.PythonPeripheral @ sysbus 0xF800010C
size: 0x4
initable: false
script: "request.value = 0x0000003F"

armClkCtrl: Python.PythonPeripheral @ sysbus 0xF8000120
size: 0x4
initable: false
script: "request.value = 0x1F000400"

ddrClkCtrl: Python.PythonPeripheral @ sysbus 0xF8000124
size: 0x4
initable: false
script: "request.value = 0x18400003"

aperClkCtrl: Python.PythonPeripheral @ sysbus 0xF800012C
size: 0x4
initable: false
script: "request.value = 0x01FFCCCD"

sdioClkCtrl: Python.PythonPeripheral @ sysbus 0xF8000150
size: 0x4
initable: false
script: "request.value = 0x00001E03"

gem0ClkCtrl: Python.PythonPeripheral @ sysbus 0xF8000140
size: 0x4
initable: false
script: "request.value = 0x00003C01"

clk261True: Python.PythonPeripheral @ sysbus 0xF80001C4
size: 0x4
initable: false
script: "request.value = 1"

nand: Python.PythonPeripheral @ sysbus 0xE000E000
size: 0x4
initable: false
script: "request.value = 0xFFFFFFFF"

sysbus:
init:
Tag <0xF8000000,0xF8000FFF> "XSLCR"
Tag <0xF8007000,0xF8007FFF> "devcfg"
Tag <0xF8003000,0xF8003FFF> "pl330_dma"
Loading

0 comments on commit 4a7519e

Please sign in to comment.