From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 4B228BC57 for ; Thu, 4 Nov 2010 22:44:39 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuYAAMPF0kyE4zwemWdsb2JhbAChchUBAQEBAQgLCgcRIr4xhUYEgVqDNYVGgwiDVw X-IronPort-AV: E=Sophos;i="4.58,298,1286143200"; d="scan'208,217";a="86195316" Received: from osiris.lip6.fr ([132.227.60.30]) by mail1-smtp-roc.national.inria.fr with ESMTP; 04 Nov 2010 22:44:39 +0100 Received: from tibre.lip6.fr (tibre.lip6.fr [132.227.74.2]) by osiris.lip6.fr (8.14.4/lip6) with ESMTP id oA4LibGc018715 ; Thu, 4 Nov 2010 22:44:37 +0100 (CET) X-pt: osiris.lip6.fr Received: from [127.0.0.1] (postepwang [132.227.83.184]) by tibre.lip6.fr (8.14.4/8.13.3) with ESMTP id oA4Liakb008565; Thu, 4 Nov 2010 22:44:36 +0100 (MET) From: Philippe Wang Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: multipart/alternative; boundary=Apple-Mail-81--785252694 Subject: (Announce) "OCAPIC" : OCaml for PIC18 microcontrollers Date: Thu, 4 Nov 2010 22:44:36 +0100 References: <951AD91B-DA92-4F92-AE90-86A13DDB2357@lip6.fr> Cc: Philippe Wang To: caml-list@inria.fr Message-Id: X-Mailer: Apple Mail (2.1081) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.5 (osiris.lip6.fr [132.227.60.30]); Thu, 04 Nov 2010 22:44:37 +0100 (CET) X-Scanned-By: MIMEDefang 2.68 on 132.227.60.30 X-Spam: no; 0.00; ocaml:01 ocaml:01 model:01 ocamlc:01 bytecode:01 gcc:01 cheers:01 supervisor:01 chailloux:01 supervisor:01 model:01 ocamlc:01 bytecode:01 gcc:01 cheers:01 --Apple-Mail-81--785252694 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 Dear all, this is an announcement for "OCAPIC", a project which brings OCaml to = programming PIC micro-controllers. Some PIC18 series characteristics: - 8 bit architecture - low cost (a few US dollars), fairly spread in electronics world - very low volatile memory (a few bytes only, up to ~5000 bytes, = depending on the model) - very low non-volatile memory (less than a KB up to 128 KB) - EEPROM : 0 to 1024 bytes How to program those little chips with OCaml: - write an OCaml program, compile it, transfer it to the PIC. Well, actually it demands a little more than just that: - write an OCaml program, like usually, while keeping in mind that the = stack is more limited than usual, same for the heap - compile it (with ocamlc) - reduce the binary (with ocamlclean : a bytecode reducer which removes = dead-code) - transform the (reduced or not) binary (with bc2asm : take back not = useful zeros, thence reducing the binary size) - transfer it to the PIC along with its OCaml VM. Indeed, an OCaml VM has been implemented in PIC18 ASM in order to run = OCaml programs on a PIC ! :-) An example of real program is in the distribution (open source, = downloadable from the website): ocapic-1.3/src/tests/goblet/ (722 lines of ML code). We also provide a simulator in order to run on a PC (needs X11 = (Linux/MacOSX) and GCC) your programs written for PIC18. The whole implementation has been fairly well tested, however the = documentation is still quite young. Here is the website :=20 http://www.algo-prog.info/ocaml_for_pic/=20 Cheers. Beno=EEt Vaugon (developer and initiator of OCAPIC project) Philippe Wang (supervisor) Emmanuel Chailloux (supervisor) P.S. si vous =EAtes francophone et nous contactez directement, merci de = le faire en fran=E7ais --Apple-Mail-81--785252694 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=iso-8859-1
Some PIC18 series characteristics:
- 8 bit = architecture
- low cost (a few US dollars), fairly spread in = electronics world
- very low volatile memory (a few bytes only, up to = ~5000 bytes, depending on the model)
- very low non-volatile memory = (less than a KB up to 128 KB)
- EEPROM : 0 to 1024 bytes

How = to program those little chips with OCaml:
- write an OCaml = program, compile it, transfer it to the PIC.

