Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
(Announce) "OCAPIC" : OCaml for PIC18 microcontrollers
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Philippe Wang  
View profile  
 More options Nov 4 2010, 5:44 pm
Newsgroups: fa.caml
From: Philippe Wang <philippe.w...@lip6.fr>
Date: Thu, 04 Nov 2010 21:44:44 UTC
Local: Thurs, Nov 4 2010 5:44 pm
Subject: [Caml-list] (Announce) "OCAPIC" : OCaml for PIC18 microcontrollers

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 :
http://www.algo-prog.info/ocaml_for_pic/

Cheers.

Beno�t Vaugon (developer and initiator of OCAPIC project)
Philippe Wang (supervisor)
Emmanuel Chailloux (supervisor)

P.S. si vous �tes francophone et nous contactez directement, merci de le faire en fran�ais

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daniel Bünzli  
View profile  
 More options Nov 5 2010, 8:35 am
Newsgroups: fa.caml
From: Daniel Bünzli <daniel.buen...@erratique.ch>
Date: Fri, 05 Nov 2010 12:35:48 UTC
Local: Fri, Nov 5 2010 8:35 am
Subject: Re: [Caml-list] (Announce) "OCAPIC" : OCaml for PIC18 microcontrollers
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

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Philippe Wang  
View profile  
 More options Nov 5 2010, 10:26 am
Newsgroups: fa.caml
From: Philippe Wang <philippe.w...@lip6.fr>
Date: Fri, 05 Nov 2010 14:26:18 UTC
Local: Fri, Nov 5 2010 10:26 am
Subject: Re: [Caml-list] (Announce) "OCAPIC" : OCaml for PIC18 microcontrollers
PIC ASM is the first "programming language" Benoît 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.

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 — which can interest many OCaml users — 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.

Cheers,

Philippe

On Nov 5, 2010, at 1:35 PM, Daniel Bünzli wrote:

> 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

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Goswin von Brederlow  
View profile  
 More options Nov 6 2010, 1:47 pm
Newsgroups: fa.caml
From: Goswin von Brederlow <goswin-...@web.de>
Date: Sat, 06 Nov 2010 17:47:20 UTC
Local: Sat, Nov 6 2010 1:47 pm
Subject: Re: [Caml-list] (Announce) "OCAPIC" : OCaml for PIC18 microcontrollers

Philippe Wang <philippe.w...@lip6.fr> 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

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Philippe Wang  
View profile  
 More options Nov 6 2010, 3:19 pm
Newsgroups: fa.caml
From: Philippe Wang <philippe.w...@lip6.fr>
Date: Sat, 06 Nov 2010 19:19:41 UTC
Local: Sat, Nov 6 2010 3:19 pm
Subject: Re: [Caml-list] (Announce) "OCAPIC" : OCaml for PIC18 microcontrollers

On Nov 6, 2010, at 18:47 GMT+01:00, Goswin von Brederlow wrote:

Thanks for the question. Let me try to give an (indirect) answer.

OCAPIC has 16-1=15bit 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 = 64kiB; volatile memory = 3968B ; EEPROM = 1KiB ; speed = 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).
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-rule...

Cheers,

--
Philippe Wang
  Philippe.W...@lip6.fr
  http://www-apr.lip6.fr/~pwang/

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "ocamlclean : an OCaml bytecode cleaner (Was: (Announce) "OCAPIC" : OCaml for PIC18 microcontrollers)" by Philippe Wang
Philippe Wang  
View profile  
 More options Nov 10 2010, 8:09 pm
Newsgroups: fa.caml
From: Philippe Wang <philippe.w...@lip6.fr>
Date: Thu, 11 Nov 2010 01:09:12 UTC
Local: Wed, Nov 10 2010 8:09 pm
Subject: [Caml-list] ocamlclean : an OCaml bytecode cleaner (Was: (Announce) "OCAPIC" : OCaml for PIC18 microcontrollers)
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:
Benoît Vaugon

--
Philippe Wang
 http://www-apr.lip6.fr/~pwang/

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Julien Signoles  
View profile  
 More options Nov 11 2010, 12:52 am
Newsgroups: fa.caml
From: Julien Signoles <julien.signo...@gmail.com>
Date: Thu, 11 Nov 2010 05:52:31 UTC
Local: Thurs, Nov 11 2010 12:52 am
Subject: Re: [Caml-list] ocamlclean : an OCaml bytecode cleaner (Was: (Announce) "OCAPIC" : OCaml for PIC18 microcontrollers)

Hello,

2010/11/11 Philippe Wang <philippe.w...@lip6.fr>

> 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

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Philippe Wang  
View profile  
 More options Nov 11 2010, 6:59 am
Newsgroups: fa.caml
From: Philippe Wang <philippe.w...@lip6.fr>
Date: Thu, 11 Nov 2010 11:59:30 UTC
Local: Thurs, Nov 11 2010 6:59 am
Subject: Re: [Caml-list] ocamlclean : an OCaml bytecode cleaner (Was: (Announce) "OCAPIC" : OCaml for PIC18 microcontrollers)
Hello,

ocamlclean removes code to which there is no possible path. For instance, this program :
  let plop = 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 = List.map succ [1;2;3];;
  let _ = 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

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »