HSC2011/Software/EmbedVM: Unterschied zwischen den Versionen

aus Metalab, dem offenen Zentrum für meta-disziplinäre Magier und technisch-kreative Enthusiasten.
Wechseln zu: Navigation, Suche
K (hat „HSC2011/Software/VM“ nach „HSC2011/Software/embedVM“ verschoben)
(more on the python part)
 
(3 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt)
Zeile 15: Zeile 15:
 
|}
 
|}
  
 +
EmbedVm is a fully functional virtual machine that runs inside the ATMEL MCU. It can easily be ported
 +
to other CPU architectures as it is entirely written in C.
  
EmbedVm is a fully functional virtual machine that runs inside the ATMEL MCU series.
+
You can find its sources [http://svn.clifford.at/embedvm/trunk/ here] and the project website
 +
[http://www.clifford.at/embedvm/ here].
  
You can find [http://svn.clifford.at/embedvm/trunk/  its source here]
+
The VM itself takes ~3KB of program memory and consosts of ~300 lines of code.
 
+
The VM itself takes ~3KB of memory and consosts of ~300 lines of code.
+
  
 
There are two ways to write programs to run inside the virtual machine.
 
There are two ways to write programs to run inside the virtual machine.
  
You can either use a highlevel language thats a mixture between C and javascript with its own compiler or you can use python to write code.
+
There are two compilers that target EmbedVM: There is a compiler for a C-like high level language and there is a compiler that can transform python code to VM bytecode. The compiler for the C-like language is part of the EmbedVM sources. The python compiler can be found [http://github.com/chrysn/embedvm here].
 +
 
 +
=== Code for the EduBuzzer ===
 +
 
 +
The directory <tt>firmware/vmcode</tt> contains some code (<tt>firmware.vm</tt>) that is saved in the devices' flash memory as a standard library (e.g. the animation played while searching for a base station). The functions defined there can be used in custom code as well.
 +
 
 +
If a game wants to do something more sophisticated than turning a LED on or setting the buzzer to a fixed frequency, it can push additional code into the ATMega's RAM using the <tt>W</tt> command [[HSC2011/Communication/Serial protocol|described in the communication description]], and starting with the <tt>V</tt> command with an interrupt to the address of the main function.
 +
 
 +
Until further documentation is published, see the <tt>simon.py</tt> example program, which implements Simon's Game (the device beeps out a sequence of blinks, and the user has to enter it afterwards) in about 256 byte (of 512 currently allocated) of RAM.
  
 
[[Kategorie:Projekte]]
 
[[Kategorie:Projekte]]
 
[[Kategorie:HSC2011]]
 
[[Kategorie:HSC2011]]
 
[[Kategorie:English]]
 
[[Kategorie:English]]

Aktuelle Version vom 3. Mai 2011, 01:23 Uhr

< HSC2011


The virtual machine EmbedVM

2011-05-01: the virtual machine (EmbedVM) explained 1/2

2011-05-01: the virtual machine (EmbedVM) explained 2/2

EmbedVm is a fully functional virtual machine that runs inside the ATMEL MCU. It can easily be ported to other CPU architectures as it is entirely written in C.

You can find its sources here and the project website here.

The VM itself takes ~3KB of program memory and consosts of ~300 lines of code.

There are two ways to write programs to run inside the virtual machine.

There are two compilers that target EmbedVM: There is a compiler for a C-like high level language and there is a compiler that can transform python code to VM bytecode. The compiler for the C-like language is part of the EmbedVM sources. The python compiler can be found here.

Code for the EduBuzzer

The directory firmware/vmcode contains some code (firmware.vm) that is saved in the devices' flash memory as a standard library (e.g. the animation played while searching for a base station). The functions defined there can be used in custom code as well.

If a game wants to do something more sophisticated than turning a LED on or setting the buzzer to a fixed frequency, it can push additional code into the ATMega's RAM using the W command described in the communication description, and starting with the V command with an interrupt to the address of the main function.

Until further documentation is published, see the simon.py example program, which implements Simon's Game (the device beeps out a sequence of blinks, and the user has to enter it afterwards) in about 256 byte (of 512 currently allocated) of RAM.