Well, actually it = demands a little more than just that:
- write an OCaml program, like = usually, while keeping in mind that the stack is more limited than = usual, same for the heap
- compile it (with ocamlc)
- reduce the = binary (with ocamlclean : a bytecode reducer which removes = dead-code)
- transform the (reduced or not) binary (with bc2asm : = take back not useful zeros, thence reducing the binary size)
- = transfer it to the PIC along with its OCaml VM.

Indeed, an OCaml = VM has been implemented in PIC18 ASM in order to run OCaml programs on a = PIC ! :-)

An example of real program is in the distribution (open = source, downloadable from the website):
ocapic-1.3/src/tests/goblet/ = (722 lines of ML code).

We also provide a simulator in order to = run on a PC (needs X11 (Linux/MacOSX) and GCC) your programs written for = PIC18.

The whole implementation has been fairly well tested, = however the documentation is still quite young.

Here is the = website :
http://www.algo-prog.inf= o/ocaml_for_pic/

Cheers.

Beno=EEt Vaugon (developer = and initiator of OCAPIC project)
Philippe Wang = (supervisor)
Emmanuel Chailloux (supervisor)

P.S. si vous =EAtes= francophone et nous contactez directement, merci de le faire en = fran=E7ais

= --Apple-Mail-81--785252694-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 5B933BC57 for ; Fri, 5 Nov 2010 13:35:41 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoUBAEuX00zRVdg2kGdsb2JhbACDKZ4/CBUBAQEBCQkMBxEDH6FniSCCU4UfiQcBAQMFgR2DMnMEilWJIQ X-IronPort-AV: E=Sophos;i="4.58,301,1286143200"; d="scan'208";a="77983403" Received: from mail-qw0-f54.google.com ([209.85.216.54]) by mail2-smtp-roc.national.inria.fr with ESMTP; 05 Nov 2010 13:35:40 +0100 Received: by qwg8 with SMTP id 8so2254180qwg.27 for ; Fri, 05 Nov 2010 05:35:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=gXwa4kB22scW5vxvqGJdnUC5z91aDh3LTFtqyL7X3a4=; b=JOV/SGOOAPTKgP2BSHppOtXcoahYt3+SLDFTxsKmUyMU1GMRgeHLdl8/C1dg2WrpNR pVyxYaJF7EYifSFzSxKgyNTuRVdIZPFqD2wMiDoHzTnCDsyODU+90QY0dVU9bt+sN65j HQ96zBUh2ACMeCqXVBdkUaEAoyw7/HqfThmAU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=n8ek1AXdWt85vlojJDTjpbVQUseUBoPXUAlKYDyXc43gUjLXR5hFG4fhEGmhQ1Evh9 2IPl1UmMAmYbQhiTNqLaoZTeM1ENPMf+cQ+VMfpBWEGpN+GgFHDNGrw0ghPxs5kfdXyu RDLzFPrt8S8/hECpL1TCZvcfmDvwghXNUtuVw= MIME-Version: 1.0 Received: by 10.229.189.211 with SMTP id df19mr1938712qcb.146.1288960540448; Fri, 05 Nov 2010 05:35:40 -0700 (PDT) Sender: daniel.c.buenzli@gmail.com Received: by 10.229.64.137 with HTTP; Fri, 5 Nov 2010 05:35:40 -0700 (PDT) In-Reply-To: References: <951AD91B-DA92-4F92-AE90-86A13DDB2357@lip6.fr> Date: Fri, 5 Nov 2010 13:35:40 +0100 X-Google-Sender-Auth: aQRRD9m4i0KmrWLiiUURuwL-61Y Message-ID: Subject: Re: [Caml-list] (Announce) "OCAPIC" : OCaml for PIC18 microcontrollers From: =?UTF-8?Q?Daniel_B=C3=BCnzli?= To: Philippe Wang Cc: caml-list@inria.fr Content-Type: text/plain; charset=UTF-8 X-Spam: no; 0.00; ocaml:01 buenzli:01 caml-list:01 authors:03 daniel:04 daniel:04 interesting:12 announce:12 but:14 would:18 project:18 try:19 pic:78 pic:78 U6:76 Interesting project. Was the choice of PIC based on technical reasons or just familiarity of the authors with these chips ? I would have liked to give it a try but unfortunately I work AVRs and avr-gcc. Best, Daniel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 2BE6ABC57 for ; Fri, 5 Nov 2010 15:26:13 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhsBABKx00yE4zwemWdsb2JhbAChcRUBAQEBAQgLCgcRIrtVhUcEilU X-IronPort-AV: E=Sophos;i="4.58,303,1286143200"; d="scan'208";a="65106334" Received: from osiris.lip6.fr ([132.227.60.30]) by mail3-smtp-sop.national.inria.fr with ESMTP; 05 Nov 2010 15:26:12 +0100 Received: from tibre.lip6.fr (tibre.lip6.fr [132.227.74.2]) by osiris.lip6.fr (8.14.4/lip6) with ESMTP id oA5EQ7jQ002121 ; Fri, 5 Nov 2010 15:26:07 +0100 (CET) X-pt: osiris.lip6.fr Received: from postepwang.calsci.lip6.fr (postepwang [132.227.83.184]) by tibre.lip6.fr (8.14.4/8.13.3) with ESMTP id oA5EQ7ZH004336; Fri, 5 Nov 2010 15:26:07 +0100 (MET) Subject: Re: [Caml-list] (Announce) "OCAPIC" : OCaml for PIC18 microcontrollers Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=windows-1252 From: Philippe Wang In-Reply-To: Date: Fri, 5 Nov 2010 15:26:06 +0100 Cc: Philippe Wang , caml-list@inria.fr Content-Transfer-Encoding: quoted-printable Message-Id: References: <951AD91B-DA92-4F92-AE90-86A13DDB2357@lip6.fr> To: =?iso-8859-1?Q?Daniel_B=FCnzli?= X-Mailer: Apple Mail (2.1081) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.5 (osiris.lip6.fr [132.227.60.30]); Fri, 05 Nov 2010 15:26:07 +0100 (CET) X-Scanned-By: MIMEDefang 2.68 on 132.227.60.30 X-Spam: no; 0.00; ocaml:01 ocaml:01 bytecode:01 ocamlc:01 statically:01 dynlink:01 dynlink:01 bytecode:01 cheers:01 bunzli:01 wrote:01 binaries:01 ccs:01 caml-list:01 portability:02 PIC ASM is the first "programming language" Beno=EEt learnt, a few years = ago. He has practiced it ever since. But meanwhile he learnt OCaml (among other languages). A few months ago, = he suggested me to implement an OCaml virtual machine running on PICs, = with maximum performance efficiency in mind. This is why OCAPIC's VM is = implemented in ASM.=20 The purpose is of course to program PICs with a high level language = while remaining (relatively) *very* efficient. Vincent St-Amour and Marc Feeley have a similar project (Scheme on PICs) = which a much higher priority on portability: their VM is implemented in = C code. http://www.ccs.neu.edu/home/stamourv/picobit-ifl.pdf The "side effect" of our project =97 which can interest many OCaml users = =97 is that OCAPIC provides "ocamlclean", which is a tool that takes an = OCaml bytecode binary (produced by ocamlc) and reduces it by = (statically) eliminating most of its deadcode (and of course dynlink is = thence broken; note that dynlink is not relevant on PICs). This tool is = independent from the rest of OCAPIC. Actually, this tool was mandatory for programs using OO-layer : without = it, bytecode binaries embedding OO-layer were to big to fit on our PICs.=20= Cheers, Philippe On Nov 5, 2010, at 1:35 PM, Daniel B=FCnzli wrote: > Interesting project. Was the choice of PIC based on technical reasons > or just familiarity of the authors with these chips ? >=20 > I would have liked to give it a try but unfortunately I work AVRs and = avr-gcc. >=20 > Best, >=20 > Daniel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 35325BC57 for ; Sat, 6 Nov 2010 18:47:15 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao0GAH0x1UzZSMDjY2dsb2JhbACiCQsXCwgIEAUfvRmFSASNXw X-IronPort-AV: E=Sophos;i="4.58,308,1286143200"; d="scan'208";a="78057422" Received: from fmmailgate02.web.de ([217.72.192.227]) by mail2-smtp-roc.national.inria.fr with ESMTP; 06 Nov 2010 18:47:14 +0100 Received: from smtp01.web.de ( [172.20.0.243]) by fmmailgate02.web.de (Postfix) with ESMTP id 74DE217E6A0C2; Sat, 6 Nov 2010 18:47:14 +0100 (CET) Received: from [78.43.204.177] (helo=frosties.localdomain) by smtp01.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #24) id 1PEmrC-0002iL-00; Sat, 06 Nov 2010 18:47:14 +0100 Received: from mrvn by frosties.localdomain with local (Exim 4.72) (envelope-from ) id 1PEmrB-0006DD-Uz; Sat, 06 Nov 2010 18:47:14 +0100 From: Goswin von Brederlow To: Philippe Wang Cc: caml-list@inria.fr Subject: Re: [Caml-list] (Announce) "OCAPIC" : OCaml for PIC18 microcontrollers References: <951AD91B-DA92-4F92-AE90-86A13DDB2357@lip6.fr> Date: Sat, 06 Nov 2010 18:47:13 +0100 In-Reply-To: (Philippe Wang's message of "Thu, 4 Nov 2010 22:44:36 +0100") Message-ID: <87wroqpcny.fsf@frosties.localdomain> User-Agent: Gnus/5.110009 (No Gnus v0.9) XEmacs/21.4.22 (linux, no MULE) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: goswin-v-b@web.de X-Sender: goswin-v-b@web.de X-Provags-ID: V01U2FsdGVkX19l3j88emj6wEGTtYqvi92EBRy+2Hg1v5cw9MOL 9R0zzmPTxKx9GBnnaczHoVgc6ZpvflLL3s2czbueEASTeHvJN/ Py7Esd79A= X-Spam: no; 0.00; ocaml:01 ocaml:01 model:01 mfg:98 ints:01 caml-list:01 writes:01 structures:02 impractical:02 bytes:03 bytes:03 programming:03 overhead:04 electronics:92 memory:09 Philippe Wang writes: > Dear all, > > this is an announcement for "OCAPIC", a project which brings OCaml to > programming PIC micro-controllers. > > Some PIC18 series characteristics: > - 8 bit architecture > - low cost (a few US dollars), fairly spread in electronics world > - very low volatile memory (a few bytes only, up to ~5000 bytes, depending on > the model) > - very low non-volatile memory (less than a KB up to 128 KB) > - EEPROM : 0 to 1024 bytes Doesn't the overhead of boxed structures as well as loosing a bit on ints make that impractical given the extremly limited memory? MfG Goswin From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id BBA57BC57 for ; Sat, 6 Nov 2010 20:19:33 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AusAAHtH1UyE4zwemWdsb2JhbACiCBUBAQIBCAsKBxEivFGFSASKVYMK X-IronPort-AV: E=Sophos;i="4.58,308,1286143200"; d="scan'208";a="77373650" Received: from osiris.lip6.fr ([132.227.60.30]) by mail4-smtp-sop.national.inria.fr with ESMTP; 06 Nov 2010 20:19:21 +0100 Received: from tibre.lip6.fr (tibre.lip6.fr [132.227.74.2]) by osiris.lip6.fr (8.14.4/lip6) with ESMTP id oA6JJJsL018147 ; Sat, 6 Nov 2010 20:19:19 +0100 (CET) X-pt: osiris.lip6.fr Received: from [127.0.0.1] (postepwang [132.227.83.184]) by tibre.lip6.fr (8.14.4/8.13.3) with ESMTP id oA6JJIdU008731; Sat, 6 Nov 2010 20:19:19 +0100 (MET) Subject: Re: [Caml-list] (Announce) "OCAPIC" : OCaml for PIC18 microcontrollers Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii From: Philippe Wang In-Reply-To: <87wroqpcny.fsf@frosties.localdomain> Date: Sat, 6 Nov 2010 20:19:18 +0100 Cc: Philippe Wang , caml-list@inria.fr Content-Transfer-Encoding: quoted-printable Message-Id: <2728CE5E-1335-4D6B-983D-305E6E5DA344@lip6.fr> References: <951AD91B-DA92-4F92-AE90-86A13DDB2357@lip6.fr> <87wroqpcny.fsf@frosties.localdomain> To: Goswin von Brederlow X-Mailer: Apple Mail (2.1081) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.5 (osiris.lip6.fr [132.227.60.30]); Sat, 06 Nov 2010 20:19:19 +0100 (CET) X-Scanned-By: MIMEDefang 2.68 on 132.227.60.30 X-Spam: no; 0.00; ocaml:01 ocaml:01 model:01 integers:01 mips:01 high-level:01 low-level:01 experimented:01 cheers:01 mfg:98 4620:98 wrote:01 ints:01 caml-list:01 writes:01 On Nov 6, 2010, at 18:47 GMT+01:00, Goswin von Brederlow wrote: > Philippe Wang writes: >=20 >> Dear all, >>=20 >> this is an announcement for "OCAPIC", a project which brings OCaml to >> programming PIC micro-controllers. >>=20 >> Some PIC18 series characteristics: >> - 8 bit architecture >> - low cost (a few US dollars), fairly spread in electronics world >> - very low volatile memory (a few bytes only, up to ~5000 bytes, = depending on >> the model) >> - very low non-volatile memory (less than a KB up to 128 KB) >> - EEPROM : 0 to 1024 bytes >=20 > Doesn't the overhead of boxed structures as well as loosing a bit on > ints make that impractical given the extremly limited memory? >=20 > MfG > Goswin Thanks for the question. Let me try to give an (indirect) answer. OCAPIC has 16-1=3D15bit integers and 16bit blocks. And the overhead is = quite acceptable to us. A gobblet game [1] I.A. was implemented and tested. (The OCaml code is = included in the distribution so anyone can check it out.) The first version of this game was very hard to beat (for a human). Then = a strategy was found (to beat the I.A.). So some randomization was = supplied to the I.A. to make it more interesting. Now the I.A. has = become really very hard to beat. (We used a PIC18F4620: flash memory =3D 64kiB; volatile memory =3D 3968B = ; EEPROM =3D 1KiB ; speed =3D 10 MIPS) Between two moves, the I.A. may trigger the GC about ten times or more. = However, the time between two moves is less than 2 seconds, and = generally quite less than half a second (and in the beginning of the = game it's hard to realize the time it takes). Providing a GC to programming PIC microcontrollers is a tremendous gain = comparing to manually manage everything (memory and computing).=20 Providing a high-level language allows to implement algorithms that = would be very hard or impossible to implement in ASM (or most low-level = languages such as C or Basic). We haven't yet experimented real-time constrained programming (e.g., = ReactiveML might bring OCAPIC to a step further). Now, maybe the direct answer to the question can be : programming PICs has been impractical to most people, now all readers = of this list can potentially program them without much difficulties (and = without paying a too high cost on performance efficiency). :-) [1] = http://www.educationallearninggames.com/how-to-play-gobblet-game-rules.asp= Cheers, -- Philippe Wang Philippe.Wang@lip6.fr http://www-apr.lip6.fr/~pwang/ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 81470BBAF for ; Thu, 11 Nov 2010 02:09:06 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgcBAL/Q2kyE4zwemWdsb2JhbACUQ417FQEBAQEBCAsKBxEiwCCFSgSKV4MMg1g X-IronPort-AV: E=Sophos;i="4.59,180,1288566000"; d="scan'208";a="86747891" Received: from osiris.lip6.fr ([132.227.60.30]) by mail1-smtp-roc.national.inria.fr with ESMTP; 11 Nov 2010 02:09:06 +0100 Received: from tibre.lip6.fr (tibre.lip6.fr [132.227.74.2]) by osiris.lip6.fr (8.14.4/lip6) with ESMTP id oAB194TW012213 ; Thu, 11 Nov 2010 02:09:04 +0100 (CET) X-pt: osiris.lip6.fr Received: from [127.0.0.1] (postepwang [132.227.83.184]) by tibre.lip6.fr (8.14.4/8.13.3) with ESMTP id oAB193Eh029801; Thu, 11 Nov 2010 02:09:03 +0100 (MET) Subject: ocamlclean : an OCaml bytecode cleaner (Was: (Announce) "OCAPIC" : OCaml for PIC18 microcontrollers) Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=iso-8859-1 From: Philippe Wang In-Reply-To: <2728CE5E-1335-4D6B-983D-305E6E5DA344@lip6.fr> Date: Thu, 11 Nov 2010 02:09:03 +0100 Cc: Philippe Wang Content-Transfer-Encoding: quoted-printable Message-Id: <26FB93F3-065E-46C0-9767-0244B419626D@lip6.fr> References: <951AD91B-DA92-4F92-AE90-86A13DDB2357@lip6.fr> <87wroqpcny.fsf@frosties.localdomain> <2728CE5E-1335-4D6B-983D-305E6E5DA344@lip6.fr> To: caml-list@inria.fr X-Mailer: Apple Mail (2.1081) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.5 (osiris.lip6.fr [132.227.60.30]); Thu, 11 Nov 2010 02:09:04 +0100 (CET) X-Scanned-By: MIMEDefang 2.68 on 132.227.60.30 X-Spam: no; 0.00; ocaml:01 bytecode:01 ocaml:01 bytecode:01 ocamlc:01 compiler:01 statically:01 ocamlc:01 executables:01 supported:02 executable:03 generally:04 size:95 meant:06 standard:07 Dear all, Shortly: ocamlclean is now available in a separate package so that you don't have = to get the whole ocapic distribution just to try ocamlclean. More information: ocamlclean takes a bytecode executable (which are generally but not = necessarily produced by "ocamlc" compiler) and reduces its size by = eliminating some dead code. Dead code is discriminated statically. (It's = impossible to eliminate all dead code, but in some cases it can reduce = bytecode executables tremendously) It is meant to be compatible with = standard bytecode such as produced by ocamlc. (DBUG section is currently = not supported and is removed during the cleaning process. Other = unsupported sections are left untouched.) Web site: http://www.algo-prog.info/ocaml_for_pic/ Developer:=20 Beno=EEt Vaugon -- Philippe Wang http://www-apr.lip6.fr/~pwang/ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 7C9F6BBAF for ; Thu, 11 Nov 2010 06:52:24 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlcBAIsT20zRVdi2k2dsb2JhbACBcKBHCBUBAQEBCQkKCREDH6UfiWCCGIUfLohZAQEDBYVFBIpX X-IronPort-AV: E=Sophos;i="4.59,181,1288566000"; d="scan'208";a="78375853" Received: from mail-qy0-f182.google.com ([209.85.216.182]) by mail2-smtp-roc.national.inria.fr with ESMTP; 11 Nov 2010 06:52:24 +0100 Received: by qyk5 with SMTP id 5so397717qyk.6 for ; Wed, 10 Nov 2010 21:52:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=W+0BRUhmTjanJp9y/ZX2S7WTLNmi9Qv1baFa7hGf0wM=; b=qWwFy3YZ9alizO1ATv0Trqn28jt78deTWhFcAPwXsyKzQJ0sQXFEXKQV8U7whnOBu5 OoE6KiA+Qj0kgoUvtXoq3ztc3oAA31a4p8G823+TnDza0Fx7GUJyiuF6ih2A27nVgAA2 qyUmNokCJeltpFz1WtqIg3lafbc+T8OFTZObQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=xowpOppotZwx1kqds6319nwbnsVPHxFxDeBNaPZBcEP+PLsWlCLvNyT4vV3gbTLcBs Lq53F0mYq4EIYAB7sZPRWSwHMWmmpMLo9DrygfdsSj2JgcGTVzPUiBDFG2RKPV6N/y9s 29BK/YetXAt9aQ0jYpmKPfmyXr66j35y/lOWM= MIME-Version: 1.0 Received: by 10.229.97.11 with SMTP id j11mr433073qcn.113.1289454743077; Wed, 10 Nov 2010 21:52:23 -0800 (PST) Received: by 10.229.41.195 with HTTP; Wed, 10 Nov 2010 21:52:23 -0800 (PST) In-Reply-To: <26FB93F3-065E-46C0-9767-0244B419626D@lip6.fr> References: <951AD91B-DA92-4F92-AE90-86A13DDB2357@lip6.fr> <87wroqpcny.fsf@frosties.localdomain> <2728CE5E-1335-4D6B-983D-305E6E5DA344@lip6.fr> <26FB93F3-065E-46C0-9767-0244B419626D@lip6.fr> Date: Thu, 11 Nov 2010 06:52:23 +0100 Message-ID: Subject: Re: [Caml-list] ocamlclean : an OCaml bytecode cleaner (Was: (Announce) "OCAPIC" : OCaml for PIC18 microcontrollers) From: Julien Signoles To: Philippe Wang Cc: caml-list@inria.fr Content-Type: multipart/alternative; boundary=0016364ee1b4ea43190494c093f2 X-Spam: no; 0.00; ocaml:01 bytecode:01 ocaml:01 signoles:01 signoles:01 bytecode:01 ocamlc:01 compiler:01 statically:01 ocamlc:01 compiler:01 statically:01 z-index:98 margin-top:98 line-height:98 --0016364ee1b4ea43190494c093f2 Content-Type: text/plain; charset=ISO-8859-1 Hello, 2010/11/11 Philippe Wang > Shortly: > ocamlclean is now available in a separate package so that you don't have to > get the whole ocapic distribution just to try ocamlclean. > > More information: > ocamlclean takes a bytecode executable (which are generally but not > necessarily produced by "ocamlc" compiler) and reduces its size by > eliminating some dead code. Dead code is discriminated statically. (It's > impossible to eliminate all dead code, but in some cases it can reduce > bytecode executables tremendously) It is meant to be compatible with > standard bytecode such as produced by ocamlc. (DBUG section is currently not > supported and is removed during the cleaning process. Other unsupported > sections are left untouched.) > Is ocamlclean compatible with dynamic loading? That is code potentially used by some unknown dynamically-loaded code must be kept. -- Julien --0016364ee1b4ea43190494c093f2 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hello,

2010/11/11 Philippe Wang <philippe.wang@lip6.fr= >
--0016364ee1b4ea43190494c093f2-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id AE9CEBBAF for ; Thu, 11 Nov 2010 12:57:57 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AloEAFNp20yE4zwegWdsb2JhbACiQRUBARYiIsA2hUoEiliDCw X-IronPort-AV: E=Sophos;i="4.59,182,1288566000"; d="scan'208";a="86775832" Received: from osiris.lip6.fr ([132.227.60.30]) by mail1-smtp-roc.national.inria.fr with ESMTP; 11 Nov 2010 12:57:57 +0100 Received: from tibre.lip6.fr (tibre.lip6.fr [132.227.74.2]) by osiris.lip6.fr (8.14.4/lip6) with ESMTP id oABBvukE008978 ; Thu, 11 Nov 2010 12:57:56 +0100 (CET) X-pt: osiris.lip6.fr Received: from [127.0.0.1] (postepwang [132.227.83.184]) by tibre.lip6.fr (8.14.4/8.13.3) with ESMTP id oABBvsZs028427; Thu, 11 Nov 2010 12:57:54 +0100 (MET) Subject: Re: [Caml-list] ocamlclean : an OCaml bytecode cleaner (Was: (Announce) "OCAPIC" : OCaml for PIC18 microcontrollers) Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii From: Philippe Wang In-Reply-To: Date: Thu, 11 Nov 2010 12:57:54 +0100 Cc: Philippe Wang , caml-list@inria.fr Content-Transfer-Encoding: quoted-printable Message-Id: <283988DF-2604-4407-A6DB-4F2BA6F0FF62@lip6.fr> References: <951AD91B-DA92-4F92-AE90-86A13DDB2357@lip6.fr> <87wroqpcny.fsf@frosties.localdomain> <2728CE5E-1335-4D6B-983D-305E6E5DA344@lip6.fr> <26FB93F3-065E-46C0-9767-0244B419626D@lip6.fr> To: Julien Signoles X-Mailer: Apple Mail (2.1081) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.5 (osiris.lip6.fr [132.227.60.30]); Thu, 11 Nov 2010 12:57:56 +0100 (CET) X-Scanned-By: MIMEDefang 2.68 on 132.227.60.30 X-Spam: no; 0.00; ocaml:01 bytecode:01 ocaml:01 pervasives:01 pervasives:01 iter:01 endline:01 bytecode:01 dynlink:01 cmo:01 cmo:01 compile-time:01 stdlib:01 statically:01 dynlink:01 Hello, ocamlclean removes code to which there is no possible path. For = instance, this program : let plop =3D List.map succ [1;2;3];; uses module List (for map) and module Pervasives (for succ) but doesn't = use a lot of functions of List or Pervasives (e.g., List.iter, = List.fold_left, Pervasives.print_endline). So most functions of modules = Pervasives and List are removed from the bytecode executable. If one dynamically loads some bytecode, for instance the previous = program becomes let plop =3D List.map succ [1;2;3];; let _ =3D Dynlink.load "stuff.cmo";; then stuff.cmo should not reference anything that may not exist, such as = Pervasives.(@) since it has been removed by ocamlclean. And we are not = supposed to know at compile-time what stuff.cmo needs from stdlib. Hence = I guess everything should be kept and ocamlclean not used. On the other hand, if we statically know what is in stuff.cmo, then why = load it dynamically? (I guess the answer can be "just for fun" but I'm = not so sure it's such a good answer :-) Though, I'm not very familiar with Dynlink, and I'm not sure what = "Dynlink.allow_only" really does... I haven't tested using dynlink to load a self-sufficient module. I might = work, but I don't really see how it can be usefull anyway... Cheers, Philippe Wang On Nov 11, 2010, at 06:52 AM, Julien Signoles wrote: > Hello, > Is ocamlclean compatible with dynamic loading? That is code = potentially used by some unknown dynamically-loaded code must be kept. > -- > Julien