Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add echo server example for Pine64 Star64 #259

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion benchmark/benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <serial_config.h>
#include <ethernet_config.h>

#ifdef CONFIG_ARCH_ARM
#define LOG_BUFFER_CAP 7

/* Notification channels and TCB CAP offsets - ensure these align with .system file! */
Expand Down Expand Up @@ -353,4 +354,12 @@ seL4_Bool fault(microkit_child id, microkit_msginfo msginfo, microkit_msginfo *r
}

return seL4_False;
}
}
#endif

#ifdef CONFIG_ARCH_RISCV

void init(void) {}
void notified(microkit_channel ch) {}

#endif
25 changes: 18 additions & 7 deletions examples/echo_server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,44 @@ $(error MICROKIT_SDK must be specified)
endif
export override MICROKIT_SDK:=$(abspath ${MICROKIT_SDK})


ifeq ($(strip $(TOOLCHAIN)),)
TOOLCHAIN := aarch64-none-elf
export TOOLCHAIN := aarch64-none-elf
export LIBC := $(dir $(realpath $(shell aarch64-none-elf-gcc --print-file-name libc.a)))
endif

ifeq ($(strip $(MICROKIT_BOARD)), odroidc4)
export DRIV_DIR := meson
export UART_DRIV_DIR := meson
export TIMER_DRV_DIR := meson
export CPU := cortex-a55
export ARCH := aarch64
else ifneq ($(filter $(strip $(MICROKIT_BOARD)),imx8mm_evk imx8mp_evk maaxboard),)
export DRIV_DIR := imx
export UART_DRIV_DIR := imx
export TIMER_DRV_DIR := imx
export CPU := cortex-a53
export ARCH := aarch64
else ifeq ($(strip $(MICROKIT_BOARD)), qemu_virt_aarch64)
export DRIV_DIR := virtio
export UART_DRIV_DIR := arm
export TIMER_DRV_DIR := arm
export CPU := cortex-a53
QEMU := qemu-system-aarch64
export ARCH := aarch64
else ifeq ($(strip $(MICROKIT_BOARD)), star64)
export DRIV_DIR := dwmac-5.10a
export UART_DRIV_DIR := snps
export TIMER_DRV_DIR := jh7110
export ARCH := riscv64
else
$(error Unsupported MICROKIT_BOARD given)
endif

ifeq ($(ARCH),aarch64)
TOOLCHAIN := aarch64-none-elf
export TOOLCHAIN := aarch64-none-elf
export LIBC := $(dir $(realpath $(shell aarch64-none-elf-gcc --print-file-name libc.a)))
else ifeq ($(ARCH),riscv64)
TOOLCHAIN := riscv64-none-elf
export TOOLCHAIN := $(TOOLCHAIN)
export LIBC := $(dir $(realpath $(shell riscv64-none-elf-gcc --print-file-name libc.a)))
endif

export BUILD_DIR:=$(abspath ${BUILD_DIR})
export MICROKIT_SDK:=$(abspath ${MICROKIT_SDK})

Expand Down
295 changes: 295 additions & 0 deletions examples/echo_server/board/star64/echo_server.system
Original file line number Diff line number Diff line change
@@ -0,0 +1,295 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2024, UNSW

SPDX-License-Identifier: BSD-2-Clause
-->
<system>
<memory_region name="uart" size="0x1_000" phys_addr="0x10000000" />
<memory_region name="eth0" size="0x10_000" phys_addr="0x16030000" />
<memory_region name="timer" size="0x10_000" phys_addr="0x13050000" />
<memory_region name="resets" size="0x10_000" phys_addr="0x17000000" />

<!-- eth driver/device ring buffer mechanism -->
<memory_region name="hw_ring_buffer" size="0x10_000" />

<!-- DMA and virtualised DMA regions -->
<memory_region name="net_rx_buffer_data_region" size="0x200_000" page_size="0x200_000" /> <!-- Must be mapped read-only! -->
<memory_region name="net_tx_buffer_data_region_cli0" size="0x200_000" page_size="0x200_000" />
<memory_region name="net_rx_buffer_data_region_cli0" size="0x200_000" page_size="0x200_000" />
<memory_region name="net_tx_buffer_data_region_cli1" size="0x200_000" page_size="0x200_000" />
<memory_region name="net_rx_buffer_data_region_cli1" size="0x200_000" page_size="0x200_000" />

