I think I have something working now. Here's the steps I took.

1. Create a pipe file in Linux: "mkfifo uart2"

2. In my Client.camkes file I have:


component Client {
    control;
    uses Simple a;

    // Hardware interface
    dataport Buf           vaddr;
    consumes DataAvailable interrupt;
    has semaphore          read_sem;
}

component Uartbase {
    hardware;
    dataport Buf           mem;
    emits DataAvailable    irq;
}

assembly {
    composition {
        // "component Client client" will be defined by the outer camkes file
        component Uartbase uartbase;

        // UART hardware connection
        connection seL4HardwareMMIO uartbase_mem(from client.vaddr, to
uartbase.mem);
        connection seL4HardwareInterrupt uartbase_irq(from
uartbase.irq, to client.interrupt);
    }

    configuration {
        // From libplatsupport/plat_include/imx31/platsupport/plat/serial.h
        uartbase.mem_attributes = "0x43F94000:0x1000";
        uartbase.irq_attributes = 32;
    }
}


3. In client.c I have:


#include <camkes.h>
#include <stdio.h>
#include <stdlib.h>

#define UART_RX           0x00
#define UART_STAT1        0x94

#define UART_STAT1_RRDY   BIT(9)

#define REG_PTR(base, offset)  ((volatile uint32_t *)((char*)(base) + (offset)))

int run() {
    while (1) {
        if (*REG_PTR(vaddr, UART_STAT1) & UART_STAT1_RRDY) {
            char c = (char) *REG_PTR(vaddr, UART_RX);
            printf("Read: %c (%02x)\n", c, c);
        }
    }
    return 0;
}


4. Compile


5. Attach pipe to second serial port of qemu: "qemu-system-arm -M kzm
-nographic -kernel images/capdl-loader-experimental-image-arm-imx31
-monitor none -serial stdio -serial pipe:uart2"


-Andrew

On Wed, Nov 16, 2016 at 9:56 PM, Andrew Gacek <[email protected]> wrote:
> What I'm really wondering is how do I read this information on the
> seL4 side? Are there qemu serial/uart/network drivers available for
> seL4?
>
> I suppose the easiest thing would be if I could open a serial
> connection that I can write to on the host Linux side and somehow read
> from a corresponding serial driver on the seL4 guest side. I've
> started looking through the qemu documentation, but it's been slow
> going. And I think the seL4 side will be the harder part for me to
> figure out.
>
> -Andrew
>
> On Wed, Nov 16, 2016 at 9:40 PM, Tim Newsham <[email protected]> wrote:
>> If by "send information into QEMU" you mean generate packets
>> destined to the VM guest, then yes.  Qemu has various options
>> for configuring the network interface. One option is to hook it up
>> to your host's tunnel interface.  If you do this, you can send
>> packets directly from your host to your guest over the tunnel interface.
>>
>>
>> On Wed, Nov 16, 2016 at 4:59 PM, Andrew Gacek <[email protected]>
>> wrote:
>>>
>>> Hi,
>>>
>>> We are developing an seL4 application that will process UDP packets
>>> coming in over a network connection. Eventually, we'll be running this
>>> on real hardware with real drivers, but for now we are using QEMU. We
>>> have a python script that can generate packet payloads. Is there a way
>>> to send this information into QEMU so that we can develop our seL4
>>> application without having the drivers and hardware in place? If it
>>> matters, we are using CAmkES as well.
>>>
>>> Thanks,
>>> Andrew
>>>
>>> _______________________________________________
>>> Devel mailing list
>>> [email protected]
>>> https://sel4.systems/lists/listinfo/devel
>>
>>
>>
>>
>> --
>> Tim Newsham | www.thenewsh.com/~newsham | @newshtwit | thenewsh.blogspot.com

_______________________________________________
Devel mailing list
[email protected]
https://sel4.systems/lists/listinfo/devel

Reply via email to