From mirageos-devel-bounces@lists.xenproject.org Sun Feb 21 13:18:53 2021
Return-path: <mirageos-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Sun, 21 Feb 2021 13:18:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.87105.164699 (Exim 4.92)
	(envelope-from <mirageos-devel-bounces@lists.xenproject.org>)
	id 1lDodA-0004AK-VU; Sun, 21 Feb 2021 13:18:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 87105.164699; Sun, 21 Feb 2021 13:18:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <mirageos-devel-bounces@lists.xenproject.org>)
	id 1lDodA-0004AD-Ro; Sun, 21 Feb 2021 13:18:36 +0000
Received: by outflank-mailman (input) for mailman id 87105;
 Fri, 19 Feb 2021 21:57:48 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=qNjk=HV=cs.toronto.edu=chiu@srs-us1.protection.inumbo.net>)
 id 1lDDmW-0003pg-IG
 for mirageos-devel@lists.xenproject.org; Fri, 19 Feb 2021 21:57:48 +0000
Received: from aviary.cs.toronto.edu (unknown [128.100.3.90])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id fa3cbfa1-9180-4cdc-9140-04ca0229081d;
 Fri, 19 Feb 2021 21:57:47 +0000 (UTC)
Received: from 104.254.90.179.adsl.inet-telecom.org ([104.254.90.179]
 helo=kolmogorov.local)
 by aviary.cs.toronto.edu (as smtp.cs.toronto.edu) with esmtpsa
 (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1)
 (envelope-from <chiu@cs.toronto.edu>) id 1lDDmU-0006pe-Mz
 for mirageos-devel@lists.xenproject.org; Fri, 19 Feb 2021 16:57:46 -0500
X-BeenThere: mirageos-devel@lists.xenproject.org
List-Id: Developer list for MirageOS <mirageos-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/mirageos-devel>, 
 <mailto:mirageos-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:mirageos-devel@lists.xenproject.org>
List-Help: <mailto:mirageos-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/mirageos-devel>, 
 <mailto:mirageos-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: mirageos-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "MirageOS-devel" <mirageos-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: fa3cbfa1-9180-4cdc-9140-04ca0229081d
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=cs.toronto.edu; s=cs202005; h=Content-Transfer-Encoding:Content-Type:
	MIME-Version:Date:Message-ID:Subject:To:From:Sender:Reply-To:Cc:Content-ID:
	Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
	:Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
	List-Subscribe:List-Post:List-Owner:List-Archive;
	bh=Zl2PxkJNhPAFwZyupFbpZvmznamLVYK/4BVqoiksbeY=; b=LB/SlPdQf4NEory/hMuTzVtp59
	BXkrSEE2dTTsyzXVibUn2okK2B5WtQfONwsD0kIL/1QNBJiKMef8z07utkcUOr4WAsidkEIA9DmAV
	6f0ZzrUPf9ToKpV7lm/blTetp6OMwlKlNNOd8WMptaFaZeD+BIzbNW5uXHbbyFK4jXPzuVm/35eIM
	KyUyplOi+7hCTZmhd1SUAofeQ3+2zFx8PWPNZnTuSc/yFlHRGsSpqoB0VtGoVzEZTpNAqVzaCHEfw
	aya+i/o25P5nTKFO30JXPQ2ZrCNg4kyDa/PuxZJZmHWEQfclIBZ4oBleBqnJ73VtaE8KqtDNnV+hb
	rgWGLZig==;
From: Michael Chiu <chiu@cs.toronto.edu>
To: mirageos-devel@lists.xenproject.org
Subject: Beginner question about GPIO and mirage build process
Message-ID: <156fff2d-142a-b1c9-65d0-76ff312725ae@cs.toronto.edu>
Date: Fri, 19 Feb 2021 13:56:50 -0800
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:52.0)
 Gecko/20100101 PostboxApp/7.0.46
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Content-Language: en-US

Hi Everyone,

I was hoping to get some help / advice on two related issues.