<!-- shared memory for driver/virt queue mechanism -->
<memory_region name="net_rx_free_drv" size="0x200_000" page_size="0x200_000"/>
<memory_region name="net_rx_active_drv" size="0x200_000" page_size="0x200_000"/>
<memory_region name="net_tx_free_drv" size="0x200_000" page_size="0x200_000"/>
<memory_region name="net_tx_active_drv" size="0x200_000" page_size="0x200_000"/>

<!-- shared memory for virt_rx/copy queue mechanism -->
<memory_region name="net_rx_free_copy0" size="0x200_000" page_size="0x200_000"/>
<memory_region name="net_rx_active_copy0" size="0x200_000" page_size="0x200_000"/>
<memory_region name="net_rx_free_copy1" size="0x200_000" page_size="0x200_000"/>
<memory_region name="net_rx_active_copy1" size="0x200_000" page_size="0x200_000"/>

<!-- shared memory for copy/lwip queue mechanism -->
<memory_region name="net_rx_free_cli0" size="0x200_000" page_size="0x200_000"/>
<memory_region name="net_rx_active_cli0" size="0x200_000" page_size="0x200_000"/>
<memory_region name="net_rx_free_cli1" size="0x200_000" page_size="0x200_000"/>
<memory_region name="net_rx_active_cli1" size="0x200_000" page_size="0x200_000"/>

<!-- shared memory for lwip/virt_tx queue mechanism -->
<memory_region name="net_tx_free_cli0" size="0x200_000" page_size="0x200_000"/>
<memory_region name="net_tx_active_cli0" size="0x200_000" page_size="0x200_000"/>
<memory_region name="net_tx_free_cli1" size="0x200_000" page_size="0x200_000"/>
<memory_region name="net_tx_active_cli1" size="0x200_000" page_size="0x200_000"/>

<memory_region name="cyclecounters" size="0x1000"/>

<!-- shared memory for serial data regions -->
<memory_region name="serial_tx_data_driver" size="0x4_000" />
<memory_region name="serial_tx_data_client0" size="0x2_000" />
<memory_region name="serial_tx_data_client1" size="0x2_000" />
<memory_region name="serial_tx_data_client2" size="0x2_000" />

<!-- shared memory for serial queue regions -->
<memory_region name="serial_tx_queue_driver" size="0x1_000" />
<memory_region name="serial_tx_queue_client0" size="0x1_000" />
<memory_region name="serial_tx_queue_client1" size="0x1_000" />
<memory_region name="serial_tx_queue_client2" size="0x1_000" />

<protection_domain name="benchIdle" priority="1" >
<program_image path="idle.elf" />
<!-- benchmark.c puts PMU data in here for lwip to collect -->
<map mr="cyclecounters" vaddr="0x5_010_000" perms="rw" cached="true" setvar_vaddr="cyclecounters_vaddr" />
</protection_domain>

<protection_domain name="bench" priority="102" >
<program_image path="benchmark.elf" />

<!-- <map mr="serial_tx_queue_client2" vaddr="0x4_001_000" perms="rw" cached="true" setvar_vaddr="serial_tx_queue" /> -->
<!-- <map mr="serial_tx_data_client2" vaddr="0x4_002_000" perms="rw" cached="true" setvar_vaddr="serial_tx_data" /> -->

<protection_domain name="eth" priority="101" id="1" budget="100" period="400">
<program_image path="eth_driver.elf" />
<map mr="eth0" vaddr="0x2_000_000" perms="rw" cached="false" setvar_vaddr="eth_regs"/>
<map mr="resets" vaddr="0x3_000_000" perms="rw" cached="false" setvar_vaddr="resets"/>

<map mr="hw_ring_buffer" vaddr="0x2_200_000" perms="rw" cached="false" setvar_vaddr="hw_ring_buffer_vaddr" />

<map mr="net_rx_free_drv" vaddr="0x2_400_000" perms="rw" cached="true" setvar_vaddr="rx_free" />
<map mr="net_rx_active_drv" vaddr="0x2_600_000" perms="rw" cached="true" setvar_vaddr="rx_active" />
<map mr="net_tx_free_drv" vaddr="0x2_800_000" perms="rw" cached="true" setvar_vaddr="tx_free" />
<map mr="net_tx_active_drv" vaddr="0x2_a00_000" perms="rw" cached="true" setvar_vaddr="tx_active" />

<irq irq="7" id="0" /> <!--> ethernet interrupt -->
<irq irq="6" id="20" /> <!--> ethernet interrupt -->
<irq irq="5" id="21" /> <!--> ethernet interrupt -->

<setvar symbol="hw_ring_buffer_paddr" region_paddr="hw_ring_buffer" />
</protection_domain>

<protection_domain name="uart" priority="100" id="9">
<program_image path="uart_driver.elf" />

<map mr="uart" vaddr="0x5_000_000" perms="rw" cached="false" setvar_vaddr="uart_base" />

<map mr="serial_tx_queue_driver" vaddr="0x4_001_000" perms="rw" cached="true" setvar_vaddr="tx_queue" />
<map mr="serial_tx_data_driver" vaddr="0x4_002_000" perms="rw" cached="true" setvar_vaddr="tx_data" />

<irq irq="32" id="0" /> <!-- UART interrupt -->
</protection_domain>

<protection_domain name="serial_virt_tx" priority="99" id="10">
<program_image path="serial_virt_tx.elf" />
<map mr="serial_tx_queue_driver" vaddr="0x4_000_000" perms="rw" cached="true" setvar_vaddr="tx_queue_drv" />
<map mr="serial_tx_queue_client0" vaddr="0x4_001_000" perms="rw" cached="true" setvar_vaddr="tx_queue_cli0" />
<map mr="serial_tx_queue_client1" vaddr="0x4_002_000" perms="rw" cached="true"/>
<map mr="serial_tx_queue_client2" vaddr="0x4_003_000" perms="rw" cached="true"/>

<map mr="serial_tx_data_driver" vaddr="0x4_004_000" perms="rw" cached="true" setvar_vaddr="tx_data_drv" />
<map mr="serial_tx_data_client0" vaddr="0x4_008_000" perms="r" cached="true" setvar_vaddr="tx_data_cli0" />
<map mr="serial_tx_data_client1" vaddr="0x4_00a_000" perms="r" cached="true"/>
<map mr="serial_tx_data_client2" vaddr="0x4_00c_000" perms="r" cached="true"/>
</protection_domain>

<protection_domain name="net_virt_rx" priority="99" id="2">
<program_image path="network_virt_rx.elf" />
<map mr="net_rx_free_drv" vaddr="0x2_000_000" perms="rw" cached="true" setvar_vaddr="rx_free_drv" />
<map mr="net_rx_active_drv" vaddr="0x2_200_000" perms="rw" cached="true" setvar_vaddr="rx_active_drv" />

<map mr="net_rx_free_copy0" vaddr="0x2_400_000" perms="rw" cached="true" setvar_vaddr="rx_free_cli0" />
<map mr="net_rx_active_copy0" vaddr="0x2_600_000" perms="rw" cached="true" setvar_vaddr="rx_active_cli0" />
<map mr="net_rx_free_copy1" vaddr="0x2_800_000" perms="rw" cached="true" />
<map mr="net_rx_active_copy1" vaddr="0x2_a00_000" perms="rw" cached="true" />

<map mr="net_rx_buffer_data_region" vaddr="0x2_c00_000" perms="r" cached="true" setvar_vaddr="buffer_data_vaddr" />
<setvar symbol="buffer_data_paddr" region_paddr="net_rx_buffer_data_region" />
</protection_domain>

<protection_domain name="copy0" priority="98" budget="20000" id="4">
<program_image path="copy.elf" />
<map mr="net_rx_free_copy0" vaddr="0x2_000_000" perms="rw" cached="true" setvar_vaddr="rx_free_virt" />
<map mr="net_rx_active_copy0" vaddr="0x2_200_000" perms="rw" cached="true" setvar_vaddr="rx_active_virt" />

<map mr="net_rx_free_cli0" vaddr="0x2_400_000" perms="rw" cached="true" setvar_vaddr="rx_free_cli" />
<map mr="net_rx_active_cli0" vaddr="0x2_600_000" perms="rw" cached="true" setvar_vaddr="rx_active_cli" />

<map mr="net_rx_buffer_data_region" vaddr="0x2_800_000" perms="r" cached="true" setvar_vaddr="virt_buffer_data_region" />
<map mr="net_rx_buffer_data_region_cli0" vaddr="0x2_a00_000" perms="rw" cached="true" setvar_vaddr="cli_buffer_data_region" />
</protection_domain>

<protection_domain name="copy1" priority="96" budget="20000" id="5">
<program_image path="copy.elf" />
<map mr="net_rx_free_copy1" vaddr="0x2_000_000" perms="rw" cached="true" setvar_vaddr="rx_free_virt" />
<map mr="net_rx_active_copy1" vaddr="0x2_200_000" perms="rw" cached="true" setvar_vaddr="rx_active_virt" />

<map mr="net_rx_free_cli1" vaddr="0x2_400_000" perms="rw" cached="true" setvar_vaddr="rx_free_cli" />
<map mr="net_rx_active_cli1" vaddr="0x2_600_000" perms="rw" cached="true" setvar_vaddr="rx_active_cli" />

<map mr="net_rx_buffer_data_region" vaddr="0x2_800_000" perms="r" cached="true" setvar_vaddr="virt_buffer_data_region" />
<map mr="net_rx_buffer_data_region_cli1" vaddr="0x2_a00_000" perms="rw" cached="true" setvar_vaddr="cli_buffer_data_region" />
</protection_domain>

<protection_domain name="net_virt_tx" priority="100" budget="20000" id="3">
<program_image path="network_virt_tx.elf" />
<map mr="net_tx_free_drv" vaddr="0x2_000_000" perms="rw" cached="true" setvar_vaddr="tx_free_drv" />
<map mr="net_tx_active_drv" vaddr="0x2_200_000" perms="rw" cached="true" setvar_vaddr="tx_active_drv" />

<map mr="net_tx_free_cli0" vaddr="0x2_400_000" perms="rw" cached="true" setvar_vaddr="tx_free_cli0" />
<map mr="net_tx_active_cli0" vaddr="0x2_600_000" perms="rw" cached="true" setvar_vaddr="tx_active_cli0" />
<map mr="net_tx_free_cli1" vaddr="0x2_800_000" perms="rw" cached="true" />
<map mr="net_tx_active_cli1" vaddr="0x2_a00_000" perms="rw" cached="true" />

<map mr="net_tx_buffer_data_region_cli0" vaddr="0x2_c00_000" perms="r" cached="true" setvar_vaddr="buffer_data_region_cli0_vaddr" />
<map mr="net_tx_buffer_data_region_cli1" vaddr="0x2_e00_000" perms="r" cached="true" />
<setvar symbol="buffer_data_region_cli0_paddr" region_paddr="net_tx_buffer_data_region_cli0" />
<setvar symbol="buffer_data_region_cli1_paddr" region_paddr="net_tx_buffer_data_region_cli1" />
</protection_domain>

<protection_domain name="client0" priority="97" budget="20000" id="6">
<program_image path="lwip.elf" />

<map mr="net_rx_free_cli0" vaddr="0x2_000_000" perms="rw" cached="true" setvar_vaddr="rx_free" />
<map mr="net_rx_active_cli0" vaddr="0x2_200_000" perms="rw" cached="true" setvar_vaddr="rx_active" />
<map mr="net_tx_free_cli0" vaddr="0x2_400_000" perms="rw" cached="true" setvar_vaddr="tx_free" />
<map mr="net_tx_active_cli0" vaddr="0x2_600_000" perms="rw" cached="true" setvar_vaddr="tx_active" />

<map mr="net_rx_buffer_data_region_cli0" vaddr="0x2_800_000" perms="rw" cached="true" setvar_vaddr="rx_buffer_data_region" />
<map mr="net_tx_buffer_data_region_cli0" vaddr="0x2_a00_000" perms="rw" cached="true" setvar_vaddr="tx_buffer_data_region" />

<map mr="serial_tx_queue_client0" vaddr="0x4_000_000" perms="rw" cached="true" setvar_vaddr="serial_tx_queue" />
<map mr="serial_tx_data_client0" vaddr="0x4_001_000" perms="rw" cached="true" setvar_vaddr="serial_tx_data" />

<map mr="cyclecounters" vaddr="0x5_010_000" perms="rw" cached="true" setvar_vaddr="cyclecounters_vaddr" />
</protection_domain>

<protection_domain name="client1" priority="95" budget="20000" id="7">
<program_image path="lwip.elf" />

<map mr="net_rx_free_cli1" vaddr="0x2_000_000" perms="rw" cached="true" setvar_vaddr="rx_free" />
<map mr="net_rx_active_cli1" vaddr="0x2_200_000" perms="rw" cached="true" setvar_vaddr="rx_active" />
<map mr="net_tx_free_cli1" vaddr="0x2_400_000" perms="rw" cached="true" setvar_vaddr="tx_free" />
<map mr="net_tx_active_cli1" vaddr="0x2_600_000" perms="rw" cached="true" setvar_vaddr="tx_active" />

<map mr="net_rx_buffer_data_region_cli1" vaddr="0x2_800_000" perms="rw" cached="true" setvar_vaddr="rx_buffer_data_region" />
<map mr="net_tx_buffer_data_region_cli1" vaddr="0x2_a00_000" perms="rw" cached="true" setvar_vaddr="tx_buffer_data_region" />

<map mr="serial_tx_queue_client1" vaddr="0x4_000_000" perms="rw" cached="true" setvar_vaddr="serial_tx_queue" />
<map mr="serial_tx_data_client1" vaddr="0x4_001_000" perms="rw" cached="true" setvar_vaddr="serial_tx_data" />
</protection_domain>

<protection_domain name="timer" priority="101" pp="true" id="8" passive="true">
<program_image path="timer_driver.elf" />
<map mr="timer" vaddr="0x2_000_000" perms="rw" cached="false" setvar_vaddr="timer_base" />
<irq irq="69" id="0" trigger="edge" />
<irq irq="70" id="1" trigger="edge" />
</protection_domain>
</protection_domain>

<channel>
<end pd="uart" id="1"/>
<end pd="serial_virt_tx" id="0"/>
</channel>

<channel>
<end pd="serial_virt_tx" id="1"/>
<end pd="client0" id="0"/>
</channel>

<channel>
<end pd="serial_virt_tx" id="2"/>
<end pd="client1" id="0"/>
</channel>

<channel>
<end pd="serial_virt_tx" id="3"/>
<end pd="bench" id="0"/>
</channel>

<channel>
<end pd="eth" id="2" />
<end pd="net_virt_rx" id="0" />
</channel>

<channel>
<end pd="net_virt_rx" id="1" />
<end pd="copy0" id="0" />
</channel>

<channel>
<end pd="net_virt_rx" id="2" />
<end pd="copy1" id="0" />
</channel>

<channel>
<end pd="copy0" id="1" />
<end pd="client0" id="2" />
</channel>

<channel>
<end pd="copy1" id="1" />
<end pd="client1" id="2" />
</channel>

<channel>
<end pd="net_virt_tx" id="0" />
<end pd="eth" id="1" />
</channel>

<channel>
<end pd="net_virt_tx" id="1" />
<end pd="client0" id="3" />
</channel>

<channel>
<end pd="net_virt_tx" id="2" />
<end pd="client1" id="3" />
</channel>

<channel>
<end pd="client0" id="4" /> <!-- start channel -->
<end pd="bench" id="1" />
</channel>

<channel>
<end pd="client0" id="5" /> <!-- stop channel -->
<end pd="bench" id="2" />
</channel>

<channel>
<end pd="benchIdle" id="3" /> <!-- bench init channel -->
<end pd="bench" id="3" />
</channel>

<channel>
<end pd="timer" id="2" />
<end pd="client0" id="1" />
</channel>

<channel>
<end pd="timer" id="3" />
<end pd="client1" id="1" />
</channel>

</system>
Loading
Loading