1. I'm new to both OCaml and MirageOS and am trying to figure out how to 
access GPIO when targeting a unix backend. I've looked at all the 
tutorials and have a basic understanding of how mirage works, but 
couldn't find more in depth documentation on what's happening behind the 
scenes, or what the available configuration options are for. Does the 
unix backend have support for GPIO? Is there some documentation that I 
haven't found?  I'd appreciate some advice to better understanding mirageOS.

2. I'm not too familiar with the build system in both ocaml and 
mirageos, but I do know how to make a simple module package using dune. 
I'm trying to get a custom module working in mirage but it's unclear to 
tell the mirage toolchain about my custom module.

Any suggestions are appreciated, thanks in advance.

-- 
Michael.



From mirageos-devel-bounces@lists.xenproject.org Fri Feb 26 10:59:59 2021
Return-path: <mirageos-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Fri, 26 Feb 2021 10:59:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.90227.170756 (Exim 4.92)
	(envelope-from <mirageos-devel-bounces@lists.xenproject.org>)
	id 1lFaqU-0003tq-0o; Fri, 26 Feb 2021 10:59:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 90227.170756; Fri, 26 Feb 2021 10:59:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <mirageos-devel-bounces@lists.xenproject.org>)
	id 1lFaqT-0003tj-U2; Fri, 26 Feb 2021 10:59:41 +0000
Received: by outflank-mailman (input) for mailman id 90227;
 Fri, 26 Feb 2021 10:59:40 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=j2Js=H4=gmail.com=lists.nick.betteridge@srs-us1.protection.inumbo.net>)
 id 1lFaqR-0003rd-TP
 for mirageos-devel@lists.xenproject.org; Fri, 26 Feb 2021 10:59:39 +0000
Received: from mail-wr1-x430.google.com (unknown [2a00:1450:4864:20::430])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 54703bf2-e37a-4e32-9cff-ac2f66b1a6be;
 Fri, 26 Feb 2021 10:59:39 +0000 (UTC)
Received: by mail-wr1-x430.google.com with SMTP id v15so8166012wrx.4
 for <mirageos-devel@lists.xenproject.org>;
 Fri, 26 Feb 2021 02:59:39 -0800 (PST)
Received: from [10.0.0.155] (static-90-255-235-69.vodafonexdsl.co.uk.
 [90.255.235.69])
 by smtp.gmail.com with ESMTPSA id z11sm11445518wmf.28.2021.02.26.02.59.37
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Fri, 26 Feb 2021 02:59:37 -0800 (PST)
X-BeenThere: mirageos-devel@lists.xenproject.org
List-Id: Developer list for MirageOS <mirageos-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/mirageos-devel>, 
 <mailto:mirageos-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:mirageos-devel@lists.xenproject.org>
List-Help: <mailto:mirageos-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/mirageos-devel>, 
 <mailto:mirageos-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: mirageos-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "MirageOS-devel" <mirageos-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 54703bf2-e37a-4e32-9cff-ac2f66b1a6be
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=subject:to:references:cc:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-language:content-transfer-encoding;
        bh=KprdDFBMiH9dLV4X8CNFKEhWCo0eSTYLJ8Kkq9IZ8VI=;
        b=KSAdOrIsckk8QmyxlgyUeUHJ/6yoeEnORqx3LmxGIp+i56ugpncB8yAcgfEBJ8oLwb
         vruYlfAYYgEIgcFiUI1T1mx47ZDT4UJ1L8Yi+NCRJo0jQrJUFobptG+BWlN5KsaExHol
         Iumt+VCZoyZqJu8s+4jdve8hlONbKp2BqmGkmKcH9MQoiUplZUJBOn71RcjvJSyq3CVP
         XoyiKBpclnppIy9XyMWs27hDT60MzwzbLw9Ee6vF4A3LnDHogEtlSBAzFP3JB8Csf8BG
         MoqcAIbSanyVvneRjrdRR+JTqDvk/F1dzeVfZlz+c/UHdS1etS6+n/z0f4k0b4KVBOs2
         VIrQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:references:cc:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-language
         :content-transfer-encoding;
        bh=KprdDFBMiH9dLV4X8CNFKEhWCo0eSTYLJ8Kkq9IZ8VI=;
        b=r//dMvvtSatUS2llF34JOLClJ9e8LFUpaCrfMjTBneSXa2jneqn4VO9EHAhejsnKza
         8NB4aqh+iBGZnCovszoAHSFkqIMSfQ1zrpkKbscVX5x+TFogd6FjZnAVhsffaPDeiE3F
         QKixMXMfjF4Ufh0uX+dMwMXK5s0u7C8SKog5uh6myYQlbuH+46RYKHX9CFSdLjlpTDsA
         fknKXiJYpfmIH0pqzNqhUmQXIF393paOhSueHxXHg/iurHPp5ENG4C1x1AiBro8QM+SK
         0fxzFAzZE6G55HDj1J0h1t6QVcckbnG5+jL1+PcmfgTcl22jxkgE43Hb2aSXQxJ8a+hC
         bpcQ==
X-Gm-Message-State: AOAM531vS1CDNWPObL/09IbSeaj9sSdXcApCdLwXPzfCIUALucXtPoMN
	gHXRDP2yb8dSMUKlNY0RmYeQBJqh9AE=
X-Google-Smtp-Source: ABdhPJwDt+D8TIQzpiZ8WrN1g7NnVwo9m0McFwO9xyLNf99wf75VAUOQx93UbWKUPVkC3grsXwHfMg==
X-Received: by 2002:adf:ef4c:: with SMTP id c12mr2636886wrp.112.1614337178279;
        Fri, 26 Feb 2021 02:59:38 -0800 (PST)
Subject: Re: Beginner question about GPIO and mirage build process
To: Michael Chiu <chiu@cs.toronto.edu>
References: <156fff2d-142a-b1c9-65d0-76ff312725ae@cs.toronto.edu>
Cc: mirageos-devel@lists.xenproject.org
From: Nick Betteridge <lists.nick.betteridge@gmail.com>
Message-ID: <41b6ee58-5321-fcf9-b74c-138318d1e028@gmail.com>
Date: Fri, 26 Feb 2021 10:59:37 +0000
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.7.1
MIME-Version: 1.0
In-Reply-To: <156fff2d-142a-b1c9-65d0-76ff312725ae@cs.toronto.edu>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit

Hi Michael,

Please forgive this delayed response - I've been trying to think of an 
elegant and easy way of setting up a path between a gpio and unikernels.

There are no interfaces per-se dealing with direct io interaction. 
However, you could try writing a device interface for the backend using 
the block [1] or kv [2] signatures - the '-unix' give the unix 
implementations.

There are gpio bindings [3][4] which you could look at and there's also 
a good example of reading/wring to a gpio/memory in rpi-boot-ocaml [5]

Hope this helps and happy hacking!

Nick

[1] https://github.com/mirage/mirage-block/blob/master/src/mirage_block.mli
[2] https://github.com/mirage/mirage-kv/blob/master/src/mirage_kv.mli
[3] https://github.com/vbmithr/ocaml-gpio
[4] https://github.com/LaurentMazare/ocaml-rpi-gpio
[5] https://github.com/dbuenzli/rpi-boot-ocaml/blob/master/src/rpi.mli

On 19/02/2021 21:56, Michael Chiu wrote:
> Hi Everyone,
> 
> I was hoping to get some help / advice on two related issues.
> 
> 1. I'm new to both OCaml and MirageOS and am trying to figure out how to 
> access GPIO when targeting a unix backend. I've looked at all the 
> tutorials and have a basic understanding of how mirage works, but 
> couldn't find more in depth documentation on what's happening behind the 
> scenes, or what the available configuration options are for. Does the 
> unix backend have support for GPIO? Is there some documentation that I 
> haven't found?  I'd appreciate some advice to better understanding 
> mirageOS.
> 
> 2. I'm not too familiar with the build system in both ocaml and 
> mirageos, but I do know how to make a simple module package using dune. 
> I'm trying to get a custom module working in mirage but it's unclear to 
> tell the mirage toolchain about my custom module.
> 
> Any suggestions are appreciated, thanks in advance.
> 


