1
0
mirror of https://github.com/elua/elua.git synced 2025-01-25 01:02:54 +08:00

i386 toolchain build tutorial edited to include John Hind fix

SConstruct edited just to leave group/files definitions close to the platform/groups.
Doc content files mirroed to pt, to ease the portuguese version initial migration
This commit is contained in:
Dado Sutter 2009-02-21 23:02:39 +00:00
parent 0e585aee37
commit 80513aaf52
39 changed files with 4956 additions and 19 deletions

View File

@ -6,23 +6,6 @@ boardname = ARGUMENTS.get( 'board' , '').upper()
cprefix = ARGUMENTS.get( 'cprefix', '')
optram = int( ARGUMENTS.get( 'optram', '1' ) )
# ROMFS file list
romfs = { 'bisect' : [ 'bisect.lua' ],
'hangman' : [ 'hangman.lua' ],
'lhttpd' : [ 'index.pht', 'lhttpd.lua', 'test.lua' ],
'pong' : [ 'pong.lua', 'LM3S.lua' ],
'led' : [ 'led.lua' ],
'piano' : [ 'piano.lua' ],
'pwmled' : [ 'pwmled.lua' ],
'tvbgone' : [ 'tvbgone.lua', 'codes.bin' ],
'hello' : [ 'hello.lua' ],
'info' : [ 'info.lua' ],
'morse' : [ 'morse.lua' ],
'dualpwm' : [ 'dualpwm.lua' ],
'adcscope' : [ 'adcscope.lua' ],
'life' : [ 'life.lua' ]
}
# List of platform/CPU combinations
cpu_list = { 'at91sam7x' : [ 'AT91SAM7X256', 'AT91SAM7X512' ],
'lm3s' : [ 'LM3S8962', 'LM3S6965' ],
@ -46,6 +29,25 @@ board_list = { 'SAM7-EX256' : [ 'AT91SAM7X256', 'AT91SAM7X512' ],
'ATEVK1100' : [ 'AT32UC3A0512' ]
}
# ROMFS file list "groups"
# To include a file in a ROMFS build, include it in a group here and make
# sure the group is listed on your platform "groups list" right below.
romfs = { 'bisect' : [ 'bisect.lua' ],
'hangman' : [ 'hangman.lua' ],
'lhttpd' : [ 'index.pht', 'lhttpd.lua', 'test.lua' ],
'pong' : [ 'pong.lua', 'LM3S.lua' ],
'led' : [ 'led.lua' ],
'piano' : [ 'piano.lua' ],
'pwmled' : [ 'pwmled.lua' ],
'tvbgone' : [ 'tvbgone.lua', 'codes.bin' ],
'hello' : [ 'hello.lua' ],
'info' : [ 'info.lua' ],
'morse' : [ 'morse.lua' ],
'dualpwm' : [ 'dualpwm.lua' ],
'adcscope' : [ 'adcscope.lua' ],
'life' : [ 'life.lua' ]
}
# List of board/romfs data combinations
file_list = { 'SAM7-EX256' : [ 'bisect', 'hangman' , 'led', 'piano', 'hello', 'info', 'morse' ],
'EK-LM3S8962' : [ 'bisect', 'hangman', 'lhttpd', 'pong', 'led', 'piano', 'pwmled', 'tvbgone', 'hello', 'info', 'morse', 'adcscope' ],

View File

@ -228,7 +228,7 @@ to allow the linker to perform dead code stripping:</p>
<tr align="left">
<th>$ make
CFLAGS_FOR_TARGET="-ffunction-sections
-fdata-sections-DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -Os
-fdata-sections -D__PREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -Os
-fomit-frame-pointer -D__BUFSIZ__=256"</th>
</tr>
<tr align="left">
@ -240,7 +240,7 @@ CFLAGS_FOR_TARGET="-ffunction-sections
<p>Some notes about the flags used in the above sequence:</p>
<ul><li><code>--disable-newlib-supplied-syscalls:</code> this deserves a page of its own, but I won't cover it here. For an explanation, see for example <a href="http://openhardware.net/Embedded_ARM/NewLib_Stubs/">this page</a>.</li><li><code>-DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__:</code> compile Newlib for size, not for speed (these are Newlib specific).</li><li><code>-Os -fomit-frame-pointer:</code> tell GCC to optimize for size, not for speed.</li><li><code>-D__BUFSIZ__=256:</code>
<ul><li><code>--disable-newlib-supplied-syscalls:</code> this deserves a page of its own, but I won't cover it here. For an explanation, see for example <a href="http://openhardware.net/Embedded_ARM/NewLib_Stubs/">this page</a>.</li><li><code>-D__PREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__:</code> compile Newlib for size, not for speed (these are Newlib specific).</li><li><code>-Os -fomit-frame-pointer:</code> tell GCC to optimize for size, not for speed.</li><li><code>-D__BUFSIZ__=256:</code>
again Newlib specific, this is the buffer size allocated by default for
files opened via fopen(). The default is 1024, which I find too much
for an eLua, so I'm using 256 here. Of course, you can change this

132
doc/pt/bit_ref.html Normal file
View File

@ -0,0 +1,132 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body style="background-color: rgb(255, 255, 255);">
<h3><a name="over"></a>bit</h3>
<p class="MsoNormal" style="font-family: Verdana;"><a name="bnot"></a>Res = bit.bnot( value ): unary
negation
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="band"></a> Res = bit.band( v1, v2, ... ): <b>bitwise
</b>"and"
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="bor"></a> Res = bit.bor( v1, v2, ... ):&nbsp;<b>bitwise</b><b>
</b>"or"
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="bxor"></a> Res = bit.bxor( v1, v2, ... ): <b>bitwise</b><b>
</b>"exclusive or"
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="lshift"></a> Res = bit.lshift( value, pos ):
shift "value" left "pos" positions.
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="rshift"></a> Res = bit.rshift( value, pos ):
shift "value" right "pos" positions. The sign is
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp; not propagated.
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="arshift"></a> Res = bit.arshift( value, pos ):
shift "value" right "pos" positions. The sign
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp; is propagated ("arithmetic shift").
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="bit"></a> Res = bit.bit( bitno ): a shortcut for
bit.lshift( 1, bitno )
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="set"></a> Res1, Res2, ... = bit.set( bitno, v1,
v2, ... ): set the bit at position "bitno"
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp; in v1, v2, ... to 1.
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="clear"></a> Res1, Res2, ... = bit.clear( bitno,
v1, v2, ... ): set the bit at position
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp; "bitno"in v1, v2, ... to 0.
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="isset"></a> Res = bit.isset( value, bitno ):
returns true if bit at position "bitno" in
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp; "value" is 1, false otherwise.
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="isclear"></a> Res = bit.isclear( value, bitno ):
returns true if bit at position "bitno" in
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp; "value" is 0, false otherwise.
</p>
<br style="font-family: Verdana;">
<br style="font-family: Verdana;">
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</body></html>

114
doc/pt/building.html Normal file
View File

@ -0,0 +1,114 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css"></head>
<body style="background-color: rgb(255, 255, 255);">
<h3>Building eLua</h3>
Up to date documentation of how to build eLua is always included in the <a href="http://www.eluaproject.net/?p=Downloads">eLua distributions</a>, in the docs directory).<br><p>For your convenience, the building instructions are also provided on this page.</p>
<h2>Prerequisites</h2>
<p>Before you start, you might want to check if the list of platform modules and
eLua components are set according to your needs. See platform_modules
and elua_components in the distro doc for details. </p>
<h2>Building eLua</h2>
<p>To build <strong>eLua</strong> you'll need:</p>
<ul><li><p>a GCC/Newlib toolchain for your target. Please note that even if
you already have a compiled toolchain, the differences in the Newlib configure
flags (mainly the --disable-newlib-supplied-syscalls flags) might prevent
eLua for building properly on your machine.</p></li><li><p>Linux. Compiling under windows should be possible, however this isn't tested.
I'm using Ubuntu, so I'm also using "apt-get". If you're using a distro with a
different package manager you'll need to translate the "apt-get" calls to your
specific distribution.</p></li><li><p>python. It should be already installed; if it's not:</p>
<p>$ sudo apt-get install python</p></li><li><p>scons. eLua uses scons instead of make and makefiles, because I find scons
much more "natural" and easier to use than make. To install it:</p>
<p>$ sudo apt-get install scons</p></li><li><p>your toolchain's "bin" directory (this is generally something like
/usr/local/cross-arm/bin, where /usr/local/cross-arm is the directory in which
you installed your toolchain) must be in $PATH. </p></li><li><p>if you're building for the i386 platform, you'll also need "nasm":</p>
<p>$ sudo apt-get install nasm</p></li></ul>
<p>For each platform, eLua assumes a certain name for the compiler/linker/assembler
executable files, as shown below.</p>
<pre><code>================================================================================<br>| Tool | Compiler | Linker | Assembler | <br>|------------|---------------------|----------------------|--------------------| <br>| Platform | | | |<br>|============|=====================|======================|====================|<br>| ARM (all) | arm-elf-gcc | arm-elf-gcc | arm-elf-gcc |<br>|============|=====================|======================|====================|<br>| i386 | i686-elf-gcc | i686-elf-gcc | nasm |<br>|============|=====================|======================|====================|<br>| Cortex-M3 | arm-elf-gcc | arm-elf-gcc | arm-elf-gcc |<br>|============|=====================|======================|====================|<br></code></pre>
<p>If your toolchain uses different names, you have to modify the "conf.py" file
from src/platform/[your platform].</p>
<p>To build, go to the directory where you unpacked your eLua distribution and
invoke scons:</p>
<pre><code>$ scons [target=lua | lualong] <br> [cpu=at91sam7x256 | at91sam7x512 | i386 | str912fw44 | lm3s8962 | <br> lm3s6965 | lpc2888 | str711fr2 ]<br> [board=ek-lm3s8962 | ek-lm3s6965 | str9-comstick | sam7-ex256 | lpc-h2888 | <br> | mod711 | pc]<br> [cpumode=arm | thumb] <br> [allocator = newlib | multiple]<br> [prog]<br></code></pre>
<p>Your build target is specified by two paramters: cpu and board. "cpu" gives the
name of your CPU, and "board" the name of the board. A board can be associated
with more than one CPU. This allows the build system to be very flexible. You
can use these two options together or separately, as shown below:</p>
<ul><li>cpu=name: build for the specified CPU. A board name will be assigned by the
build system automatically.</li><li>board=name: build for the specified board. The CPU name will be inferred by
the build system automatically.</li><li>cpu=name board=name: build for the specified board and CPU.</li></ul>
<p>For board/CPU assignment look at the beginning of the SConstruct file from the
base directory, it's self-explanatory.</p>
<p>The other options are as follows:</p>
<ul><li>target=lua | lualong: specify if you want to build full Lua (with floating
point support) or integer only Lua (lualong). The default is "lua".</li><li>cpumode=arm | thumb: for ARM target (not Cortex) this specifies the
compilation mode. Its default value is 'thumb' for AT91SAM7X targets and
'arm' for STR9 and LPC2888 targets.</li><li>allocator = newlib | multiple: choose between the default newlib allocator
(newlib) and the multiple memory spaces allocator (multiple). You should
use the 'multiple' allocator only if you need to support multiple memory
spaces, as it's larger that the default Newlib allocator (newlib). For more
information about this reffer to platform_interface. The default value
is 'newlib' for all CPUs except 'lpc2888', since my lpc-h2888 comes with
external SDRAM memory and thus it's an ideal target for 'multiple'.</li><li>prog: by default, the above 'scons' command will build only the 'elf' file.
Specify "prog" to build also the platform-specific programming file where
appropriate (for example, on a AT91SAM7X256 this results in a .bin file that
can be programmed in the CPU). </li></ul>
<p>The output will be a file named elua<em>[target]</em>[cpu].elf (and also another
file with the same name but ending in .bin if "prog" was specified for platforms
that need .bin files for programming).
If you want the equivalent of a "make clean", invoke "scons" as shown above,
but add a "-c" at the end of the command line. "scons -c" is also recommended
after you change the list of modules/components to build for your target (see
section "prerequisites" of this document), as scons seems to "overlook" the
changes to these files on some occasions.</p>
<p>A few examples:</p>
<p>Clear previously built intermediate files.</p>
<pre><code>$ scons cpu=at91sam7x256 -c <br></code></pre>
<p>Build eLua for the AT91SAM7X256 CPU. The board name is detected as sam7-ex256.</p>
<pre><code>$ scons cpu=at91sam7x256<br></code></pre>
<p>Build eLua for the SAM7-EX256 board. The CPU is detected as AT91SAM7X256.</p>
<pre><code>$ scons board=sam7-ex256<br></code></pre>
<p>Build eLua for the SAM7-EX256 board, but "overwrite" the default CPU. This is
useful when you'd like to see how the specified board would behave with a
different CPU (in the case of the SAM7-EX256 board it's possible to switch the
on-board AT91SAM7X256 CPU for an AT91SAM7X512 which has the same pinout but
comes with more Flash/RAM memory).</p>
<pre><code>$ scons board=sam7-ex256 cpu=at91sam7x512<br></code></pre>
<p>Build eLua for the lpc2888 CPU. The board name is detected as LPC-H2888. Also,
the bin file required for target programming is generated.</p>
<pre><code>$ scons cpu=lpc2888 prog </code></pre><br><br></body></html>

27
doc/pt/comunity.html Normal file
View File

@ -0,0 +1,27 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css"></head>
<body style="background-color: rgb(255, 255, 255);">
<a name="lists"></a><h3>Collaborative Mail
Lists</h3>
<p><strong></strong></p><p style="text-align: left;"><strong>eLua</strong> currently has a single<strong> Developper's
</strong>and<strong> User's Discussion Mail List</strong>.<br>You are very welcome
to join it at&nbsp;<a target="_top" href="https://lists.berlios.de/mailman/listinfo/elua-dev">https://lists.berlios.de/mailman/listinfo/elua-dev</a></p><p style="text-align: left;"></p><p style="text-align: left;">Our devellopment repository is currently maintained in a
Subversion Server.<br>If you are interested in following daily commitments to the Bleeding
Edge trunk development, you can also subscribe to our <strong>SVN
Activity List</strong> at&nbsp;<a target="_top" href="https://lists.berlios.de/mailman/listinfo/elua-svn">https://lists.berlios.de/mailman/listinfo/elua-svn</a></p><p></p><p><a href="https://lists.berlios.de/mailman/listinfo/elua-svn"></a></p>
<span style="font-style: italic;"><a name="credits"></a></span><h3>Credits</h3>
<div class="content">
<p>The authors of <strong>eLua</strong> would like
to thank the colaborative&nbsp;help from the comunity for the
continuous development of the project. Here's an alphabetical
ordered&nbsp;non-exhaustive list of contributors:</p>
<strong style="font-weight: normal;"></strong>Alberto Fabiano, Andr<64> Carregal,&nbsp;<strong style="font-weight: normal;">Cosmin Filip</strong>, Diego Sueiro, <strong style="font-weight: normal;">Everson Denis</strong>, Fabio Pereira, <strong style="font-weight: normal;">Fernando Ara<72>jo, </strong><strong style="font-weight: normal;">Fr<EFBFBD>d<EFBFBD>ric Thomas</strong>, <strong style="font-weight: normal;">Ives Cunha, </strong><strong style="font-weight: normal;">James Snyder</strong>, Marcelo T<>lio, Marco
Meggiolaro, <strong style="font-weight: normal;">Mike Panetta</strong>, <strong style="font-weight: normal;">Pedro Bittencourt,</strong><strong style="font-weight: normal;">&nbsp;Rafael Barmak,</strong><strong style="font-weight: normal;"> </strong>Rafael Sabbagh, Ralph Hempel, Raul Nunes, <strong style="font-weight: normal;">Ricardo&nbsp;Rosa</strong>, <strong style="font-weight: normal;">Roberto Ierusalimschy</strong>, <strong style="font-weight: normal;">T<EFBFBD>o Benjamin, </strong><strong style="font-weight: normal;">Yuri Takhteyev</strong>,&nbsp;<strong style="font-weight: normal;"></strong>...<br><br>... and the whole comunity of our Users &amp; Development List at <a href="https://lists.berlios.de/mailman/listinfo/elua-dev">https://lists.berlios.de/mailman/listinfo/elua-dev</a><strong style="font-weight: normal;"></strong></div>
<br><br>
<a name="galery"></a><a name="projects"></a>
</body></html>

184
doc/pt/cpu_ref.html Normal file
View File

@ -0,0 +1,184 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body style="background-color: rgb(255, 255, 255);">
<h3><a name="over"></a>cpu</h3>
<p class="MsoNormal" style="font-family: Verdana;"><br>
</p>
<p style="margin-bottom: 0in;"></p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="write32"></a>write32( address, data ) : write
the 32-bit data at the specified address</font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="write16"></a>write16( address, data ) : write
the 16-bit data at the specified address</font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="write8"></a>write8( address, data ) : write the
8-bit data at the specified address</font> <br>
</p>
<p style="margin-bottom: 0in;"><br>
</p>
<br>
<font face="Bitstream Vera Sans Mono, sans-serif"><a name="read32"></a>Data =&nbsp;read32( address ) :
reads 32-bit data from the specified address</font>
<p style="margin-bottom: 0in;"></p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="read16"></a>Data = read16( address ) : reads
16-bit data from the specified address</font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="read8"></a>Data = read8( address ) : reads 8-bit
data from the specified address</font></p>
<p style="margin-bottom: 0in;"><br>
</p>
<br>
<p style="margin-bottom: 0in;"><a name="disableinterrupts"></a>
[cpu.disableinterrupts()]&nbsp;&nbsp; <font face="Bitstream Vera Sans Mono, sans-serif">cli(): disable
CPU interrupts</font>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"><a name="enableinterrupts"></a>
[cpu.enableinterrupts()]&nbsp;&nbsp; <font face="Bitstream Vera Sans Mono, sans-serif">sei(): enable
CPU interrupts</font>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><br>
</font></p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="clockfrequency"></a>[cpu.clockfrequency()]&nbsp;&nbsp;&nbsp;&nbsp;
Clock = clock(): returns the CPU frequency</font>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">Also, you can
expose as many CPU constants (for example memory mapped registers)</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">as you want to
this module. You might want to use this feature to access some </font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">CPU memory areas
(as defined in the CPU header files from the CPU support </font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">package)
directly from Lua. To do this, you'll need to define the </font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">PLATFORM_CPU_CONSTANTS
macro in the platform's platform_conf.h file </font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">(src/platform/&lt;platform
name&gt;/platform_conf.h). Include all your constants in a </font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">_C(
&lt;constant name&gt; ) definition, and then build your project.</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">For example,
let's suppose that your CPU's interrupt controler has 3 memory</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">mapped
registers: INT_REG_ENABLE, INT_REG_DISABLE and INT_REG_MASK. If you want</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">to access them
from Lua, locate the header that defines the values of these</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">registers (I'll
assume its name is "cpu.h") and add these lines to the</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">platform_conf.h:</font>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">#include "cpu.h"</font>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">#define
PLATFORM_CPU_CONSTANTS\</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">_C(
INT_REG_ENABLE ),\</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">_C(
INT_REG_DISABLE ),\</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">_C( INT_REG_MASK
)</font>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">After this
you'll be able to access the regs directly from Lua, like this:</font>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">data = cpu.r32(
cpu.INT_REG_ENABLE )</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">cpu.w32(
cpu.INT_REG_ENABLE, data )</font>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">For a
"real-life" example, see the src/platform/lm3s/platform_conf.h file.</font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">[uart.sendstring]
uart.sendstr( id, str1, str2, ... ): this is similar to "uart.send",
but its parameters are string.&nbsp;</font>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<br style="font-family: Verdana;">
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</body></html>

71
doc/pt/disp_ref.html Normal file
View File

@ -0,0 +1,71 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body style="background-color: rgb(255, 255, 255);">
<h3><a name="over"></a>disp</h3>
<span style="font-weight: bold;"></span><br>
<p class="MsoNormal"><a name="init"></a>
disp.init </p>
<p class="MsoNormal"> <br>
</p>
<p class="MsoNormal"><a name="enable"></a>
disp.enable </p>
<p class="MsoNormal"> <br>
</p>
<p class="MsoNormal"><a name="disable"></a>
disp.disable </p>
<p class="MsoNormal"> <br>
</p>
<p class="MsoNormal"> <a name="on"></a>disp.on
</p>
<p class="MsoNormal"> <br>
</p>
<p class="MsoNormal"><a name="off"></a>
disp.off<br>
</p>
<p class="MsoNormal" style="color: rgb(0, 0, 255);">
<br>
</p>
&nbsp; &nbsp;<a name="print"></a>disp.print<br>
<br>
<p class="MsoNormal"><a name="draw"></a>
disp.draw </p>
<big><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br style="font-family: Helvetica,Arial,sans-serif;">
<br style="font-family: Helvetica,Arial,sans-serif;">
<br style="font-family: Helvetica,Arial,sans-serif;">
<span style="font-family: Helvetica,Arial,sans-serif;">
&nbsp;
</span></big> <br>
<br style="font-family: Verdana;">
</body></html>

105
doc/pt/dl_binaries.html Normal file
View File

@ -0,0 +1,105 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css"></head>
<body style="background-color: rgb(255, 255, 255);"><br><h3><span class="info"><a name="sources"></a>Downloading eLua pre-built binary images</span></h3>
If you have an eLua capable hardware, you
don't need to be a professional&nbsp;developer of the embedded world
and to understand the details of the eLua building process, to be
able to have eLua on your nice kits. <br><br>eLua project offers pre-built
binary images for all the supported platforms.<br><br>All you have to do is to chose the
corresponding image file from the table below, flash it into your
board, connect a serial terminal (or Ethernet if you board supports)
and enjoy eLua.<br><br>
eLua binaries, like the <a href="dl_sources.html">source-code distributions</a>,
include some example programs in it's file system, so you can run and
play (yes! we have games too! :) them, following the instructions in
our <a href="using.html">Using eLua</a> page. The available example programs are described in our <a href="examples.html">Examples</a> page.<br><br>
If you need a customized binary image for an already supported
platform (ie: with an autorun program, with some code of yours in the
File System, with your LAN IP settings, .....) and you don't know how to build eLua, feel free to <a href="overview.html#contacts">write us</a> explaining what you need. We may (find some time to :) build one for you and eventually make it available here too.
<br><br>To understand what's in a file name (for example elua_lualong_lm3s8962.bin) check our <a href="building.html">Building eLua</a> page, or at least the last part of it, where the meaning of the file names coming from the build system is explained.<br>
<p><br></p><div><br><table class="table_center">
<tbody><tr>
<th>eLua Version</th>
<th>Target MCU</th>
<th>Lua Number</th>
<th>Memory Usage(KB)</th>
<th>Remarks</th>
<th>Download File</th>
</tr>
<tr>
<td>0.5</td>
<td>Atmel ARM7</td>
<td>Float</td>
<td>ROM: ~189<br> RAM: 32~64</td>
<td>Official eLua release</td>
<td><a href="http://prdownload.berlios.de/elua/elua_lua_at91sam7x256.bin">elua_lua_at91sam7x256.bin</a></td>
</tr>
<tr>
<td>0.5</td>
<td>Atmel ARM7</td>
<td>Float</td>
<td>ROM: ~189<br> RAM: 32~64</td>
<td>Official eLua release</td>
<td><a href="http://prdownload.berlios.de/elua/elua_lua_at91sam7x512g.bin">elua_lua_at91sam7x512g.bin</a></td>
</tr>
<tr>
<td>0.5</td>
<td>Intel x86<br>(for fun :)</td>
<td>Float</td>
<td> </td>
<td>Official eLua release</td>
<td><a href="http://prdownload.berlios.de/elua/elua_lua_i386.elf">elua_lua_i386.elf</a></td>
</tr>
<tr>
<td>0.5</td>
<td>Luminary Micro ARM Cortex M3</td>
<td>Float</td>
<td>ROM: ~202<br> RAM: 32~64</td>
<td>Official eLua release</td>
<td><a href="http://prdownload.berlios.de/elua/elua_lua_lm3s6965.bin">elua_lua_lm3s6965.bin</a></td>
</tr>
<tr>
<td>0.5</td>
<td>Luminary Micro ARM Cortex M3</td>
<td>Float</td>
<td>ROM: ~202<br> RAM: 32~64</td>
<td>Official eLua release</td>
<td><a href="http://prdownload.berlios.de/elua/elua_lua_lm3s8962.bin">elua_lua_lm3s8962.bin</a></td>
</tr>
<tr>
<td>0.5</td>
<td>NXP ARM7</td>
<td>Float</td>
<td>ROM: ~229<br> RAM: 32~64</td>
<td>Official eLua release</td>
<td><a href="http://prdownload.berlios.de/elua/elua_lua_lpc2888.bin">elua_lua_lpc2888.bin</a></td>
</tr>
<tr>
<td>0.5</td>
<td>ST Microelectronics ARM7</td>
<td>Float</td>
<td>ROM: ~189<br> RAM: 32~64</td>
<td>Official eLua release</td>
<td><a href="http://prdownload.berlios.de/elua/elua_lua_str711fr2g.bin">elua_lua_str711fr2g.bin</a></td>
</tr>
<tr>
<td>0.5</td>
<td>ST Microelectronics ARM 9</td>
<td>Float</td>
<td>ROM: ~229<br> RAM: 32~64</td>
<td>Official eLua release</td>
<td><a href="http://prdownload.berlios.de/elua/elua_lua_str912fw44.bin">elua_lua_str912fw44.bin</a></td>
</tr>
</tbody></table><br></div><p>Notes:</p>
<ul><li>Lua Number refers to the built Lua interpreter number type, float or integer.</li><li>RAM Memory Usage is based on included Lua examples execution.</li></ul></body></html>

82
doc/pt/dl_old.html Normal file
View File

@ -0,0 +1,82 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css"></head>
<body style="background-color: rgb(255, 255, 255);"><br><h3><span class="info"><a name="old"></a>Downloading eLua Old Versions</span></h3><br><h2>Source Code</h2>Previous eLua versions, both for source code and binaries, can be downloaded from the <a href="http://developer.berlios.de/project/showfiles.php?group_id=9919">BerliOS files page</a><br><br><br><h2>Binaries</h2><br><p><br></p><div><br><table class="table_center">
<tbody><tr>
<th>eLua Version</th>
<th>Target MCU</th>
<th>Lua Number</th>
<th>Memory Usage(KB)</th>
<th>Remarks</th>
<th>Download File</th>
</tr>
<tr>
<td>0.5</td>
<td>Atmel ARM7</td>
<td>Float</td>
<td>ROM: ~189<br> RAM: 32~64</td>
<td>Official eLua release</td>
<td><a href="http://prdownload.berlios.de/elua/elua_lua_at91sam7x256.bin">elua_lua_at91sam7x256.bin</a></td>
</tr>
<tr>
<td>0.5</td>
<td>Atmel ARM7</td>
<td>Float</td>
<td>ROM: ~189<br> RAM: 32~64</td>
<td>Official eLua release</td>
<td><a href="http://prdownload.berlios.de/elua/elua_lua_at91sam7x512g.bin">elua_lua_at91sam7x512g.bin</a></td>
</tr>
<tr>
<td>0.5</td>
<td>Intel x86<br>(for fun :)</td>
<td>Float</td>
<td> </td>
<td>Official eLua release</td>
<td><a href="http://prdownload.berlios.de/elua/elua_lua_i386.elf">elua_lua_i386.elf</a></td>
</tr>
<tr>
<td>0.5</td>
<td>Luminary Micro ARM Cortex M3</td>
<td>Float</td>
<td>ROM: ~202<br> RAM: 32~64</td>
<td>Official eLua release</td>
<td><a href="http://prdownload.berlios.de/elua/elua_lua_lm3s6965.bin">elua_lua_lm3s6965.bin</a></td>
</tr>
<tr>
<td>0.5</td>
<td>Luminary Micro ARM Cortex M3</td>
<td>Float</td>
<td>ROM: ~202<br> RAM: 32~64</td>
<td>Official eLua release</td>
<td><a href="http://prdownload.berlios.de/elua/elua_lua_lm3s8962.bin">elua_lua_lm3s8962.bin</a></td>
</tr>
<tr>
<td>0.5</td>
<td>NXP ARM7</td>
<td>Float</td>
<td>ROM: ~229<br> RAM: 32~64</td>
<td>Official eLua release</td>
<td><a href="http://prdownload.berlios.de/elua/elua_lua_lpc2888.bin">elua_lua_lpc2888.bin</a></td>
</tr>
<tr>
<td>0.5</td>
<td>ST Microelectronics ARM7</td>
<td>Float</td>
<td>ROM: ~189<br> RAM: 32~64</td>
<td>Official eLua release</td>
<td><a href="http://prdownload.berlios.de/elua/elua_lua_str711fr2g.bin">elua_lua_str711fr2g.bin</a></td>
</tr>
<tr>
<td>0.5</td>
<td>ST Microelectronics ARM 9</td>
<td>Float</td>
<td>ROM: ~229<br> RAM: 32~64</td>
<td>Official eLua release</td>
<td><a href="http://prdownload.berlios.de/elua/elua_lua_str912fw44.bin">elua_lua_str912fw44.bin</a></td>
</tr>
</tbody></table><br></div><p>Notes:</p>
<ul><li>Lua Number refers to the built Lua interpreter number type, float or integer.</li><li>RAM Memory Usage is based on included Lua examples execution.</li></ul><br><br><br><br></body></html>

52
doc/pt/dl_sources.html Normal file
View File

@ -0,0 +1,52 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css"></head>
<body style="background-color: rgb(255, 255, 255);"><br><h3><span class="info"><a name="sources"></a>Downloading eLua Source Code</span></h3><h2>Official Releases</h2>
<h4>Source code</h4>
<p>The last released version is eLua v0.6 and you can download it here:
####<br>
The package includes the complete source code, documentation, building scripts and Lua program examples.<br></p>
<p>After downloading and unpacking, you can acess eLua's documentation
in an offline mode, opening the document index_en.html in the /doc
folder. It will show you a version of this site at the time eLua v0.6
was released. The online version is constantly updated though and you
might check it for <a href="news.html">updated eLua news</a>.</p><p>You will find eLua building instructions on the <a href="building.html">Building eLua</a> page.</p><br><br>
<h2><a name="svnpublic"></a>Subversion&nbsp;Public Repository</h2>
<p>If you'd rather have the very last development ("bleeding edge") version, just check it out from our Subversion Repository:</p>
<pre>$ svn checkout svn://svn.berlios.de/elua/trunk<code><br></code></pre>
<p>Once checked out, the repository can be easily updated by the svn client command:</p>
<pre>$ svn update<code><br></code></pre>
<p><br></p>
<h2>Subversion Repository Web Browsing</h2>
If you're looking for an easy and user friendly way of browsing through the SVN repository, use the <a href="http://svn.berlios.de/wsvn/elua">WebSVN interface</a><br><h2></h2><h2><a name="svndev"></a>Subversion Repository for developers</h2>
<p>If you want to contribute to eLua and need write access to the repository, follow these steps:</p>
<ul><li>if you don't have an account on <a href="http://developer.berlios.de/">developer.berlios.de,</a> create one before proceeding.</li><li><a href="../../../../../../websites/elua%20site/www.eluaproject.net/index8603.html?p=Contact">contact us</a>, specifying your BerliOS id and we'll add you to the list of developers.</li></ul>
<p>Then checkout the repository:</p>
<pre>$ export SVN_SSH='ssh -l &lt;yourberliosid&gt;'<br style="font-family: Courier New;"><br style="font-family: Courier New;">$ svn checkout svn+ssh://svn.berlios.de/svnroot/repos/elua/trunk<code><br></code></pre>
<p>Once checked out, the repository can be easily updated:</p>
<pre>$ svn update<code><br></code></pre>
<p><br></p><br><br><br><p></p><p></p><p></p><p></p></body></html>

7
doc/pt/downloads.html Normal file
View File

@ -0,0 +1,7 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css"></head>
<body style="background-color: rgb(255, 255, 255);"><h3><a name="title" href="http://www.eluaproject.net/en/Booting_eLua_from_a_stick"></a><span class="info">Downloads</span></h3><br></body></html>

15
doc/pt/eluaapi.html Normal file
View File

@ -0,0 +1,15 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body style="background-color: rgb(255, 255, 255);">
<h3><a name="over"></a>eLua API</h3>
<br>
<br>
<br>
<br>
<br>
</body></html>

144
doc/pt/examples.html Normal file
View File

@ -0,0 +1,144 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css"></head>
<body style="background-color: rgb(255, 255, 255);">
<h3>Lua Code Examples</h3>eLua distros come bundled with nice and fun
(yes! we have games too! :) Lua programs examples in the File System.
They are also included in the eLua
source code distribution, under the /romfs subdirectory. <br>Lua example programs for eLua are also presented and commented here. <br>As previously explained, you can run them directly from eLua's file
system or you can use the eLua shell and send them via XMODEM, as
described <a href="using.html#shell">here</a>.<br><br>
<h3><a name="hello"></a>hello.lua: the ubiquitous "Hello, World!"</h3>
<p><strong>Runs on:&nbsp;</strong><br>All Targets</p><p><strong></strong>
<strong>Description:<br></strong>To call this a "program" is a gross overstatement, but it's a
tradition, so we respect it :) It just prints "Hello, World!" on the terminal and
returns to the shell. Download it only if you feel too lazy to fire up
the lua interpreter inside eLua and write it yourself :)</p><p><strong>Commented Source Code:</strong><br></p><p>print("Hello World")</p>
<h2><br></h2><h3><a name="info"></a>info.lua: getting the platform data</h3>
<p><strong>Runs on:&nbsp;</strong><br>All targets except i386</p><p><strong>Description:<br></strong>
This isn't really more advanced than "Hello, World!", but it does show
an eLua specific module: the platform data module (pd). You can read
more about the platform modules in the eLua source distribution
(docs/platform_modules.txt). The program will display the platform
name, the CPU name, the board name and the CPU clock and then will exit
to the shell.</p><p><strong>Commented Source Code:</strong></p><p><span style="font-family: Courier New;">-- Uses module pd to access platform data and print it on the Terminal</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">print( "I'm running on platform " .. pd.platform() ) &nbsp;</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">print( "The CPU is a " .. pd.cpu() )</span><br style="font-family: Courier New;"><span style="font-family: Courier New;"><span>print( "The board name is " .. pd.board(</span>) )</span><br></p><p></p>
<h3><a name="led"></a>led.lua: the old LED blinker, the new eLua way</h3>
<p><strong>Runs on: </strong><br>All targets except i386</p><p><strong>Description:<br></strong><strong></strong>
Now we get to do something "more embedded": blink a LED. The code ilustrates a few interesting eLua features:</p>
<ul><li><p>cross platform code: the code assigns a different pin
to the LED starting from the board name. You can see how the platform
data module makes it very easy to write such portable code.</p></li><li><p>uart, pio, tmr, pd modules: they are all used here.</p></li></ul>
<p>Watch it blink, then press any key to return to the eLua shell.</p><p><strong>Commented Source Code:</strong></p>
<h3><a name="hangman"></a>hangman.lua: taking advantage of your terminal</h3>
<p><strong>Runs on:&nbsp;</strong><br>All Targets except i386</p><strong></strong>
<strong></strong><p><strong>Description:<br></strong>By far the geekiest example from the eLua distribution (or would it be morse.lua? :), it makes use of
the term module (docs/terminal_support.txt) to let the user play a
BSD-like "hangman" directly in his terminal emulator. Run the example
and enjoy. Currently it has a very small list of words, as this was
written mainly as a proof of eLua's capabilities, but it's very easy to
add new words/replace the existing ones. A screenshot can be seen <a href="http://elua.berlios.de/other/elua_hangman.png">here</a>.</p><p></p>
<h3><a name="pwmled"></a>pwmled.lua: LED blinker, advanced class</h3><p><strong>Runs on:&nbsp;</strong><br>EK-LM3S8962,&nbsp;EK-LM3S6965</p><strong></strong>
<strong></strong><p><strong>Description:<br></strong>
This uses the PWM module to fade the on-board LED in and out, in an
infinite loop. Not much to say here, the code is very simple, yet the
results are quite spectacular. Press any key to end the sample and
return to the shell.</p><p></p>
<h3><a name="tvbgone"></a>tvbgone.lua: yes, eLua can do real time!</h3>
<p><strong>Runs on:&nbsp;</strong><br>EK-LM3S8962,&nbsp;EK-LM3S6965</p><strong></strong>
<strong></strong><p><strong>Description:<br></strong>This is more complex, but also very important for eLua, because it
proves that real time applications (with relatively strict timing
requirements) can run from eLua directly. It's the famous TV-B-Gone
project adapted from <a href="http://www.ladyada.net/make/tvbgone/">LadyAda's kit</a>.
If you're not familiar with TV-B-Gone, it knows how to do one thing
very well: power off your TV :) Basically it contains a lot of remote
control codes (for a lot of TVs) that are continously sent via an IR
LED. This code uses the PWM module (new in eLua 0.4) and it also does
file I/O from Lua, since the remote control codes are kept in a
separate file (which is also part of the ROM file system). To read the
binary file, the "pack" module (also new in 0.4) is used. To ensure
that we don't get any unexpected delays, the Lua garbage collector is
turned off. Take a look at this sample, it's both a very good proof of
the capabilities of eLua and a good learning resource. To use it on any
of the Cortex boards (EK-LM3S8962 or EK-LM3S6965) connect an IR LED
with a resistor between the "PWM2" and "GND" pins of the extension
connector. Get close to your TV and press the "select" button on your
board to start sending the IR codes. The on-board LED stays lit while
the codes are transmitted and shuts off afterwards. Press the "down"
button on your board to exit the application and return to the shell.</p><p></p>
<h3><a name="piano"></a>piano.lua: because PWM is great</h3><p><strong>Runs on:&nbsp;</strong><br>EK-LM3S8962,&nbsp;EK-LM3S6965, SAM7-EX256</p><strong></strong>
<strong></strong><p><strong>Description:<br></strong>
Yet another use for the PWM module, this sample can be used to "play"
notes via the on-board speaker using the PC keyboard. The on-screen
keyboard shows what keys you must press for different notes, and you
can set your octave and inter-note delay. Press ESC to end your eLua
musical session :) A screenshot can be seen <a href="http://elua.berlios.de/other/elua_piano.png">here</a>.</p><p></p>
<h3><a name="bisect"></a>bisect.lua: floating point at its best</h3>
<p><strong>Runs on:&nbsp;</strong><br>All Targets</p><strong></strong>
<strong></strong><p><strong>Description:<br></strong>This is taken directly from the official Lua distribution, and it's
here to show that eLua can do floating point just like on a desktop
machine, albeit slower. Run it on your target, then run it again, but
this time on the PC, and compare the results. Yes, they are identical.</p><p></p>
<h3><a name="morse"></a>morse.lua: because PWM is great, part II</h3>
<p><strong>Runs on:&nbsp;</strong><br>EK-LM3S8962,&nbsp;EK-LM3S6965, SAM7-EX256</p><strong></strong>
<strong></strong><p><strong>Description:<br></strong>This uses the same PWM module for Morse code generation. Just enter a
text, and listen to it getting Morsed on your board's speaker and on a blinking Led. The
letters and Morse codes are also shown on the terminal. Use '+' and
'-'' to change the frequency, up and down arrows to change the speed,
's' to mute/unmute, and ESC to exit.</p><p></p>
<h3><a name="lhttpd"></a>lhttpd.lua: only with (e)Lua ...</h3>
<p><strong>Runs on:&nbsp;</strong><br>EK-LM3S8962,&nbsp;EK-LM3S6965<strong></strong>
<strong></strong><br></p><p><strong>Description:<br></strong>This is one of those things that can show the real potential of a
language (and hopefully the real potential of eLua in this case). As
you have probably guessed by now, it's a web server&nbsp;written in Lua.
Except that it is much more than this: it's a scripting web server! That's
right, you can embed parts of Lua code into your pages, and the server
will parse them and replace the Lua code with its output. To output
something from Lua code embedded in a web page, simply use "print" in
your Lua code. You can also write your pages completely in Lua (again,
using "print"), the server knows how to handle this too. When is the
last time you heard about a scripting web server in 256k of Flash/64k
of RAM?&nbsp;</p><p>The full list of features is given below:</p>
<ul><li>completely written&nbsp;in Lua</li><li>can handle a single connection at a time (for now)</li><li>can serve text and images (so far)</li><li>gets its files from the ROM file system (this will be extended when more filesystems are added)</li><li>can
execute embedded Lua code and replace it with its output (via "print"
statements). Embed Lua code in your HTML files between tags, make sure
your HTML file extension is ".pht", and the server will preprocess it
and replace the Lua code with its output</li><li>if a file with
".lua" extension is requested, it doesn't send the file, but executes
it and sends its output (via "print" statements)</li></ul>
<p>This is still work in progress, but it already works quite well.
Take a look at romfs/index.pht and romfs/test.lua from the source
distribution for an example of how to include Lua code in your HTML
files.</p><p></p><p></p><p></p></body></html>

209
doc/pt/faq.html Normal file
View File

@ -0,0 +1,209 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css"></head>
<body style="background-color: rgb(255, 255, 255);">
<h3>eLua Frequently Asked Questions</h3><br><p>Welcome to the official eLua FAQ!
It is assumed that you already know <a>what eLua is</a>, so here's a list of questions you might find useful while exploring eLua.</p>
<ul><li><p><a href="faq.html#learnlua">How can I learn Lua? Is it hard?</a><br></p></li><li><p><a href="faq.html#helpelua">How can I help eLua?</a><br></p></li><li><p><a href="faq.html#comercial">Can I use eLua in my commercial, closed source project?</a><br></p></li><li><p><a href="faq.html#fast">Is eLua fast enough?</a><br></p></li><li><p><a href="faq.html#minimuns">What are the minimum requirements for eLua?</a><br></p></li><li><p><a href="faq.html#portability">Since
I'm using the Lua platform modules (uart, spi, pwm, tmr...), can I
trust my peripheral code to run the same on all my platforms?</a><br></p></li><li><p><a href="faq.html#luaversions">What's the deal with floating-point Lua and integer only Lua?</a><br></p></li><li><p><a href="faq.html#windows">All your tutorials give instructions on how to compile eLua under Linux, yet you seem to use a lot of Windows tools. How come?</a><br></p></li><li><p><a href="faq.html#cygwin">Will you ever post instructions about how to compile toolchains under Cygwin in Windows?</a><br></p></li><li><p><a href="faq.html#bytecode">I
know that Lua can be compiled to bytecode, so I compiled one of the
eLua examples with luac and tried to run it on my eLua board, but it
didn't work. Is this a bug in eLua?</a><br></p></li><li><p><a href="faq.html#outofmemory">I get "out of memory" errors when I run my Lua programs, what should I do?</a><br></p></li></ul>
<p><br></p>
<hr>
<p><a name="learnlua"></a>
<strong>Q: How can I learn Lua? Is it hard?</strong></p>
<p>A: Lua is a minimalistic language (yet very powerful) which is quite
easy to learn. Once you understand the basic concepts you'll find
yourself writing Lua programs in notime. The main resource is the <a target="_top" href="http://www.lua.org/">Lua homepage</a>. In the <a target="_top" href="http://www.lua.org/docs.html">documentation page</a>
you'll find the reference manual and the first version of the excellent
"Programming in Lua" book. I recommend purchasing the second version of
this book, since it's likely that this is all you'll ever need to learn
Lua. Another very good resource is the <a target="_top" href="http://lua-users.org/wiki/">Lua wiki</a>. If you need more help, check the <a target="_top" href="http://www.lua.org/community.html">community page</a>. Lua has a very friendly and active community.</p><p></p><br><p><a name="helpelua"></a>
<strong>Q: How can I help eLua?</strong></p>
<p>A: OK, so I lied, this is NOT a frequently asked question :)
However, if you really want to help eLua, keep in mind that we're
looking for developers. eLua has many ambitious goals, so it would be
great to have more people working on it. Take a look at the <a href="status.html#roadmap">roadmap page</a>, and if you see something there that you'd like to implement, don't hesitate to <a href="overview.html#contacts">contact us</a>.
Also, if you'd like to make a donation to the project (money, or maybe
a development board) rest assured that wwe won't say no :) It also
helps a lot if you test eLua on your own board and you find a bug or an
incomplete feature. Or if you just thought about a cool feature that
you'd like to see in eLua. If so, feel free to <a href="overview.html#contacts">contact us</a>.</p><p></p>
<p><a name="comercial"></a>
<strong>Q: Can I use eLua in my commercial, closed source project?</strong></p>
<p>A: ### This needs to be updated for the BSD license .........</p><p></p>
<p><a name="fast"></a>
<strong>Q: Is eLua fast enough?</strong></p>
<p>A: This pretty much depends on what you expect. If you expect your
Lua code to run as fast as your compiled C code, this won't happen,
simply because C is a compiled language, while Lua is an interpreted
language. That said, you'll be happy to know that Lua is one of the
fastest interpreted languages out there. If you really need both high
speed and Lua, you can write your speed critical code sections in C and
export them as a Lua module. This way you get the best of both worlds.
We don't have any official benchmarks about Lua speed on embedded
devices, but you might want to check the TV-B-Gone example on the <a href="examples.html">examples page</a>.
TV-B-Gone is a "software remote control" application coded directly in
eLua. If you're familiar with the remote control protocols, you'll know
that this kind of application is quite "real time", and delays in the
order of milliseconds or even less can make your software remote
control fail. Yet this sample runs without problems on a 50MHz Cortex
(Thumb2) CPU. This should give you a fairly intuitive view on the speed
of eLua.</p><p></p>
<p><a name="minimuns"></a>
<strong>Q: What are the minimum requirements for eLua?</strong></p>
<p>A: It's hard to give a precise answer to this. As a general rule for
a 32-bit CPU, we recommend at least 256k of Flash (program memory) and
at least 64k of RAM. However, this isn't a strict requirement. A
stripped down, integer-only version of eLua can definetely fit in 128k
of Flash, and depending on your type of application, 32k of RAM might
prove just fine. It largely depends on your needs.</p><p></p>
<p><a name="portability"></a>
<strong>Q: Since I'm using the Lua platform modules (uart, spi, pwm,
tmr...), can I trust my peripheral code to run the same on all my
platforms?</strong></p>
<p>A: Unfortunately, no. While eLua makes it possible to have a common
code on different platforms using the platform interface
(docs/platform_interface.txt), it can't possibly provide the same
functionality on all platforms, since all CPUs are not created equal.
It is very recommended (and many times imperative) to have an
understanding of the peripherals on your particular CPU before you
write your code. This, of course, is not particular to eLua, but it's
especially important since the platform interface might give the
impression that it offers an uniform functionality over all platforms,
when in fact the only thing in common is often just the interface
itself (that is, the methods and variables you can access in a given
module). eLua tries to help here by giving you an error when you try to
access a physical resource that is not available (for example a timer,
a PWM channel, or a PIO pin/port), but it doesn't try to cover all the
possible platform-related issues, since this would increase the code
size and complexity too much. These are some caveats that come to mind
(note that these are only a few examples, the complete list is much
longer):</p>
<ul><li>timers: from all the platforms on which eLua runs, only
the Luminary Cortex CPUs has rock solid 32-bit timers. You can do
pretty much everything you need with them. All the other platforms have
16-bit timers, which imposes some limits on the range of delays you can
achieve with them. Make sure to use tmr.mindelay(id) and
tmr.maxdelay(id) to check the actual resolution of your timers, and
adapt your code accordingly. To 'compensate' for this, it's not
possible to change the base timer frequency on the Cortex CPUs, but it
is possible on most other platforms :) So be sure to also check the
result of tmr.setclock(id)</li><li>also, when using timers,
remember that if you're using XMODEM and/or the "term" module, TMR0 is
used by both of them. So, if you change the TMR0 base clock in your
code, be sure to restore the original setting before returning to the
shell. You can change this static timer assignment by modifying
src/main.c. It might also be possible to change it dynamically in the
future, although I see little use for this.</li><li>PWM: the
Cortex CPUs have 6 PWM channels, but channels 0/1, 2/3 and 4/5
respectively share the same base clock setting. So, when you're
changing the base clock for channel 1, you're also changing the base
clock for channel 0; if channel 0 was already running, you won't like
what will happen next. This time no eLua function can save you, you
simply need you know your CPU architecture.</li><li>GPIO: only
some platform have internal pullups for the GPIO pins, while Cortex is
the only platform that also provides pulldowns for its GPIOs. However,
in this case you're safe, as eLua will signal an error if you try to
execute a pullup operatin on a platform that does not support it.</li></ul>
<p>The lesson here is clear: understand your platform first!</p><p></p>
<p><a name="luaversions"></a>
<strong>Q: What's the deal with floating-point Lua and integer only Lua?</strong></p>
<p>A: Lua is build around a number type. Every number in Lua will have
this type. By default, this number type is a double. This means that
even if your program only does integer operations, they will still be
treated as doubles. On embedded platforms this is a problem, since the
floating point operations are generally emulated in software, thus they
are very slow. This is why eLua gives you "integer only Lua": a Lua
with the default number type changed to long. The advantages are
increased speed and smaller code size (since we can force Newlib to
"cut" the floating point code from printf/scanf and friends, which has
quite a strong impact on the code size) and increased speed. The
downside is that you'll loose the ability to do any floating point
operations.</p><p></p>
<p><a name="windows"></a>
<strong>Q: All your tutorials give instructions on how to compile eLua
under Linux, yet you seem to use a lot of Windows tools. How come?</strong></p>
<p>A: It's true that we do all the eLua development under Linux, since we
find Linux an environment much more suited for development. At the same
time it's true that most of the tools that come with my development
boards run under Windows. So we choose to use the best of both world: Bogdan runs&nbsp;Linux under an Virtual Machine Manager (<a target="_top" href="http://www.virtualbox.org/">VirtualBox</a>) and do&nbsp;everything else under Windows. Dado does everything on Linux and runs Windows under <a href="http://www.vmware.com" target="_top">VMWare</a>. Both options are nice if you master your environment. To make everything even more flexible, Bogdan keeps his
VirtualBox Ubuntu image on an external WD passport disk that he can
carry with him wherever he goes, so he can work on eLua whenever he has a
bit of spare time :)</p><p></p>
<p><a name="cygwin"></a>
<strong>Q: Will you ever post instructions about how to compile toolchains under Cygwin in Windows?</strong></p>
<p>A: Bogdan: If I ever have way too much spare time on my hands, yes.
Otherwise, no. There are many reasons for this. As I already mentioned,
I favour Linux over Windows when it comes to developing applications.
Also, I noticed that the GNU based toolchains are noticeable slower on
Cygwin than on Linux, so experimenting with them can prove frustrating.
Also, compiling under Linux and Cygwin should be quite similar, so try
starting from my Linux based tutorials, they might work as well on
Cygwin.</p><p></p>
<p><a name="bytecode"></a>
<strong>Q: I know that Lua can be compiled to bytecode, so I compiled
one of the eLua examples with luac and tried to run it on my eLua
board, but it didn't work. Is this a bug in eLua?</strong></p>
<p>A: This is not a bug in eLua, it's a bit more subtle than that. It's
true that ARM and i386 are very similar when it comes to data types:
all the fundamental data types have the same length, and they are both
little endian. So, in theory, if you compile a Lua source file on PC
you should be able to run the compiled bytecode on your eLua board
without any modifications. But there's a problem here: the default
double precision floating point representation is different on ARM and
PC. So, while the two data types have the same endianess and size, they
are represented differently in memory. This means that you can't use
the "regular" luac compiler for this task. However, starting with
version 0.5, you can cross-compile Lua code on PC to run on target.&nbsp;</p><p></p>
<p><a name="outofmemory"></a>
<strong>Q: I get "out of memory" errors when I run my Lua programs, what should I do?</strong></p>
<p>A: There are a number of things you can try to overcome this:</p>
<ul><li>precompile your source to bytecode:&nbsp; If you use bytecode instead of
source code Lua won't need to compile your source, so you save some RAM.</li><li>try
to avoid using too many strings: strings are immutable in Lua. That
means that a statement like s = s .. "\n" (where s is a string) will
create a new string each time it's called. If this happens a lot (for
example in a loop), your memory will quickly run out because of all the
strings. If you really need to do frequent string operations, put them
in a table and then use <a href="http://www.lua.org/manual/5.1/manual.html#5.5">table.concat</a> to make a string from your table.</li><li>controll Lua's garbage collection&nbsp;manually: if you're still running out of memory, try
calling collectgarbage('collect') from your code, which will force a
garbage collection and thus might free some memory.</li></ul><br><br></body></html>

View File

@ -0,0 +1,15 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body style="background-color: rgb(255, 255, 255);">
<h3><a name="over"></a>eLua Generic Modules</h3>
<br>
<br>
<br>
<br>
<br>
</body></html>

154
doc/pt/gpio_ref.html Normal file
View File

@ -0,0 +1,154 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body style="background-color: rgb(255, 255, 255);">
<h3><a name="over">gpio</a></h3>
<p class="MsoNormal" style="font-family: Verdana;">
<b>[gpio] pio</b><br>
</p>
<br>
<p class="MsoNormal" style="font-family: Verdana;"><a name="setpinvalue"></a> [gpio.setpinvalue] pio.setpin(
value, Pin1, Pin2 ... ): set the value to all the pins in the list
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp; to "value" (0 or 1).
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="setpinhigh"></a> [gpio.setpinhigh] pio.set(
Pin1, Pin2, ... ): set the value of all the pins in the list to 1.
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="getpinvalue"></a> [gpio.getpinvalue] Val1, Val2,
... = pio.get( Pin1, Pin2, ... ): reads one or more pins and returns
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp; their values (0 or 1).
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="setpinlow"></a> [gpio.setpinlow] pio.clear(
Pin1, Pin2, ... ): set the value of all the pins in the list to 0.
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="configpin"></a> [gpio.configpin(gpio.DIR,
gpio.DIR_INPUT)] pio.input( Pin1, Pin2, ... ): set the specified pin(s)
as input(s).
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;">
[gpio.configpin(gpio.DIR, gpio.DIR_OUTPUT)] pio.output( Pin1, Pin2, ...
): set the specified pin(s) as output(s).
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="setportvalue"></a> [gpio.setportvalue]
pio.setport( value, Port1, Port2, ... ): set the value of all the ports
in the
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp; list to "value".
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="getportvalue"></a> [gpio.getportvalue] Val1,
Val2, ... = pio.getport( Port1, Port2, ... ): reads one or more ports
and
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp; returns their values.
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="getportname"></a> [gpio.getportname]
Port = pio.port( code ): return the physical port number associated
with the given code. For example, "pio.port( pio.P0_20 )" will return
0.
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="getpinnumber"></a> [gpio.getpinnumber] Pin =
pio.pin( code ): return the physical pin number associated with the
</p>
<p class="MsoNormal" style="font-family: Verdana;">
given code. For example, "pio.pin( pio.P0_20 )" will return 20.
</p>
<br>
<a name="togglepin"></a>[gpio.togglepin([Pin1],
[Pin2], ...)]<br>
<br>
<a name="toogleport"></a>[gpio.toggleport([Port1],
[Port2], ...)]<br style="font-family: Verdana;">
<br>
Another idea (can be added to the above ?)<br>
[gpio.configport(gpio.[FUNCTION], gpio.MASK, [MASK])]<br>
Ex:<br>
&nbsp; gpio.configpin(gpio.DIR,
gpio.DIR_INPUT)&nbsp;&nbsp;&nbsp; (.DIR_OUTPUT)<br>
&nbsp; gpio.configpin(gpio.PULL,
gpio.PULL_UP)&nbsp;&nbsp;&nbsp;&nbsp; (.PULL_DOWN,
PULL_NO)<br style="font-family: Verdana;">
<br>
<p class="MsoNormal" style="font-family: Verdana;">
[gpio.configport(gpio.DIR, gpio.DIR_INPUT, [Port1], [Port2], ...)]
pio.port_input( Port1, Port2, ... ): set the specified port(s) as
input(s).
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;">
[gpio.configport(gpio.DIR, gpio.DIR_OUTPUT, [Port1], [Port2], ...)]
pio.port_output( Port1, Port2, ... ): set the specified port(s) as
output(s).
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;">
[gpio.configpin(gpio.PULL, gpio.PULL_UP, [Pin1], [Pin2], ...)]
pio.pullup( Pin1, Pin2, ... ): enable internal pullups on the specified
pins.Note that some CPUs might not provide this feature.
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;">
[gpio.configpin(gpio.PULL, gpio.PULL_DOWN, [Pin1], [Pin2], ...)]
pio.pulldown( Pin1, Pin2, ... ): enable internal pulldowns on the
specified pins. Note that some CPUs might not provide this feature.
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;">
[gpio.configpin(gpio.PULL, gpio.PULL_NO, [Pin1], [Pin2], ...)]
pio.nopull( Pin1, Pin2, ... ): disable the pullups/pulldowns on the
specifiedpins. Note that some CPUs might not provide this feature.
</p>
<br>
<br>
What is the real advantage/reason of having a pin "list" on some of
these functions ? If we cannot build a table with them, there's really
no great use of this, as we cannot create the list in run time and some
other proposed functions solve the problem of avoiding more than one
call for several pins.<br>
A: It IS usefull and sometimes necessary so it will stay.....<br>
<br>
</body></html>

11
doc/pt/net_ref.html Normal file
View File

@ -0,0 +1,11 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body style="background-color: rgb(255, 255, 255);">
<h3><a name="over"></a>net</h3>
<br>
</body></html>

138
doc/pt/news.html Normal file
View File

@ -0,0 +1,138 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css"></head>
<body style="background-color: rgb(255, 255, 255);">
<h3>eLua Project News</h3><div class="content">
<h2>02 February 2009</h2>
<p>We know that we haven't had an official release in a while now, but
there's a lot of stuff going on with the project. The next release will
definitely happen before the enf of February and it will come with a
lot of interesting new features, including support for two new
platforms, a completely redesigned documentation system, and a few
surprises that I won't mention just yet :) So stay tuned, we're working
hard to make eLua better for you.</p>
<h2>01 November 2008</h2>
<p>Version 0.5 is released! Among other goodies, it brings TCP/IP support to eLua. Here's the changelog:</p>
<ul><li>Added support for STR7 CPUs from ST </li><li>Added TCP/IP support using the uIP stack </li><li>Added support for console and shell over TCP/IP besides the previous serial link</li><li>Added the "net" module (eLua's interface to TCP/IP functions) </li><li>Added the "cpu" module (eLua's interface to the target CPU) </li><li>New samples: morse.lua (Morse code encoder), lhttpd.lua (Lua scripting HTTP server) </li><li>Added support for cross-compiling Lua code (compile on PC, run on target)</li><li>XMODEM can now receive Lua bytecode in addition to Lua source code </li><li>The XMODEM buffer is now dynamic (grows as needed) instead of fixed size</li><li>Project documentation updated</li></ul>
<p>Also, there's a new tutorial about <a href="http://www.eluaproject.net/?p=eLua_on_STR7_CPUs">how to use eLua with STR7 CPUs</a>. The rest of the project page was updated to reflect the current project status, most notably the <a href="http://www.eluaproject.net/?p=Faq">FAQ</a>, <a href="http://www.eluaproject.net/?p=Examples">examples</a> and <a href="http://www.eluaproject.net/?p=Status">status pages</a>).</p>
<p><strong>IMPORTANT NOTE:</strong> you'll need to update your binutils to version 2.19 to use this release with Cortex CPUs. The <a href="http://www.eluaproject.net/?p=Building_GCC_for_Cortex">Cortex GCC tutorial</a> was updated with this information.</p>
<p>Enjoy this new release. The next one will be focused on reducing the
memory footprint (both Flash and RAM) of eLua, and (hopefully) will
also come with a nice surprise :)</p>
<h2>16 October 2008</h2>
<p>The <a href="http://www.eluaproject.net/?p=Using_OpenOCD">OpenOCD tutorial</a> was updated with a new section about how to use OpenOCD with a STR7 CPU from ST. Also, the <a href="http://www.eluaproject.net/?p=Overview">about page</a> was updated with more information about the authors of eLua. Expect a new eLua version towards the end of October.</p>
<h2>10 September 2008</h2>
<p>Version 0.4.1 is released! This is a minor release, its main purpose
is to "keep in sync" with Lua, thus eLua now has the latest official
Lua version (5.1.4). You probably don't need to upgrade to this version
(since 5.1.4 only fixes some minor/exotic bugs in 5.1.3) so I'm only
providing the source code, without any binaries. Here's the changelog:</p>
<ul><li>Changed the file system structure; now you can build both Lua versions (floating point and int only) from the same directory</li><li>Made the math library configurable using the existent 'platform libraries' mechanism</li><li>The
"os" and "package" modules are no longer loaded by Lua, since they
can't be used anyway. Because of this, the code size of eLua was
reduced.</li><li>Project documentation updated</li></ul>
<h2>02 September 2008</h2>
<p>Version 0.4 is released! Here's the changelog:</p>
<ul><li>Added support for LPC2888 (preliminary)</li><li>Added PWM module</li><li>New
samples: TV-B-Gone (power off your TV), piano (play piano from your PC
keyboard), pwmled (fade led on/off), all based on the new PWM module</li><li>Added
support for multiple memory spaces (this can be used to take advantage
of both the internal CPU RAM and external RAM chips on boards that have
external RAM)</li><li>Autorun: if "autorun.lua" is found in the filesystem, it is executed before starting the shell</li><li>Added "pack" (binary data packing/unpacking) and "bit" (binary operations) modules</li><li>Build system updated, easier to use, now it knows how to handle "boards" as well as CPUs</li><li>Modified the existing platform modules to take less RAM and to report an error when an unavailable resource is requested</li><li>Project documentation updated</li></ul>
<h2>02 September 2008</h2>
<p>The eLua site was updated in anticipation of the new 0.4 release, which will come soon (very soon, in fact). Now there's a <a href="http://www.eluaproject.net/?p=Faq">FAQ page</a>. Also, the <a href="http://www.eluaproject.net/?p=Status">status and roadmap</a>, <a href="http://www.eluaproject.net/?p=Building_eLua">building eLua</a>, <a href="http://www.eluaproject.net/?p=Example">example programs</a> and <a href="http://www.eluaproject.net/?p=Using_OpenOCD">using OpenOCD</a> pages were updated. And there's yet another new page on <a href="http://www.eluaproject.net/?p=eLua_on_LPC2888_CPUs">how to use eLua with LPC2888 CPUs</a>. Expect the 0.4 release later today.</p>
<h2>09 August 2008</h2>
<p>OK, this took less time than I expected :) The page on how to use eLua with STR9 CPUs is available <a href="http://www.eluaproject.net/?p=eLua_on_STR9_CPUs">here</a>.</p>
<h2>09 August 2008</h2>
<p>Version 0.3 is released! The project page was updated, with more
sections to come soon, including a tutorial on how to use eLua with
STR9 CPUs. Here's the changelog for the 0.3 version:</p>
<ul><li>Now you can play hangman directly from eLua :), thanks to the new "term" module that handles ANSI escape sequences</li><li>Added support for ST STR912FW44</li><li>Added support for Cortex LM3S6965</li><li>More intuitive and flexible build system (new syntax, component selection at build time)</li><li>eLua examples are now part of the repository</li><li>Project documentation updated</li></ul>
<h2>06 August 2008</h2>
<p>The web page was updated with an <a href="http://www.eluaproject.net/?p=Using_OpenOCD">OpenOCD tutorial</a>
that will continue to grow as more and more targets are added. This
update is also an informal announcement of the soon to come eLua 0.3
release, which (among other things) brings support for the <a href="http://www.hitex.com/index.php?id=383">STR9-comStick</a>.</p>
<h2>29 July 2008</h2>
<p>eLua has a new home at BerliOS. Besides the new menu system on the
home page, the biggest news is that the code repository is now based on
SVN (as opposed to CVS until now). If you're a developer, this is
probably good news for you. If not, check the download page to learn
about the new eLua download locations.</p>
<h2>28 July 2008</h2>
<p>I got a report that compiling a simple C++ program for a Cortex CPU with a compiler built after <a href="http://www.eluaproject.net/?p=Building_GCC_for_Cortex">my instructions</a>
failed with a linker error. I checked and I found out that the gcc's
C++ library (libstdc++) wasn't even build properly for Cortex-M3. My
bad. I updated the tutorial page. The only modification is in step 4,
where you need to give more flags to the "make" commands, not just the
CFLAGS. Thanks for reporting this.</p>
<h2>27 July 2008</h2>
<p>Version 0.2 is released! Also, as you probably figured out by now,
the project page was seriously updated. Here's the changelog for the
0.2 version:</p>
<ul><li>Added support for Cortex LM3S8962</li><li>New platform modules (UART, SPI, Timer, platform data)</li><li>First release of the eLua shell</li><li>Lua source files can now be sent to target with XMODEM</li><li>You can download binary file images from the "files" section, so you don't need to compile eLua yourself</li></ul>
<h2>25 July 2008</h2>
<p>Project page updated to reflect the current eLua <a href="http://www.eluaproject.net/?p=Status">status and roadmap</a>.
Now there is a separate status and roadmap page. Also, version 0.2 is
about to be released soon, with many new features, improvements and
support for a new platform. More documentation is on the way, too.</p>
<h2>15 July 2008</h2>
<p>Added a <a href="http://www.eluaproject.net/?p=Booting_eLua_from_a_stick">tutorial</a> on how to make your own eLua USB bootable stick! Get it while it's hot! :)</p>
<h2>11 July 2008</h2>
<p>eLua version 0.1 is finally out! Be sure to check the <a href="http://www.eluaproject.net/?p=Downloads">download page</a>,
and also the project page. The build instructions are included in the
eLua archive. Also, new tutorials (building cross compilers for ARM and
i386) were added, and the <a href="http://www.eluaproject.net/?p=Booting_your_PC_in_eLua">boot into Lua</a> page was updated to reflect the fact that you can build the eLua ELF file yourself now!</p>
<h2>07 July 2008</h2>
<p>I'm still "brushing" the source code and adding more documentation
before commiting the first version to CVS. Meanwhile, I prepared a
(hopefully) nice surprise for all of you who showed interest in eLua
(and for those of you who didn't, hopefully this will make you curious
:) ). So, if you ever wanted to boot your PC directly in Lua, take a
look <a href="http://www.eluaproject.net/?p=Booting_your_PC_in_eLua">here</a>.
That's right: no OS, just GRUB loading a multiboot compliant ELF file!
The ELF file is build from the exact source tree I'm using to build
eLua for embedded devices, I only needed to change the platform layer
(more about this after uploading the sources and adding some
documentation).
I hope you'll enjoy this at least as much as I do. While this is only a
proof of concept, I am not going to abandon the "standalone Lua on PC"
idea, because it could have some very interesting applications (think
"BIOS scripting with Lua", <a href="http://en.wikipedia.org/wiki/Open_Firmware">Open Firmware</a> with Lua instead of Forth, educational applications and many others.)</p>
<h2>05 July 2008</h2>
<p>The web page is up! For now you can only read the <a href="http://www.eluaproject.net/?p=Overview">project description</a>. Also, a tutorial about how to compile a GCC toolchain for the Cortex architecture is available <a href="http://www.eluaproject.net/?p=Building_GCC_for_Cortex">here</a>.</p>
</div>
</body></html>

98
doc/pt/overview.html Normal file
View File

@ -0,0 +1,98 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css"></head>
<body style="background-color: rgb(255, 255, 255);">
<a name="whatis"></a><h3>What is eLua ?</h3>
<strong>eLua</strong>
stands for <strong>Embedded Lua</strong> and the project
aims to offer the full set of features of the&nbsp;<a href="www.lua.org">Lua Programming Language</a> to the embedded world. <span style="font-weight: bold;"><br>eLua</span>
is not a striped down sub-sub-set of a language, much on the contrary.
Besides offering different flavors &nbsp;of full Lua implementations
(ie: integer or fp numbers, ...), <span style="font-weight: bold;">eLua</span>
extends Lua with some neat types
for the embedded world (ie: light tables, light functions, ...), to
allow them to be romable and&nbsp;the aplications to exploit better the
balance ROM/RAM of the current MCUs.<br><br>
Lua is the perfect example of a
minimal, yet fully
functional language. Although generally advertised as a "scripting
language" (and used accordingly especially in the game industry), it is
also fully capable of running stand-alone programs. Its limited
resource requirements make it suitable to a lot of microcontroller
families. Lua's incredible portability (Lua code is ANSI C and runs virtually in every known platform) and <span style="font-weight: bold;">eLua</span>'s
roadmap for supporting the most used MCUs on the market, opens to the
embedded world a new degree of "portability". Write your program in Lua
and run it, without or with very few modifications, on every <span style="font-weight: bold;">eLua</span> supported platform, even with different architectures!<br><br>The aim of the project is to have a fully functional Lua development
environment <strong>on the microcontroller itself</strong>,
without the need to install a specific development environment&nbsp;on the PC side.
Initially, a PC will still be needed in order to edit the Lua programs
for the microcontroller. But as the project evolves this requirement
will be relaxed, as a basic editor (also residing on the
microcontroller) will be usable with a variety of input/output devices.<br><br><span style="font-weight: bold;"></span><br>
<br><br>
<a name="audience"></a><br><h3>Audience</h3>
<span style="font-weight: bold;">eLua</span> has a wide and varied audience, from highly skilled developers
that want to extend their programs with the Lua library facilities and
portable features, to the newcomer to the embedded world, who wants an
easy and powerfull environment for prototyping, rapid application
development, educational or final product quick production.<br><br><span style="font-weight: bold;">eLua</span>
allows new embedded world programmers to use the simplicity and
powerfullness of the Lua programming language, to hide low-level
complexities and platform/architecture-dependent features. A whole new
class of embedded programmers, with no deep knowledge of the peripheral
details but with powerfull aplications in mind is now possible. Modern
designers and multimedia artists are already an example of this "class".<br><br>On
the other edge of the category, oldtime and skilled embedded developers
can create complex and abstract modules, offering a degree of portability
to the final user never dreamed before on the embedded world.<br><br>eLua audience would be among&nbsp;the following categories:<br><ul><li>Embedded developers that are looking for a fast, easy to use and powerful way of coding.</li><li>First-time
embedded programmers (or simply first time programmers)&nbsp; that are
looking for an easy way to "dive" into the embedded programming world.
eLua is a great learning tool.</li><li>People that aren't really
developers, but&nbsp;want to be able to prototype an embedded system
fast and painless, without having to learn C for that.</li><li>Embedded
developers that need powerfull meta-language mecanisms for complex code
algorithms and data description, not offered by the languages available
to the embedded development world.</li><li>Field
engineers that can go their customer site and debug an eLua module on
site, without any preparation at all, since the whole development
environment resides on chip already.</li></ul><br><a name="authors"></a>
<h3>Authors</h3>
<p><strong>eLua</strong> is a joint project of <strong><a href="#contacts">Bogdan Marinescu</a></strong>,
a software developer from Bucharest (Romania) and <strong><a href="#contacts">Dado Sutter</a></strong>,
head of the Led Lab at <a href="http://www.puc-rio.br/">PUC-Rio
University</a>, in Rio de Janeiro (Brazil). </p>
<p>Its origins come from the <a href="http://www.circuitcellar.com/renesas2005m16c/winners/1685.htm">ReVaLuaTe</a>
project also developed by Bogdan Marinescu (as a contest entry for the
2005 Renesas M16CDesign Contest), and the Volta Project, managed by
Dado Sutter at PUC-Rio from 2005 to 2007.</p>
<p><strong>eLua</strong> is an Open Source and
collaborative project and an always growing list of collaborators can
be found in our <a href="#credits">Credits
Page</a></p><p></p>
<div style="text-align: center;"><span style="font-weight: bold;"></span><br><span style="font-weight: bold;"></span></div><table style="width: 578px; height: 256px; text-align: left; margin-left: auto; margin-right: auto;" border="1" cellpadding="2" cellspacing="2"><tbody><tr><td style="text-align: center; font-family: Verdana; font-weight: bold;" valign="undefined"><big>ReVaLuaTe Project</big></td><td style="text-align: center; font-family: Verdana; font-weight: bold;" valign="undefined"><big>Volta Project</big></td></tr><tr><td style="text-align: center;" valign="undefined"><img style="width: 278px; height: 188px;" alt="ReVaLuaTe project picture" src="../wb_img/terminalreneseas.jpg"></td><td style="text-align: center;" valign="undefined"><img style="width: 278px; height: 209px;" alt="Volta project picture" src="../wb_img/volta-small.jpg"></td></tr></tbody></table><div style="text-align: center;"><span style="font-weight: bold;"></span><br><span style="font-weight: bold;"></span><br><span style="font-weight: bold;"></span><br><span style="font-weight: bold;"></span></div><br><a name="contacts"></a>
<h3>Contacts</h3>
<p><strong>eLua</strong> authors can be contacted at:</p><p><strong>Bogdan Marinescu:</strong> bogdan dot marinescu at gmail dot com</p>
<p><strong>Dado Sutter:</strong> dadosutter at gmail dot com</p>&nbsp; <br>&nbsp; &nbsp;You are also welcome to share your questions and suggestions on our <a href="comunity.html#lists">Mail Discussion List</a>
<p></p><a name="license"></a>
<h3>License</h3>
<div class="content">
<p><strong>eLua</strong> is Open Source and is freely
distributed under the GPL (migrating to BSD soon) licence.</p>
<p>The Lua code (with slight modifications) is included in the
source
tree and is, of course, licensed under the same MIT license that Lua
uses.</p>
<p>The terms of each of these licences can be viewed on their own
pages at:</p>
<p><a target="_top" href="http://en.wikipedia.org/wiki/GNU_General_Public_License">GPL
Licence</a></p>
<p><a target="_top" href="http://en.wikipedia.org/wiki/BSD_license#Terms">BSD
Licence</a></p>
<p><a target="_top" href="http://en.wikipedia.org/wiki/MIT_License">MIT
Licence</a></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p></p><p><a href="http://en.wikipedia.org/wiki/MIT_License"></a></p>
</div>
</body></html>

View File

@ -0,0 +1,17 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body style="background-color: rgb(255, 255, 255);">
<h3><a name="over"></a>eLua Platform Dependent
Modules</h3>
<br>
<br>
<br>
<br>
<br>
<br>
</body></html>

View File

@ -0,0 +1,17 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body style="background-color: rgb(255, 255, 255);">
<h3><a name="over"></a>eLua Platform Dependent
Modules</h3>
<br>
<br>
<br>
<br>
<br>
<br>
</body></html>

135
doc/pt/pwm_ref.html Normal file
View File

@ -0,0 +1,135 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body style="background-color: rgb(255, 255, 255);">
<h3><a name="over"></a>pwm</h3>
<span style="font-weight: bold;"></span><br>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">It allows Lua to
use the PWM blocks on the target CPU.</font>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><strike><a name="setup"></a>[pwm.setup]</strike>(</font><font face="Bitstream Vera Sans Mono, sans-serif">pwm.setup( id,
frequency, Active Cycle ) &nbsp; &nbsp; &nbsp;</font><font face="Bitstream Vera Sans Mono, sans-serif">
Data = pwm.setup( id, frequency, duty ): sets the PWM block 'id' to
generate the specified frequency with the specified duty cycle (duty is
an integer number from 0 to 100, specifying the duty cycle in
percents). It returns the actual frequency set on the PWM block.</font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> Here there is a bigger
change on the proposal.
</p>
<p style="margin-bottom: 0in;"> The Timer Clock and the
PWM "frame" frequency would be set up in the same function (.setup)
</p>
<p style="margin-bottom: 0in;"> The normal control
function would only set the active cicle (.setcycle)
</p>
<p style="margin-bottom: 0in;"> The original .setup
function would then be replaced by:
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">[pwm.setup( id,
tmrclock, pwm_frequency )</font> ]<br>
</p>
<p style="margin-bottom: 0in;"> <a name="setcycle"></a>[pwm.setcycle(
id, active_cycle )]</p>
<p style="margin-bottom: 0in;"><font face="Bitstream Vera Sans Mono, sans-serif"><a name="start"></a>[pwm.start()]&nbsp;&nbsp;
pwm.start( id ): start the PWM block 'id'.</font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="stop"></a>[</font><font face="Bitstream Vera Sans Mono, sans-serif">pwm.stop()]&nbsp;&nbsp;&nbsp;
</font><font face="Bitstream Vera Sans Mono, sans-serif">pwm.stop(
id ): stop the PWM block 'id'.</font>
</p>
<br>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="setclock"></a>Data = pwm.setclock( id, clock ):
set the base clock of the PWM block 'id' to</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">the given clock.
In returns the actual clock set on the PWM block.</font>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">[</font><font face="Bitstream Vera Sans Mono, sans-serif"><strike>pwm.getclock</strike>]
</font><font face="Bitstream Vera Sans Mono, sans-serif">Data
= pwm.getclock( id ): returns the base clock of the PWM block 'id'.</font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> Is it really necessary to
have
.getclock ?? The clock is set by the same program, is seldom changed
during operation, ..........
</p>
<p style="margin-bottom: 0in;"> If really needed, it could
be something like pwm.gettimerclock(id) or something (must be
discussed.....)
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<p style="margin-bottom: 0in;"> <br>
</p>
<big><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br style="font-family: Helvetica,Arial,sans-serif;">
<br style="font-family: Helvetica,Arial,sans-serif;">
<br style="font-family: Helvetica,Arial,sans-serif;">
<span style="font-family: Helvetica,Arial,sans-serif;">
&nbsp;
</span></big> <br>
<br style="font-family: Verdana;">
</body></html>

806
doc/pt/refman.html Normal file
View File

@ -0,0 +1,806 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><meta http-equiv="Content-Language" content="en-us"><title>Product</title><link rel="stylesheet" type="text/css" href="../style.css"></head>
<body style="background-color: rgb(255, 255, 255);">
<h3>eLua Modules Reference Manual
</h3>
<h2><a name="genericmodules"></a>eLua Generic
Modules</h2>A Generic eLua Module is a module that can be used&nbsp;by a Lua program running on any of the <a href="status.html#platforms">supported eLua platforms</a>.<br>Write your code once and it is already automatically ported to the main platforms of the embedded world.<br><br><br><br><br><br><br><br><br><br><h3><a name="bitmodule"></a>bit</h3>
Bitwise&nbsp;operations in eLua is implemented thru
the&nbsp;BitLib library, from Reuben Thomas.<br>
BitLib project is hosted at LuaForge on
<a href="http://luaforge.net/projects/bitlib" target="_top">http://luaforge.net/projects/bitlib</a><br>
<p class="MsoNormal" style="font-family: Verdana;"><a name="bit_bnot"></a>Res = bit.bnot( value )</p>
<p class="MsoNormal" style="font-family: Verdana;">
unary negation
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="bit_band"></a> Res = bit.band( v1, v2, ... )</p>
<p class="MsoNormal" style="font-family: Verdana;"><b>bitwise
</b>"and"
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="bit_bor"></a> Res = bit.bor( v1, v2, ... )</p>
<p class="MsoNormal" style="font-family: Verdana;"><span style="font-weight: bold;">&nbsp;</span><b class="info" style="font-weight: bold;">bitwise</b><b class="info" style="font-weight: bold;">
</b><span class="info" style="font-weight: bold;">"or"</span>
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="bit_bxor"></a> Res = bit.bxor( v1, v2, ... )</p>
<p class="MsoNormal" style="font-family: Verdana;">
<b>bitwise</b><b> </b>"exclusive or"
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="bit_lshift"></a> Res = bit.lshift( value, pos )</p>
<p class="MsoNormal" style="font-family: Verdana;">
shift "value" left "pos" positions.
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="bit_rshift"></a> Res = bit.rshift( value, pos )</p>
<p class="MsoNormal" style="font-family: Verdana;">
shift "value" right "pos" positions. The sign is not propagated.
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="bit_arshift"></a> Res = bit.arshift( value, pos )</p>
<p class="MsoNormal" style="font-family: Verdana;">
shift "value" right "pos" positions. The sign is propagated
("arithmetic shift").
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="bit_bit"></a> Res = bit.bit( bitno )</p>
<p class="MsoNormal" style="font-family: Verdana;">
a shortcut for bit.lshift( 1, bitno )
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="bit_set"></a> Res1, Res2, ... = bit.set( bitno, v1,
v2, ... )</p>
<p class="MsoNormal" style="font-family: Verdana;">
set the bit at position "bitno" in v1, v2, ... to 1.
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="bit_clear"></a> Res1, Res2, ... = bit.clear( bitno,
v1, v2, ... )</p>
<p class="MsoNormal" style="font-family: Verdana;">
set the bit at position "bitno"in v1, v2, ... to 0.
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="bit_isset"></a> Res = bit.isset( value, bitno )</p>
<p class="MsoNormal" style="font-family: Verdana;">
returns true if bit at position "bitno" in "value" is 1, false
otherwise.
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="bit_isclear"></a> Res = bit.isclear( value, bitno )</p>
<p class="MsoNormal" style="font-family: Verdana;">
returns true if bit at position "bitno" in "value" is 0, false
otherwise.
</p>
<br style="font-family: Verdana;">
<br style="font-family: Verdana;">
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<h3><a name="cpumodule"></a>cpu</h3>
<p class="MsoNormal" style="font-family: Verdana;"><br>
</p>
<p style="margin-bottom: 0in;"> </p>
<font face="Bitstream Vera Sans Mono, sans-serif"><a name="cpu_write32"></a>write32( address, data ) : write
the 32-bit data at the specified address</font>
<p style="margin-bottom: 0in;"></p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="cpu_write16"></a>write16( address, data ) : write
the 16-bit data at the specified address</font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="cpu_write8"></a>write8( address, data ) : write the
8-bit data at the specified address</font> <br>
</p>
<p style="margin-bottom: 0in;"><br>
</p>
<br>
<font face="Bitstream Vera Sans Mono, sans-serif"><a name="cpu_read32"></a>Data =&nbsp;read32( address ) :
reads 32-bit data from the specified address</font>
<p style="margin-bottom: 0in;"></p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="cpu_read16"></a>Data = read16( address ) : reads
16-bit data from the specified address</font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="cpu_read8"></a>Data = read8( address ) : reads 8-bit
data from the specified address</font></p>
<p style="margin-bottom: 0in;"><br>
</p>
<br>
<p style="margin-bottom: 0in;"><a name="cpu_disableinterrupts"></a>
[cpu.disableinterrupts()]&nbsp;&nbsp; <font face="Bitstream Vera Sans Mono, sans-serif">cli(): disable
CPU interrupts</font>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"><a name="cpu_enableinterrupts"></a>
[cpu.enableinterrupts()]&nbsp;&nbsp; <font face="Bitstream Vera Sans Mono, sans-serif">sei(): enable
CPU interrupts</font>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><br>
</font></p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="cpu_clockfrequency"></a>[cpu.clockfrequency()]&nbsp;&nbsp;&nbsp;&nbsp;
Clock = clock(): returns the CPU frequency</font>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">Also, you can
expose as many CPU constants (for example memory mapped registers)</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">as you want to
this module. You might want to use this feature to access some </font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">CPU memory areas
(as defined in the CPU header files from the CPU support </font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">package)
directly from Lua. To do this, you'll need to define the </font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">PLATFORM_CPU_CONSTANTS
macro in the platform's platform_conf.h file </font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">(src/platform/&lt;platform
name&gt;/platform_conf.h). Include all your constants in a </font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">_C(
&lt;constant name&gt; ) definition, and then build your project.</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">For example,
let's suppose that your CPU's interrupt controler has 3 memory</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">mapped
registers: INT_REG_ENABLE, INT_REG_DISABLE and INT_REG_MASK. If you want</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">to access them
from Lua, locate the header that defines the values of these</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">registers (I'll
assume its name is "cpu.h") and add these lines to the</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">platform_conf.h:</font>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">#include "cpu.h"</font>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">#define
PLATFORM_CPU_CONSTANTS\</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">_C(
INT_REG_ENABLE ),\</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">_C(
INT_REG_DISABLE ),\</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">_C( INT_REG_MASK
)</font>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">After this
you'll be able to access the regs directly from Lua, like this:</font>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">data = cpu.r32(
cpu.INT_REG_ENABLE )</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">cpu.w32(
cpu.INT_REG_ENABLE, data )</font>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">For a
"real-life" example, see the src/platform/lm3s/platform_conf.h file.</font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">[uart.sendstring]
uart.sendstr( id, str1, str2, ... ): this is similar to "uart.send",
but its parameters are string.&nbsp;</font>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> </p>
<h3><a name="gpiomodule">pio</a></h3>
<p class="MsoNormal" style="font-family: Verdana;">
<b>pio</b></p><p class="MsoNormal" style="font-family: Verdana;">Programable Input Output Module</p><p class="MsoNormal" style="font-family: Verdana;">Some notes on PIO:</p><ul><li>pio: only
some platform have internal pullups for the pio pins, while Cortex is
the only platform that also provides pulldowns for its pios. However,
in this case you're safe, as eLua will signal an error if you try to
execute a pullup operatin on a platform that does not support it.</li></ul><p class="MsoNormal" style="font-family: Verdana;">
</p>
<br>
<p class="MsoNormal" style="font-family: Verdana;"><a name="gpio_setpinvalue"></a> [pio.setpinvalue] pio.setpin(
value, Pin1, Pin2 ... ): set the value to all the pins in the list
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp; to "value" (0 or 1).
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="gpio_setpinhigh"></a> [pio.setpinhigh] pio.set(
Pin1, Pin2, ... ): set the value of all the pins in the list to 1.
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="gpio_getpinvalue"></a> [pio.getpinvalue] Val1, Val2,
... = pio.get( Pin1, Pin2, ... ): reads one or more pins and returns
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp; their values (0 or 1).
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="gpio_setpinlow"></a> [pio.setpinlow] pio.clear(
Pin1, Pin2, ... ): set the value of all the pins in the list to 0.
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="gpio_configpin"></a> [pio.configpin(pio.DIR, pio.DIR_INPUT)] pio.input( Pin1, Pin2, ... ): set the specified pin(s)
as input(s).
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;">
[pio.configpin(pio.DIR, pio.DIR_OUTPUT)] pio.output( Pin1, Pin2, ...
): set the specified pin(s) as output(s).
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="gpio_setportvalue"></a> [pio.setportvalue]
pio.setport( value, Port1, Port2, ... ): set the value of all the ports
in the
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp; list to "value".
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="gpio_getportvalue"></a> [pio.getportvalue] Val1,
Val2, ... = pio.getport( Port1, Port2, ... ): reads one or more ports
and
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp; returns their values.
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="gpio_getportname"></a> [pio.getportname]
Port = pio.port( code ): return the physical port number associated
with the given code. For example, "pio.port( pio.P0_20 )" will return
0.
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;"><a name="gpio_getpinnumber"></a> [pio.getpinnumber] Pin =
pio.pin( code ): return the physical pin number associated with the
</p>
<p class="MsoNormal" style="font-family: Verdana;">
given code. For example, "pio.pin( pio.P0_20 )" will return 20.
</p>
<br>
<a name="gpio_togglepin"></a>[pio.togglepin([Pin1],
[Pin2], ...)]<br>
<br>
<a name="gpio_toogleport"></a>[pio.toggleport([Port1],
[Port2], ...)]<br style="font-family: Verdana;">
<br>
Another idea (can be added to the above ?)<br>
[pio.configport(pio.[FUNCTION], pio.MASK, [MASK])]<br>
Ex:<br>
&nbsp; pio.configpin(pio.DIR, pio.DIR_INPUT)&nbsp;&nbsp;&nbsp; (.DIR_OUTPUT)<br>
&nbsp; pio.configpin(pio.PULL, pio.PULL_UP)&nbsp;&nbsp;&nbsp;&nbsp; (.PULL_DOWN,
PULL_NO)<br style="font-family: Verdana;">
<br>
<p class="MsoNormal" style="font-family: Verdana;">
[pio.configport(pio.DIR, pio.DIR_INPUT, [Port1], [Port2], ...)]
pio.port_input( Port1, Port2, ... ): set the specified port(s) as
input(s).
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;">
[pio.configport(pio.DIR, pio.DIR_OUTPUT, [Port1], [Port2], ...)]
pio.port_output( Port1, Port2, ... ): set the specified port(s) as
output(s).
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;">
[pio.configpin(pio.PULL, pio.PULL_UP, [Pin1], [Pin2], ...)]
pio.pullup( Pin1, Pin2, ... ): enable internal pullups on the specified
pins.Note that some CPUs might not provide this feature.
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;">
[pio.configpin(pio.PULL, pio.PULL_DOWN, [Pin1], [Pin2], ...)]
pio.pulldown( Pin1, Pin2, ... ): enable internal pulldowns on the
specified pins. Note that some CPUs might not provide this feature.
</p>
<p class="MsoNormal" style="font-family: Verdana;">
&nbsp;
</p>
<p class="MsoNormal" style="font-family: Verdana;">
[pio.configpin(pio.PULL, pio.PULL_NO, [Pin1], [Pin2], ...)]
pio.nopull( Pin1, Pin2, ... ): disable the pullups/pulldowns on the
specifiedpins. Note that some CPUs might not provide this feature.
</p>
<br>
<h3><a name="netmodule"></a>net</h3>
<br>
<h3><a name="pwmmodule"></a>pwm</h3>
<span style="font-weight: bold;"></span><br>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">It allows Lua to
use the PWM blocks on the target CPU.</font>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><strike><a name="pwm_setup"></a>[pwm.setup]</strike>(</font><font face="Bitstream Vera Sans Mono, sans-serif">pwm.setup( id,
frequency, Active Cycle ) &nbsp; &nbsp; &nbsp;</font><font face="Bitstream Vera Sans Mono, sans-serif">
Data = pwm.setup( id, frequency, duty ): sets the PWM block 'id' to
generate the specified frequency with the specified duty cycle (duty is
an integer number from 0 to 100, specifying the duty cycle in
percents). It returns the actual frequency set on the PWM block.</font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> Here there is a bigger
change on the proposal.
</p>
<p style="margin-bottom: 0in;"> The Timer Clock and the
PWM "frame" frequency would be set up in the same function (.setup)
</p>
<p style="margin-bottom: 0in;"> The normal control
function would only set the active cicle (.setcycle)
</p>
<p style="margin-bottom: 0in;"> The original .setup
function would then be replaced by:
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">[pwm.setup( id,
tmrclock, pwm_frequency )</font> ]<br>
</p>
<p style="margin-bottom: 0in;"> <a name="pwm_setcycle"></a>[pwm.setcycle(
id, active_cycle )]</p>
<p style="margin-bottom: 0in;"><font face="Bitstream Vera Sans Mono, sans-serif"><a name="pwm_start"></a>[pwm.start()]&nbsp;&nbsp;
pwm.start( id ): start the PWM block 'id'.</font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="pwm_stop"></a>[</font><font face="Bitstream Vera Sans Mono, sans-serif">pwm.stop()]&nbsp;&nbsp;&nbsp;
</font><font face="Bitstream Vera Sans Mono, sans-serif">pwm.stop(
id ): stop the PWM block 'id'.</font>
</p>
<br>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="pwm_setclock"></a>Data = pwm.setclock( id, clock ):
set the base clock of the PWM block 'id' to</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">the given clock.
In returns the actual clock set on the PWM block.</font>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">[</font><font face="Bitstream Vera Sans Mono, sans-serif"><strike>pwm.getclock</strike>]
</font><font face="Bitstream Vera Sans Mono, sans-serif">Data
= pwm.getclock( id ): returns the base clock of the PWM block 'id'.</font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<h3><a name="spimodule"></a>spi</h3>
<span style="font-weight: bold;"></span><br>
<big><span style="font-family: Helvetica,Arial,sans-serif;"></span><font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big><a name="spi_setup"></a>Actual_clock = spi.setup( id,
spi.MASTER | spi.SLAVE, clock, cpol, cpha,</big></font><span style="font-family: Helvetica,Arial,sans-serif;">
</span><br style="font-family: Helvetica,Arial,sans-serif;">
<span style="font-family: Helvetica,Arial,sans-serif;">
&nbsp; </span><font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>databits):
set the SPI interface with the given parameters, returns the clock</big></font><span style="font-family: Helvetica,Arial,sans-serif;">
</span><br style="font-family: Helvetica,Arial,sans-serif;">
<span style="font-family: Helvetica,Arial,sans-serif;">
&nbsp; </span><font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>that
was set for the interface.</big></font><span style="font-family: Helvetica,Arial,sans-serif;">
</span><br style="font-family: Helvetica,Arial,sans-serif;">
<span style="font-family: Helvetica,Arial,sans-serif;">
&nbsp;
</span><br style="font-family: Helvetica,Arial,sans-serif;">
<font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big><a name="spi_select"></a>spi.select(
</big></font><font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>id</big></font><font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>
): sets the selected spi as active (sets the SS line of the given
interface).</big></font><span style="font-family: Helvetica,Arial,sans-serif;">
</span><br style="font-family: Helvetica,Arial,sans-serif;">
<font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>&nbsp;</big></font><span style="font-family: Helvetica,Arial,sans-serif;">
</span><br style="font-family: Helvetica,Arial,sans-serif;">
<font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big><a name="spi_unselect"></a>spi.unselect(
id ): clears the SS line of the given interface.</big></font><span style="font-family: Helvetica,Arial,sans-serif;">
</span><br style="font-family: Helvetica,Arial,sans-serif;">
<font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>&nbsp;</big></font><span style="font-family: Helvetica,Arial,sans-serif;">
</span><br style="font-family: Helvetica,Arial,sans-serif;">
<font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big><a name="spi_send"></a>spi.send(
id, Data1, Data2, ... ): sends all the data to the specified SPI</big></font><span style="font-family: Helvetica,Arial,sans-serif;">
</span><br style="font-family: Helvetica,Arial,sans-serif;">
<span style="font-family: Helvetica,Arial,sans-serif;">
&nbsp; </span><font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>interface.</big></font><span style="font-family: Helvetica,Arial,sans-serif;">
</span><br style="font-family: Helvetica,Arial,sans-serif;">
<span style="font-family: Helvetica,Arial,sans-serif;">
&nbsp;
</span><br style="font-family: Helvetica,Arial,sans-serif;">
<font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big><a name="spi_sendrecv"></a>[</big></font><font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>spi.sendrecv(</big></font><font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>id,
Out1, Out2, ...</big></font><font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>)]&nbsp;&nbsp;&nbsp;&nbsp;
</big></font><font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>In1,
In2, ... = spi.send_recv( id, Out1, Out2, ... ): sends all the "out"
bytes</big></font><span style="font-family: Helvetica,Arial,sans-serif;"> </span><font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>to
the specified SPI interface and returts the data read after each sent
byte.</big></font><span style="font-family: Helvetica,Arial,sans-serif;">
</span><br style="font-family: Helvetica,Arial,sans-serif;">
<br style="font-family: Helvetica,Arial,sans-serif;">
<font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>Returning
several values in this blocking way would not complicate some queued
send implementations ? (ok, this could be another function :)</big></font><span style="font-family: Helvetica,Arial,sans-serif;">
</span><br style="font-family: Helvetica,Arial,sans-serif;">
<br style="font-family: Helvetica,Arial,sans-serif;">
<font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>Sending multiple data/chars in a single
call and not in
a table argument does not allow the data to be built in run time
(without some string massage, of course :)</big></font><br>
<br>
<br>
<br>
</big>
<h3><a name="sysmodule"></a>sys</h3>
<br>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="sys_platform"></a>[sys.platform()]&nbsp;&nbsp;&nbsp;
pd.platform(): returns the platform name (f.e. LM3S)</font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="sys_mcu"></a>[sys.mcu()]&nbsp;&nbsp;&nbsp;
pd.cpu(): returns the CPU name (f.e. LM3S8962)</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="sys_cpu"></a>[sys.cpu()]&nbsp;&nbsp;&nbsp;
would return ARM Cortex M3 in this case.....</font></p>
<p style="margin-bottom: 0in;"><font face="Bitstream Vera Sans Mono, sans-serif"><br>
</font></p>
<font face="Bitstream Vera Sans Mono, sans-serif">&nbsp;&nbsp;<a name="sys_board"></a>[sys.board()]</font><font face="Bitstream Vera Sans Mono, sans-serif">&nbsp;
pd.board(): returns the CPU board (f.e. EK-LM3S8962)</font>
<p style="margin-bottom: 0in;"> <br>
</p>
<h3><a name="term_termmodule">term</a></h3>
&nbsp; &nbsp;Terminal support
<p> <a name="term_clear"></a>[term.clear]
term.clrscr(): clear the screen </p>
<p> &nbsp; <br>
<a name="term_cleareol"></a>[term.cleareol]
term.clreol(): clear from the current cursor position to the end of the
line </p>
<p> &nbsp; </p>
<p><a name="term_moveto"></a> [term.moveto]
term.gotoxy( x, y ): position the cursor at the given coordinates<br>
</p>
<br>
<p><a name="term_moveup"></a> [term.moveup]
term.up( delta ): move the cursor up "delta" lines </p>
<p> &nbsp; </p>
<p><a name="term_movedown"></a> [term.movedown]
term.down( delta ): move the cursor down "delta" lines </p>
<p> &nbsp; </p>
<p><a name="term_moveleft"></a> [term.moveleft]
term.left( delta ): move the cursor left "delta" lines </p>
<p> &nbsp; <br>
<a name="term_moveright"></a>[term.moveright] term.right(
delta ): move the cursor right "delta" lines </p>
<p> &nbsp; </p>
<p><a name="term_getlinecount"></a>
[term.getlinecount] Lines = term.lines(): returns the number of lines </p>
<p> &nbsp; </p>
<p><a name="term_getcolcount"></a>
[term.getcolcount] Cols = term.cols(): returns the number of columns </p>
<p> &nbsp; </p>
<br>
<p><a name="term_printstr"></a> [term.printstr]
term.putstr( s1, s2, ... ): writes the specified string(s) to the
terminal<br>
</p>
<p> </p>
<p> [term.printchar] term.put( c1, c2, ... ): writes the
specified character(s) to the terminal </p>
<p>&nbsp; </p>
<p><a name="term_getx"></a> [term.getx] Cx =
term.cursorx(): return the cursor X position </p>
<p> &nbsp; </p>
<p> <a name="term_gety"></a>[term.gety] Cy =
term.cursory(): return the cursor Y position </p>
<p> &nbsp; </p>
<p> <font size="2"><a name="term_inputchar"></a>[term.inputchar]
c = term.getch( term.WAIT | term.NOWAIT ): returns a char read from the
</font> </p>
<font size="2">&nbsp; terminal.</font>
<br style="font-family: Verdana;">
<br>
<br>
<h3><a name="tmr_tmrmodule"></a>tmr</h3>
<span style="font-weight: bold;"></span><big><br>
</big>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">It allows Lua to
execute timer specific operations (delay, read timer value,</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">start timer, get
time difference).</font></p><p style="margin-bottom: 0in;"><font face="Bitstream Vera Sans Mono, sans-serif">Some notes on timers:</font></p><ul><li>timers: from all the platforms on which eLua runs, only
the Luminary Cortex CPUs has rock solid 32-bit timers. You can do
pretty much everything you need with them. All the other platforms have
16-bit timers, which imposes some limits on the range of delays you can
achieve with them. Make sure to use tmr.mindelay(id) and
tmr.maxdelay(id) to check the actual resolution of your timers, and
adapt your code accordingly. To 'compensate' for this, it's not
possible to change the base timer frequency on the Cortex CPUs, but it
is possible on most other platforms :) So be sure to also check the
result of tmr.setclock(id)</li><li>also, when using timers,
remember that if you're using XMODEM and/or the "term" module, TMR0 is
used by both of them. So, if you change the TMR0 base clock in your
code, be sure to restore the original setting before returning to the
shell. You can change this static timer assignment by modifying
src/main.c. It might also be possible to change it dynamically in the
future, although I see little use for this.</li><li>PWM: the
Cortex CPUs have 6 PWM channels, but channels 0/1, 2/3 and 4/5
respectively share the same base clock setting. So, when you're
changing the base clock for channel 1, you're also changing the base
clock for channel 0; if channel 0 was already running, you won't like
what will happen next. This time no eLua function can save you, you
simply need you know your CPU architecture.</li></ul><p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="tmr_delay"></a>tmr.delay( id, delay ): uses timer
'id' to wait for 'delay' us.</font>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><span style="font-style: italic;"><a name="tmr_read"></a></span>Data
= tmr.read( id ): reads the value of timer 'id'. The returned value is </font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">platform
dependent.</font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><span style="font-style: italic;"><a name="tmr_start"></a></span>Data
= tmr.start( id ): start the timer 'id', and also returns its value at</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">the moment of
start. The returned value is platform dependent.</font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="tmr_diff"></a>diff
= tmr.diff( id, end, start ): returns the time difference (in us)
between</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">the timer values
'end' and 'start' (obtained from calling tmr.start or</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">tmr.read). The
order of end/start is irrelevant. </font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="tmr_mindelay"></a>Data = tmr.mindelay( id ): returns
the minimum delay (in us ) that can be </font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">achieved by
calling the tmr.delay function. If the return value is 0, the </font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">platform layer
is capable of executing sub-microsecond delays.</font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="tmr_maxdelay"></a>Data = tmr.maxdelay( id ): returns
the maximum delay (in us) that can be</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">achieved by
calling the tmr.delay function.</font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="tmr_setclock"></a>Data = tmr.setclock( id, clock ):
sets the clock of the given timer. Returns the</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">actual clock set
for the timer.</font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="tmr_getclock"></a>Data = tmr.getclock( id ): return
the clock of the given timer.</font>
</p>
<br>
<br>
<br>
<br>
<br>
<h3><a name="uartmodule"></a>uart</h3>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="uart_setup"></a><span style="font-weight: bold;">uart.setup(</span></font><font style="font-weight: bold;" face="Bitstream Vera Sans Mono, sans-serif"> id, baud,
databits, </font>
</p><p style="margin-bottom: 0in; font-weight: bold;"> <font face="Bitstream Vera Sans Mono, sans-serif">uart.PARITY_EVEN
| uart.</font><font face="Bitstream Vera Sans Mono, sans-serif">PARITY</font><font face="Bitstream Vera Sans Mono, sans-serif">_ODD | uart.</font><font face="Bitstream Vera Sans Mono, sans-serif">PARITY</font><font face="Bitstream Vera Sans Mono, sans-serif">_NONE, </font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><span style="font-weight: bold;">uart.STOPBITS_1
| uart.STOPBITS_1_5 | uart.STOPBITS_2
)</span></font></p>
<p style="margin-bottom: 0in;"><font face="Bitstream Vera Sans Mono, sans-serif"><span style="font-weight: bold;"></span>&nbsp;&nbsp;&nbsp; Set the UART interface with the&nbsp;given
parameters.</font></p><p style="margin-bottom: 0in;"><font face="Bitstream Vera Sans Mono, sans-serif">&nbsp;&nbsp;&nbsp; Returns the actual baud rate that was set for the UART.</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><br>
</font></p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="uart_send"></a></font><font face="Bitstream Vera Sans Mono, sans-serif"><span style="font-weight: bold;">uart.send( id,
Data1, Data2, ... )</span></font></p><p style="margin-bottom: 0in;"><font face="Bitstream Vera Sans Mono, sans-serif"><span style="font-weight: bold;"></span>&nbsp;&nbsp;&nbsp; Send all the data to the specified UART interface.</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><br>
</font></p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="uart_recv"></a></font><font face="Bitstream Vera Sans Mono, sans-serif">uart.recv(</font><font face="Bitstream Vera Sans Mono, sans-serif"> id,
uart.TIMEOUT_NO | <strike>uart.TIMEOUT_INFINITE</strike> |
timeout )</font><font face="Bitstream Vera Sans Mono, sans-serif">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font face="Bitstream Vera Sans Mono, sans-serif">Data =
uart.recv( id, uart.NO_TIMEOUT | uart.INF_TIMEOUT | timeout )</font></p>
<p style="margin-bottom: 0in;"><font face="Bitstream Vera Sans Mono, sans-serif">&nbsp;&nbsp;&nbsp; Reads a byte from the
specified UART interface.</font></p>
<p style="margin-bottom: 0in;"></p>
<p style="margin-bottom: 0in;">
</p>
<h2><a name="platdepmodules"></a>eLua Platform
Dependent
Modules</h2>A Platform Dependent eLua Module is a module that runs only on one or on a few <a href="status.html#platforms">supported eLua platforms</a>.<br>These
modules make use of specifical devices and features offered by some
kits and allow eLua aplications to make the best use of the external
hardware on your platforms.<br><h3><a name="adcmodule"></a>adc&nbsp; -&nbsp;Analog to Digital Conversion Module</h3><span style="font-weight: bold;">Currently runs on:</span> LM3Sxxxx<br><br>&nbsp;&nbsp;&nbsp; The ADC module handles the Analog to Digital Conversion Peripherals.<br><br><br><a name="adc_sample"></a><span style="font-weight: bold;">adc.sample(channel_id)</span><br>&nbsp;&nbsp;&nbsp; Generate one processed sample.<br><br><br><a name="adc_getsamples"></a><span style="font-weight: bold;">adc.getsamples(channel_id,
[count])</span><br>&nbsp;&nbsp;&nbsp; Request&nbsp;<span style="font-style: italic;">count</span> samples from the buffer.<br>&nbsp;&nbsp;&nbsp; if singular, an
integer is returned. &nbsp;if multiple, a table of integers is returned. &nbsp;If
<span style="font-style: italic;">count</span> is either zero or omitted, all available samples are returned.<br><br><br><a name="adc_maxval"></a><span style="font-weight: bold;">adc.maxval(channel_id)</span><br>&nbsp;&nbsp;&nbsp; Returns the largest integer one can expect fromr this channel on a given platform (based on bit depth).<br><br><br><a name="adc_samplesready"></a><span style="font-weight: bold;">adc.samplesready(channel_id)<br></span>&nbsp;&nbsp;&nbsp; Returns the number of samples waiting in the buffer.<br><br><br><a name="adc_dataready"></a><span style="font-weight: bold;">adc.dataready(channel_id)<br></span>&nbsp;&nbsp;&nbsp; If running in non-blocking mode, this will indicate if all of the
samples requested from the last sample or <br>burst have been acquired and
are waiting in the buffer.<br><br><br><a name="adc_setmode"></a><span style="font-weight: bold;">adc.setmode(channel_id,
mode)<br></span>&nbsp;&nbsp;&nbsp; <span style="font-style: italic;">mode</span> 0 sets&nbsp;blocking mode. adc.getsamples will wait for
requested samples to be captured before returning.<br>&nbsp;&nbsp;&nbsp; <span style="font-style: italic;">mode</span> 1 sets non-blocking mode<br><br><br><a name="adc_setsmoothing"></a><span style="font-weight: bold;">adc.setsmoothing(channel_id, length)<br></span>&nbsp;&nbsp;&nbsp; Set the length of the smoothing filter.<br>&nbsp;&nbsp;&nbsp; This must be a power of 2 (maximum = 128)<br><br><br><a name="adc_getsmoothing"></a><span style="font-weight: bold;">adc.getsmoothing(channel_id)<br></span>&nbsp;&nbsp;&nbsp; Get the current smoothing length in use.<br><br><br><a name="adc_burst"></a><span style="font-weight: bold;">adc.burst(
channel_id, count, timer_id, frequency)<br></span>&nbsp;&nbsp;&nbsp; Request that&nbsp;<span style="font-style: italic;">count</span> samples&nbsp;be converted from&nbsp;<span style="font-style: italic;">channel_id</span>, using&nbsp;<span style="font-style: italic;">timer_id</span> at&nbsp;<span style="font-style: italic;">frequency.<br></span>&nbsp;&nbsp;&nbsp; <span style="font-style: italic;">count </span>must be greater than zero and a power of 2<br><br><br>
<h3><a name="dispmodule"></a>disp</h3>
<span style="font-weight: bold;">Currently runs on:</span> LM3Sxxxx<br><br>&nbsp;&nbsp;&nbsp; The disp module handles the RIT OLED display usage on Luminary Micro Cortex-M3 boards<br>
<p class="MsoNormal"></p><p class="MsoNormal"><a name="disp_init"></a><span style="font-weight: bold;">
disp.init( freq )</span></p><p class="MsoNormal">freq specifies the SSI Clock Frequency to be used.<br><br>This function initializes the SSI interface to the OLED display and configures the SSD1329 controller on the panel.<br></p><br><p class="MsoNormal"><a name="disp_enable"></a>
<span style="font-weight: bold;">disp.enable()</span> </p>
<p class="MsoNormal">Enable the SSI component of the OLED display driver.<br></p><p class="MsoNormal">freq specifies the SSI Clock Frequency to be used.<br>This function initializes the SSI interface to the OLED display.</p><p class="MsoNormal">
</p>
<p class="MsoNormal"><a name="disp_disable"></a>
<span style="font-weight: bold;">disp.disable()</span> </p>
<p class="MsoNormal"> <br>
</p>
<p class="MsoNormal"> <a name="disp_on"></a><span style="font-weight: bold;">disp.on()</span>
</p>
<p class="MsoNormal"> &nbsp;Turns on the OLED display.<br>&nbsp;This function will turn on the OLED display, causing it to display the contents of its internal frame buffer.<br><br>
</p>
<p class="MsoNormal"><a name="disp_off"></a>
<span style="font-weight: bold;">disp.off</span>()</p><p class="MsoNormal">Turns off the OLED display<br>This
function will turn off the OLED display.&nbsp; This will stop the
scanning of the panel and turn off the on-chip DC-DC converter,
preventing damage to&nbsp;the panel due to burn-in (it has similar
characters to a CRT in this&nbsp;respect).<br><br></p>
<p class="MsoNormal"><a name="disp_clear"></a>
<span style="font-weight: bold;">disp.clear()</span></p><p class="MsoNormal">Clears the OLED display.<br>This function will clear the display RAM.&nbsp; All pixels in the display will be turned off.<br></p>
&nbsp; &nbsp;<a name="disp_print"></a><span style="font-weight: bold;">disp.print( str, x, y, gray )</span><br><br>Displays a string on the OLED display.<br><br>Calling Arguments:<br>str is a string to be displayed.<br>x is the horizontal position to display the string, specified in columns from the left edge of the display.<br>y&nbsp;is the vertical position to display the string, specified in rows from the top edge of the display.<br>gray is the 4-bit gray scale (intensity) value to be used for displayed text. <br><br>This
function will draw a string on the display.&nbsp; Only the ASCII
characters between 32 (space) and 126 (tilde) are supported;
other&nbsp;characters will result in random data being draw on the
display (based on whatever appears before/after the font in
memory).&nbsp; The font is mono-spaced, so characters such as ``i'' and
``l'' have more white space around them than characters such as ``m''
or ``w''.<br>If the drawing of the string reaches the right edge of the
display, no more characters will be drawn.&nbsp; Therefore, special
care is not required to avoid supplying a string that is ``too long''
to display.<br><br>Because the OLED display packs 2 pixels of data in a single byte, the<br>parameter \e ulX must be an even column number (for example, 0, 2, 4, and<br>so on).<br><br>
<br>
<p class="MsoNormal"><a name="disp_draw"></a>
<span style="font-weight: bold;">disp.draw( img, x, y, withd, height, gray )</span></p><p class="MsoNormal">Displays an image on the OLED display.<br><br>img a pointer to the string data representing a rit format image to display.<br>x&nbsp;is the horizontal position to display the string, specified in columns from the left edge of the display.<br>y&nbsp;is the vertical position to display the string, specified in rows from the top edge of the display.<br>width is the width of the image, specified in columns.<br>height is the height of the image, specified in rows.<br><br>This
function will display a bitmap graphic on the display.&nbsp; Because of
the format of the display RAM, the starting column x and the number of
columns y must be an integer multiple of two.<br>The image data is
organized with the first row of image data appearing left&nbsp;to
right, followed immediately by the second row of image data.&nbsp; Each
byte&nbsp;contains the data for two columns in the current row, with
the leftmost&nbsp;column being contained in bits 7:4 and the rightmost
column being contained&nbsp;in bits 3:0.<br>For example, an image six
columns wide and seven scan lines tall would&nbsp;be arranged as
follows (showing how the twenty one bytes of the image would appear on
the display):<br><br>Because the OLED display packs 2 pixels of data in
a single byte, the parameter x must be an even column number (for
example, 0, 2, 4, and so on).<span style="font-weight: bold;"></span></p><p class="MsoNormal"><span style="font-family: Courier New;">&nbsp; +-------------------+-------------------+-------------------+</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp;
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Byte
0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Byte 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Byte
2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp; +---------+---------+---------+---------+---------+---------+</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp; | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp;&nbsp;+---------+---------+---------+---------+---------+---------+</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp;
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Byte
3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Byte 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Byte
5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp;&nbsp;+---------+---------+---------+---------+---------+---------+</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp; | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp;&nbsp;+---------+---------+---------+---------+---------+---------+</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp;
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Byte
6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Byte 7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Byte
8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp;&nbsp;+---------+---------+---------+---------+---------+---------+</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp; | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp; +---------+---------+---------+---------+---------+---------+</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp;
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Byte
9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Byte 10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Byte 11&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp; +---------+---------+---------+---------+---------+---------+</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp; | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp; +---------+---------+---------+---------+---------+---------+</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp;
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Byte 12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Byte 13&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Byte 14&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp;&nbsp;+---------+---------+---------+---------+---------+---------+</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp; | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp; +---------+---------+---------+---------+---------+---------+</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp;
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Byte 15&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Byte 16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Byte 17&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp;&nbsp;+---------+---------+---------+---------+---------+---------+</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp; | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp;&nbsp;+---------+---------+---------+---------+---------+---------+</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp;
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Byte 18&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Byte 19&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Byte 20&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp; +---------+---------+---------+---------+---------+---------+</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp; | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |</span><br style="font-family: Courier New;"><span style="font-family: Courier New;">&nbsp; +---------+---------+---------+---------+---------+---------+</span><span style="font-weight: bold;"></span></p><p class="MsoNormal"><span style="font-weight: bold;"></span></p><p class="MsoNormal"><span style="font-weight: bold;"></span> </p>
</body></html>

100
doc/pt/spi_ref.html Normal file
View File

@ -0,0 +1,100 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body style="background-color: rgb(255, 255, 255);">
<h3><a name="over"></a>spi</h3>
<span style="font-weight: bold;"></span><br>
<big><span style="font-family: Helvetica,Arial,sans-serif;"></span><font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big><a name="setup"></a>Actual_clock = spi.setup( id,
spi.MASTER | spi.SLAVE, clock, cpol, cpha,</big></font><span style="font-family: Helvetica,Arial,sans-serif;">
</span><br style="font-family: Helvetica,Arial,sans-serif;">
<span style="font-family: Helvetica,Arial,sans-serif;">
&nbsp; </span><font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>databits):
set the SPI interface with the given parameters, returns the clock</big></font><span style="font-family: Helvetica,Arial,sans-serif;">
</span><br style="font-family: Helvetica,Arial,sans-serif;">
<span style="font-family: Helvetica,Arial,sans-serif;">
&nbsp; </span><font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>that
was set for the interface.</big></font><span style="font-family: Helvetica,Arial,sans-serif;">
</span><br style="font-family: Helvetica,Arial,sans-serif;">
<span style="font-family: Helvetica,Arial,sans-serif;">
&nbsp;
</span><br style="font-family: Helvetica,Arial,sans-serif;">
<font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big><a name="select"></a>spi.select(
</big></font><font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>id</big></font><font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>
): sets the selected spi as active (sets the SS line of the given
interface).</big></font><span style="font-family: Helvetica,Arial,sans-serif;">
</span><br style="font-family: Helvetica,Arial,sans-serif;">
<font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>&nbsp;</big></font><span style="font-family: Helvetica,Arial,sans-serif;">
</span><br style="font-family: Helvetica,Arial,sans-serif;">
<font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big><a name="unselect"></a>spi.unselect(
id ): clears the SS line of the given interface.</big></font><span style="font-family: Helvetica,Arial,sans-serif;">
</span><br style="font-family: Helvetica,Arial,sans-serif;">
<font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>&nbsp;</big></font><span style="font-family: Helvetica,Arial,sans-serif;">
</span><br style="font-family: Helvetica,Arial,sans-serif;">
<font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big><a name="send"></a>spi.send(
id, Data1, Data2, ... ): sends all the data to the specified SPI</big></font><span style="font-family: Helvetica,Arial,sans-serif;">
</span><br style="font-family: Helvetica,Arial,sans-serif;">
<span style="font-family: Helvetica,Arial,sans-serif;">
&nbsp; </span><font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>interface.</big></font><span style="font-family: Helvetica,Arial,sans-serif;">
</span><br style="font-family: Helvetica,Arial,sans-serif;">
<span style="font-family: Helvetica,Arial,sans-serif;">
&nbsp;
</span><br style="font-family: Helvetica,Arial,sans-serif;">
<font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big><a name="sendrecv"></a>[</big></font><font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>spi.sendrecv(</big></font><font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>id,
Out1, Out2, ...</big></font><font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>)]&nbsp;&nbsp;&nbsp;&nbsp;
</big></font><font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>In1,
In2, ... = spi.send_recv( id, Out1, Out2, ... ): sends all the "out"
bytes</big></font><span style="font-family: Helvetica,Arial,sans-serif;"> </span><font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>to
the specified SPI interface and returts the data read after each sent
byte.</big></font><span style="font-family: Helvetica,Arial,sans-serif;">
</span><br style="font-family: Helvetica,Arial,sans-serif;">
<br style="font-family: Helvetica,Arial,sans-serif;">
<font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>Returning
several values in this blocking way would not complicate some queued
send implementations ? (ok, this could be another function :)</big></font><span style="font-family: Helvetica,Arial,sans-serif;">
</span><br style="font-family: Helvetica,Arial,sans-serif;">
<br style="font-family: Helvetica,Arial,sans-serif;">
<font style="font-family: Helvetica,Arial,sans-serif;" size="2"><big>Sending multiple data/chars in a single
call and not in
a table argument does not allow the data to be built in run time
(without some string massage, of course :)</big></font><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br style="font-family: Helvetica,Arial,sans-serif;">
<br style="font-family: Helvetica,Arial,sans-serif;">
<br style="font-family: Helvetica,Arial,sans-serif;">
<span style="font-family: Helvetica,Arial,sans-serif;">
&nbsp;
</span></big> <br>
<br style="font-family: Verdana;">
</body></html>

418
doc/pt/status.html Normal file
View File

@ -0,0 +1,418 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body style="background-color: rgb(255, 255, 255);">
<h3>Current&nbsp;Status of Platforms and Modules Supported</h3>
<p>As already stated, eLua allows you to run Lua completely on
the
microcontroller. A fast-growing set of complementary modules is also
provided, for Lua programming eLua's generic (portable) peripherals. </p>
<p>The following features are ready or being implemented:</p>
<ul>
<li>a (mostly) platform independent peripheral library (PIO,
UART, PWM, SPI, TMR, ADC, NET, I2C...)</li>
<li>a very low footprint embedded rom file system, easy to port
to different types of memory chips and other storage devices</li>
<li>a small FAT rw file system layer for SD cards.</li>
<li>an embedded editor, to edit Lua programs directly via a
serial connection or other input devices</li>
<li>a minimal "shell" (for file operations, environment
configuration and other facilities)</li>
<li>network support</li>
<li>an embedded http server</li>
<li>Terminal / Console over Ethernet</li>
</ul>
<p>Porting eLua to another compatible platform should be as easy
and
painless as possible. Currently this is restricted to platforms for
which the gcc+newlib combo is available. This might change in the
future, but please not that this is not a priority of the project at
this point.</p>
<p>Also, the Lua "core" comes in two flavors: "regular Lua"
(using
floating point as the number type) and "integer Lua" (using integers).
We'll add more about this in a future tutorial
about Lua. For now, it's enough to say that "regular Lua" will be able
to perform floating point operations (but will be slower because the
floating point operations will be emulated in software on the MCU),
while "integer Lua" will only be able to perform operations with
integer numbers (but support for fixed and even floating point can be
added with separate modules) and thus will be faster.</p>
<p></p>
<h3>Symbol Legends</h3>
<table style="width: 325px; height: 169px;" class="table_center">
<tbody>
<tr>
<th style="text-align: center;">Symbol</th>
<th style="text-align: center;">Meaning</th>
</tr>
<tr>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
<td style="text-align: left;">Implemented and tested</td>
</tr>
<tr>
<td style="text-align: center;"><img src="../wb_img/yellowled.png"></td>
<td style="text-align: left;">Implemented, not tested</td>
</tr>
<tr>
<td style="text-align: center;"><img src="../wb_img/ksame.png"></td>
<td style="text-align: left;">Not yet implemented</td>
</tr>
<tr>
<td style="text-align: center;"><img src="../wb_img/agt_action_fail1.png"></td>
<td style="text-align: left;">Not applicable</td>
</tr>
</tbody>
</table><br><br>
<h3>Platforms x Modules Supported</h3>The following table shows the status of <span style="font-weight: bold;">eLua</span>'s modules implementation by
platform.<br><br>
<table style="text-align: left;">
<tbody>
<tr>
<th>Module</th>
<th rowspan="2">PIO</th>
<th rowspan="2">SPI</th>
<th rowspan="2">UART</th>
<th rowspan="2">TMR</th>
<th rowspan="2">PWM</th>
<th rowspan="2">NET</th>
<th rowspan="2">CPU</th>
<th rowspan="2">ADC</th>
</tr>
<tr><td style="color: rgb(255, 102, 0);">MCU</td>
</tr><tr>
<td style="color: rgb(255, 102, 0);">LM3S8962</td>
<td style="text-align: center;"><img style="width: 16px; height: 16px;" alt="Implemented" src="../wb_img/agt_action_success.png"></td>
<td style="text-align: center;"><img style="width: 16px; height: 16px;" alt="Not Tested" src="../wb_img/yellowled.png"></td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
<td style="text-align: center;"><img src="../wb_img/yellowled.png">&nbsp;</td>
</tr>
<tr>
<td style="color: rgb(255, 102, 0);">LM3S6965</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
<td style="text-align: center;"><img src="../wb_img/yellowled.png"></td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
<td style="text-align: center;"><img src="../wb_img/yellowled.png"></td>
<td style="text-align: center;"><img src="../wb_img/yellowled.png"></td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
</tr>
<tr>
<td style="color: rgb(255, 102, 0);">i386</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_fail1.png"></td>
<td style="text-align: center;"><img src="../wb_img/agt_action_fail1.png"></td>
<td style="text-align: center;"><img src="../wb_img/agt_action_fail1.png"></td>
<td style="text-align: center;"><img src="../wb_img/ksame.png"></td>
<td style="text-align: center;"><img style="height: 16px; width: 16px;" alt="Not Implemented" src="../wb_img/agt_action_fail1.png"></td>
<td style="text-align: center;"><img src="../wb_img/ksame.png"></td>
<td style="text-align: center;"><img src="../wb_img/ksame.png"></td>
<td style="text-align: center;"><img style="height: 16px; width: 16px;" alt="Not Implemented" src="../wb_img/agt_action_fail1.png"></td>
</tr>
<tr>
<td style="color: rgb(255, 102, 0);">AT91SAM7X256</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
<td style="text-align: center;"><img src="../wb_img/ksame.png"></td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
<td style="text-align: center;"><img src="../wb_img/ksame.png"></td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
<td style="text-align: center;"><img src="../wb_img/ksame.png"></td>
</tr>
<tr>
<td style="color: rgb(255, 102, 0);">AT91SAM7X512</td>
<td style="text-align: center;"><img src="../wb_img/yellowled.png"></td>
<td style="text-align: center;"><img src="../wb_img/ksame.png"></td>
<td style="text-align: center;"><img src="../wb_img/yellowled.png"></td>
<td style="text-align: center;"><img src="../wb_img/yellowled.png"></td>
<td style="text-align: center;"><img src="../wb_img/yellowled.png"></td>
<td style="text-align: center;"><img src="../wb_img/ksame.png"></td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
<td style="text-align: center;" valign="undefined"><img src="../wb_img/ksame.png"></td>
</tr>
<tr>
<td style="color: rgb(255, 102, 0);">STR912FW44</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
<td style="text-align: center;"><img src="../wb_img/ksame.png"></td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
<td style="text-align: center;"><img src="../wb_img/ksame.png"></td>
<td style="text-align: center;"><img src="../wb_img/ksame.png"></td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
<td style="text-align: center;" valign="undefined"><img src="../wb_img/ksame.png"></td>
</tr>
<tr>
<td style="color: rgb(255, 102, 0);">LPC2888</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
<td style="text-align: center;"><img src="../wb_img/ksame.png"></td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
<td style="text-align: center;"><img src="../wb_img/agt_action_fail1.png"></td>
<td style="text-align: center;"><img src="../wb_img/ksame.png"></td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
<td style="text-align: center;" valign="undefined"><img src="../wb_img/ksame.png"></td>
</tr>
<tr>
<td style="color: rgb(255, 102, 0);">STR711FR2</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
<td style="text-align: center;"><img src="../wb_img/ksame.png"></td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png">&nbsp;</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png">&nbsp; </td>
<td style="text-align: center;"><img src="../wb_img/yellowled.png"></td>
<td style="text-align: center;">&nbsp;<img style="height: 16px; width: 16px;" alt="Not Implemented" src="../wb_img/agt_action_fail1.png"></td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png">&nbsp;</td>
<td style="text-align: center;"><img src="../wb_img/ksame.png"></td>
</tr>
<tr>
<td style="color: rgb(255, 102, 0);">AVR32</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
<td style="text-align: center;"><br>
</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png">&nbsp;</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png">&nbsp; </td>
<td style="text-align: center;"><img src="../wb_img/yellowled.png"></td>
<td style="text-align: center;">&nbsp;<br>
</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png">&nbsp;</td>
<td style="text-align: center;"><br>
</td>
</tr>
<tr>
<td style="color: rgb(255, 102, 0);">STM32</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
<td style="text-align: center;"><br>
</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png">&nbsp;</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png">&nbsp; </td>
<td style="text-align: center;"><img src="../wb_img/yellowled.png"></td>
<td style="text-align: center;"></td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png">&nbsp;</td>
<td style="text-align: center;"><img src="../wb_img/ksame.png"></td>
</tr>
</tbody>
</table>
<br>
<br>
<br>
<br>
<br>
<h3><a name="roadmap"></a>Status of features
&amp; roadmap</h3>
<p>The following table shows the status of some existent and
planned eLua
features.&nbsp; </p>
<p><br>
</p>
<table style="text-align: left; width: 672px; height: 691px;" class="table_center">
<tbody>
<tr>
<th style="text-align: left;">eLua Features</th>
<th style="text-align: center;">Status</th>
</tr>
<tr>
<td style="text-align: left;">Full Lua interpreter
running on targets</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
</tr>
<tr>
<td>Various Lua&nbsp;scripts examples running properly</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
</tr>
<tr>
<td style="text-align: left;">Choose floating point
or integer Lua</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
</tr>
<tr>
<td style="text-align: left;">XMODEM transfer over
UART</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
</tr>
<tr>
<td style="text-align: left;">Embedded ROM (Flash)
file
system</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
</tr>
<tr>
<td style="text-align: left;">Terminal / Console
over UART or Ethernet</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
</tr>
<tr>
<td style="text-align: left;">eLua command shell</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
</tr>
<tr>
<td style="text-align: left;">eLua complete
interrupt support</td>
<td style="text-align: center;"><img src="../wb_img/ksame.png"></td>
</tr>
<tr>
<td style="text-align: left;">eLua "memory limiting"
mode</td>
<td style="text-align: center;"><img src="../wb_img/yellowled.png"></td>
</tr>
<tr>
<td style="text-align: left;">FAT File System layer
for mmc/sd cards</td>
<td style="text-align: center;"><img src="../wb_img/yellowled.png"></td>
</tr>
<tr>
<td style="text-align: left;">Embedded R/W file
system</td>
<td style="text-align: center;">Partially
implemented and tested</td>
</tr>
<tr>
<td style="text-align: left;">eLua FP module (for
integer Lua)</td>
<td style="color: rgb(255, 102, 0); text-align: center;"><img src="../wb_img/ksame.png">
</td>
</tr>
<tr>
<td style="text-align: left;">Embedded text editor</td>
<td style="text-align: center;"><img src="../wb_img/ksame.png"></td>
</tr>
<tr>
<td style="text-align: left;">Lua debugging on target</td>
<td style="text-align: center;"><img src="../wb_img/ksame.png"></td>
</tr>
<tr>
<td style="text-align: left;">GUI/IDE interface for
eLua</td>
<td style="text-align: center;"><img src="../wb_img/ksame.png"></td>
</tr>
<tr>
<td style="text-align: left;">GUI eLua build
configuration tool<br>
</td>
<td style="text-align: center;"><img src="../wb_img/ksame.png">
</td>
</tr><tr><td align="undefined" valign="undefined">Embedded http web server</td><td style="text-align: center;" valign="undefined"><img src="../wb_img/agt_action_success.png"></td></tr>
</tbody>
</table>
<br>
<br>
<br>
<table style="text-align: left; width: 677px; height: 403px;" class="table_center">
<tbody>
<tr>
<th style="text-align: left;">Generic Multi-Platform
Peripheral Modules</th>
<th style="text-align: center;">Status</th>
</tr>
<tr>
<td style="text-align: left;">PIO - Programable
Input / Output</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
</tr>
<tr>
<td>TMR - Timers</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
</tr>
<tr>
<td style="text-align: left;">PWM - Pulse Width
Modulation</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
</tr>
<tr>
<td style="text-align: left;">UART - Universal
Assincronous Rx Tx</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
</tr>
<tr>
<td style="text-align: left;">SPI - Serial
Programable Interface</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
</tr>
<tr>
<td style="text-align: left;">CMP -&nbsp; Analog
Comparator</td>
<td style="text-align: center;"><img src="../wb_img/yellowled.png"></td>
</tr>
<tr>
<td style="text-align: left;">I2C&nbsp;</td>
<td style="text-align: center;"><img src="../wb_img/ksame.png"></td>
</tr>
<tr>
<td style="text-align: left;">CNT - Event Counter
</td>
<td style="text-align: center;"><img src="../wb_img/yellowled.png"></td>
</tr>
<tr>
<td style="text-align: left;">CAN</td>
<td style="text-align: center;"><img src="../wb_img/ksame.png"></td>
</tr>
<tr>
<td style="text-align: left;">NET -
Ethernet&nbsp;module</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
</tr>
</tbody>
</table>
<br>
<br>
<br>
<table style="width: 681px; height: 68px;" class="table_center">
<tbody>
<tr>
<th style="text-align: left;">Platform-Dependent
Peripheral Modules</th>
<th>Status</th>
</tr>
<tr>
<td style="text-align: left;">DISP -&nbsp;RIT
OLED Display Support for LM3Sxxxx</td>
<td style="text-align: center;"><img src="../wb_img/agt_action_success.png"></td>
</tr>
<tr>
<td align="undefined" valign="undefined">LM3S
- Luminary Micro kits onboard devices support (Leds, Buttons, ...)</td>
<td style="text-align: center;" valign="undefined"><img src="../wb_img/agt_action_success.png"></td>
</tr>
</tbody>
</table>
<br>
<br>
<br>
<table style="width: 680px; height: 389px;" class="table_center">
<tbody>
<tr>
<th style="text-align: left;">Functional Abstraction
Auxiliary Modules</th>
<th>Status</th>
</tr>
<tr>
<td style="text-align: left;">GPS - NMEA0183
Sentences parsing and command handling</td>
<td style="text-align: center;"><img src="../wb_img/yellowled.png"></td>
</tr>
<tr>
<td align="undefined" valign="undefined">PID
- Proportional, Integrative &amp; Derivative Control</td>
<td style="text-align: center;" valign="undefined"><img src="../wb_img/ksame.png"></td>
</tr>
<tr>
<td align="undefined" valign="undefined">LCD
- Liquid Crystal Display support</td>
<td style="text-align: center;" valign="undefined"><img src="../wb_img/ksame.png"></td>
</tr>
<tr>
<td align="undefined" valign="undefined">ROT
- Rotary Switch &amp; Encoder support</td>
<td style="text-align: center;" valign="undefined"><img src="../wb_img/ksame.png"></td>
</tr><tr><td align="undefined" valign="undefined">CHDK - Interfacing with Canon cameras also running Lua under <a href="http://chdk.wikia.com/" target="_top">CHKD</a></td><td style="text-align: center;" valign="undefined"><img src="../wb_img/yellowled.png"></td></tr><tr><td align="undefined" valign="undefined">DISP - External text &amp; graphics displays</td><td style="text-align: center;" valign="undefined"><img src="../wb_img/ksame.png"></td></tr><tr><td align="undefined" valign="undefined">FUZZ - Fuzzy Logic Control</td><td style="text-align: center;" valign="undefined"><img src="../wb_img/ksame.png"></td></tr><tr><td align="undefined" valign="undefined">HUM - Humity Sensors over SPI, UART, I2C, PIO, ....</td><td style="text-align: center;" valign="undefined"><img src="../wb_img/ksame.png"></td></tr><tr><td align="undefined" valign="undefined">TMP - Temperature Sensors over SPI, UART, I2C, PIO, ....</td><td style="text-align: center;" valign="undefined"><img src="../wb_img/ksame.png"></td></tr><tr><td align="undefined" valign="undefined">BAR - Pressure Sensors over SPI, UART, I2C, PIO, ....</td><td style="text-align: center;" valign="undefined"><img src="../wb_img/ksame.png"></td></tr><tr><td align="undefined" valign="undefined">X10 - X10 Protocol support for X10 Devices Mapping &amp; Control</td><td style="text-align: center;" valign="undefined"><img src="../wb_img/ksame.png"></td></tr><tr><td align="undefined" valign="undefined">MCP - Magnetic Compass abstraction</td><td style="text-align: center;" valign="undefined"><img src="../wb_img/ksame.png"></td></tr><tr><td align="undefined" valign="undefined">PS2 - Play Station 2 Joystick interfacing support</td><td style="text-align: center;" valign="undefined"><img src="../wb_img/ksame.png"></td></tr>
</tbody>
</table><br><br>If you need a module for a specific device support or logic &amp; modeling abstraction, don't hesitate to suggest it in our <a href="https://lists.berlios.de/mailman/listinfo/elua-dev" target="_top">eLua User's and Developers List</a>. You may have one ready before you would imagine :)<br><br><br><br>
</body></html>

69
doc/pt/sys_ref.html Normal file
View File

@ -0,0 +1,69 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body style="background-color: rgb(255, 255, 255);">
<h3><a name="over"></a>sys</h3>
<br>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="platform"></a>[sys.platform()]&nbsp;&nbsp;&nbsp;
pd.platform(): returns the platform name (f.e. LM3S)</font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="mcu"></a>[sys.mcu()]&nbsp;&nbsp;&nbsp;
pd.cpu(): returns the CPU name (f.e. LM3S8962)</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="cpu"></a>[sys.cpu()]&nbsp;&nbsp;&nbsp;
would return ARM Cortex M3 in this case.....</font></p>
<p style="margin-bottom: 0in;"><font face="Bitstream Vera Sans Mono, sans-serif"><br>
</font></p>
<font face="Bitstream Vera Sans Mono, sans-serif">&nbsp;&nbsp;<a name="board"></a>[sys.board()]</font><font face="Bitstream Vera Sans Mono, sans-serif">&nbsp;
pd.board(): returns the CPU board (f.e. EK-LM3S8962)</font>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> Could also be <b>elua.</b><br>
</p>
<p style="margin-bottom: 0in;"> Many other miscelania
functions will need a place to live and sys or elua is more generic
than pd for it.<br>
</p>
<font style="color: rgb(0, 0, 255);" color="#ff0000">&nbsp;
&nbsp;</font><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</body></html>

281
doc/pt/tc_386.html Normal file
View File

@ -0,0 +1,281 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css"></head>
<body style="background-color: rgb(255, 255, 255);"><h3><a name="title" href="http://www.eluaproject.net/en/Building_GCC_for_i386" class="local">Building GCC for i386</a></h3>
<div class="content">
<p>At first, the idea of an i386 "cross" compiler under Linux seems
strange. After all, you're already running Linux on a i386 compatible
architecture. But the compiler is sometimes tied in misterious ways
with the operating system it's running on (see for example <a href="http://wiki.osdev.org/GCC_Cross-Compiler">this page</a>
for some possible symptoms). And after all, you want to use Newlib, not
libc, and to customize your development environment as much as
possible. This tutorial will show you how to do that.</p>
<p><strong>DISCLAIMER: I'm by no means a specialist in the
GCC/newlib/binutils compilation process. I'm sure that there are better
ways to accomplish what I'm describing here, however I just wanted a
quick and dirty way to build a toolchain, I have no intention in
becoming too intimate with the build process. If you think that what I
did is wrong, innacurate, or simply outrageously ugly, feel free to <a href="http://www.giga.puc-rio.br/cgi-bin/elua.cgi?p=Contact">contact me</a> and I'll make the necessary corrections. And of course, this tutorial comes without any guarantees whatsoever.</strong></p>
<h2>&#8250; Prerequisites</h2>
<p>To build your toolchain you'll need:</p>
<ul><li>a computer running Linux: I use Ubuntu 8.04, but any Linux
will do as long as you know how to find the equivalent of "apt-get" for
your distribution. I won't be going into details about this, google it
and you'll sure find what you need. It is also assumed that the Linux
system already has a "basic" native toolchain installed (gcc/make and
related). This is true for Ubuntu after installation. Again, you might
need to check your specific distribution.</li><li>GNU binutils: get it from <a href="http://ftp.gnu.org/gnu/binutils/">here</a>.
At the moment of writing this, the latest versions is 2.18, which for
some weird reason refuses to compile on my system, so I'm using 2.17
instead.</li><li>GCC: version 4.3.0 or newer is recommended. As
I'm writing this, the latest GCC version is 4.3.1 which I'll be using
for this tutorial. Download it from <a href="http://gcc.gnu.org/mirrors.html">here</a> after choosing a suitable mirror.</li><li>Newlib: as I'm writing this, the latest official Newlib version is 1.16.0. Download it from the <a href="ftp://sources.redhat.com/pub/newlib/index.html">Newlib FTP directory</a>.</li><li>Also,
the tutorial assumes that you're using bash as your shell. If you use
something else, you might need to adjust some shell-specific commands. </li></ul>
<p>Also, you need some support programs/libraries in order to compile the toolchain. To install them:</p>
<p><br></p>
<table class="table_cod">
<tbody><tr>
<th>$ sudo apt-get install flex bison libgmp3-dev libmpfr-dev autoconf texinfo</th>
</tr>
</tbody></table>
<p>Next, decide where you want to install your toolchain. They
generally go in /usr/local/, so I'm going to assume
/usr/local/cross-i686 for this tutorial. To save yourself some typing,
set this path into a shell variable:</p>
<p><br></p>
<table class="table_cod">
<tbody><tr>
<th>$ export TOOLPATH=/usr/local/cross-i686</th>
</tr>
</tbody></table>
<h2>&#8250; Step 1: binutils</h2>
<p>This is the easiest step: unpack, configure, build.</p>
<p><br></p>
<table class="table_cod">
<tbody><tr>
<th style="text-align: left;">$ tar -xvjf binutils-2.17.tar.bz2</th>
</tr>
<tr align="left">
<th>$ cd binutils-2.17</th>
</tr>
<tr align="left">
<th>$ mkdir build</th>
</tr>
<tr align="left">
<th>$ cd build</th>
</tr>
<tr align="left">
<th>$ ../configure --target=i686-elf --prefix=$TOOLPATH --with-gnu-as --with-gnu-ld --disable-nls</th>
</tr>
<tr align="left">
<th>$ make all</th>
</tr>
<tr align="left">
<th>$ sudo make install</th>
</tr>
<tr align="left">
<th>$ export PATH=${TOOLPATH}/bin:$PATH</th>
</tr>
</tbody></table>
<p>Now you have your i386 "binutils" (assembler, linker, disassembler ...) in your PATH.</p>
<h2>&#8250; Step 2: basic GCC</h2>
<p>In this step we build a "basic" GCC (that is, a GCC without any
support libs, which we'll use in order to build all the libraries for
our target). But first we need to make a slight modification in the
configuration files. Out of the box, the GCC 4.3.1/newlib combo won't
compile properly, giving a very weird "Link tests are not allowed after
GCC_NO_EXECUTABLES" error. After a bit of googling, I found the
solution for this:</p>
<p><br></p>
<table class="table_cod">
<tbody><tr align="left">
<th>$ tar -xvjf gcc-4.3.1.tar.bz2</th>
</tr>
<tr align="left">
<th>$ cd gcc-4.3.1/libstdc++-v3</th>
</tr>
<tr align="left">
<th>$ joe configure.ac</th>
</tr>
</tbody></table>
<p>I'm using "joe" here as it's my favourite Linux text mode editor,
you can use any other text editor. Now find the line which says
"AC_LIBTOOL_DLOPEN" and comment it out by adding a "#" before it: </p>
<pre><code> # AC_LIBTOOL_DLOPEN<br></code></pre>
<p>Save the modified file and exit the text editor</p>
<p><br></p>
<table class="table_cod">
<tbody><tr align="left">
<th>$ autoconf</th>
</tr>
<tr align="left">
<th>$ cd ..</th>
</tr>
</tbody></table>
<p>Great, now we know it will compile, so let's do it:</p>
<p><br></p>
<table class="table_cod">
<tbody><tr align="left">
<th>$ mkdir build</th>
</tr>
<tr align="left">
<th>$ cd build</th>
</tr>
<tr align="left">
<th>$
../configure --target=i686-elf --prefix=$TOOLPATH
--enable-languages="c,c++" --with-newlib --without-headers
--disable-shared --with-gnu-as --with-gnu-ld
</th>
</tr>
<tr align="left">
<th>$ make all-gcc</th>
</tr>
<tr align="left">
<th>$ sudo make install-gcc</th>
</tr>
</tbody></table>
<p>On my system, the last line above (sudo make install-gcc) terminated
with errors, because it was unable to find our newly compiled binutils.
If this happens for any kind of "make install" command, this is a quick
way to solve it:</p>
<p><br></p>
<table class="table_cod">
<tbody><tr>
<th>$ sudo -s -H</th>
</tr>
</tbody></table>
<pre><code> # export PATH=/usr/local/cross-i686/bin:$PATH<br> # make install-gcc<br> # exit<br></code></pre>
<h2>&#8250; Step 3: Newlib</h2>
<p>Once again, Newlib is as easy as unpack, configure, build. But I
wanted my library to be as small as possible (as opposed to as fast as
possible) and I only wanted to keep what's needed from it in the final
executable, so I added the "-ffunction-sections -fdata-sections" flags
to allow the linker to perform dead code stripping:</p>
<p><br></p>
<table class="table_cod">
<tbody><tr align="left">
<th>$ tar xvfz newlib-1.16.0.tar.gz</th>
</tr>
<tr align="left">
<th>$ cd newlib-1.16.0</th>
</tr>
<tr align="left">
<th>$ mkdir build</th>
</tr>
<tr align="left">
<th>$ cd build</th>
</tr>
<tr align="left">
<th>$
../configure --target=i686-elf --prefix=$TOOLPATH
--disable-newlib-supplied-syscalls --with-gnu-ld --with-gnu-as
--disable-shared</th>
</tr>
<tr align="left">
<th>$ make
CFLAGS_FOR_TARGET="-ffunction-sections
-fdata-sections -D__PREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -Os
-fomit-frame-pointer -D__BUFSIZ__=256"</th>
</tr>
<tr align="left">
<th>$ sudo make install</th>
</tr>
</tbody></table>
<p>Some notes about the flags used in the above sequence:</p>
<ul><li><code>--disable-newlib-supplied-syscalls:</code> this deserves a page of its own, but I won't cover it here. For an explanation, see for example <a href="http://openhardware.net/Embedded_ARM/NewLib_Stubs/">this page</a>.</li><li><code>-D__PREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__:</code> compile Newlib for size, not for speed (these are Newlib specific).</li><li><code>-Os -fomit-frame-pointer:</code> tell GCC to optimize for size, not for speed.</li><li><code>-D__BUFSIZ__=256:</code>
again Newlib specific, this is the buffer size allocated by default for
files opened via fopen(). The default is 1024, which I find too much
for an eLua, so I'm using 256 here. Of course, you can change this
value.</li></ul>
<h2>&#8250; Step 4: full GCC</h2>
<p>Finally, in the last step of our tutorial, we complete the GCC
build. In this stage, a number of compiler support libraries are built
(most notably libgcc.a). Fortunately this is simpler that the Newlib
compilation step:</p>
<p><br></p>
<table class="table_cod">
<tbody><tr align="left">
<th>$ cd gcc-4.3.1/build</th>
</tr>
<tr align="left">
<th>$ make all</th>
</tr>
<tr align="left">
<th>$ sudo make install</th>
</tr>
</tbody></table>
<h2>&#8250; Step 5: all done!</h2>
<p>Now you can finally enjoy your i386 toolchain, and compile eLua with
it :) After you do, you'll be able to boot eLua directly on your PC, as
described <a href="http://www.giga.puc-rio.br/cgi-bin/elua.cgi?p=Booting_your_PC_in_eLua">here</a>, but you won't need to download the ELF file from the eLua project page, since you just generated it using your own toolchain!
If you need further clarification, or if the above instructions didn't work for you, feel free to <a href="http://www.giga.puc-rio.br/cgi-bin/elua.cgi?p=Contact">contact me</a>.</p>
</div></body></html>

310
doc/pt/tc_arm.html Normal file
View File

@ -0,0 +1,310 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css"></head>
<body style="background-color: rgb(255, 255, 255);"><h3><a name="title" href="http://www.eluaproject.net/en/Building_GCC_for_ARM" class="local">Building GCC for ARM</a></h3>
<div class="content">
<p> This tutorial explains how you can create a GCC+Newlib toolchain
that can be used to compile programs for the ARM architecture, thus
making it possible to compile programs for the large number of ARM CPUs
out there. You'll need such a toolchain if you want to compile eLua for
ARM CPUs. This tutorial is similar to many others you'll find on the
Internet (particulary the one from <a href="http://www.gnuarm.com/">gnuarm</a>, on which it's based), but it's a bit more detailed and shows some "tricks" you can use when compiling Newlib.</p>
<p><strong>DISCLAIMER: I'm by no means a specialist in the
GCC/newlib/binutils compilation process. I'm sure that there are better
ways to accomplish what I'm describing here, however I just wanted a
quick and dirty way to build a toolchain, I have no intention in
becoming too intimate with the build process. If you think that what I
did is wrong, innacurate, or simply outrageously ugly, feel free to <a href="http://www.eluaproject.net/en/Contact">contact me</a> and I'll make the necessary corrections. And of course, this tutorial comes without any guarantees whatsoever.</strong></p>
<h2>Prerequisites</h2>
<p>To build your toolchain you'll need:</p>
<ul><li>a computer running Linux: I use Ubuntu 8.04, but any Linux
will do as long as you know how to find the equivalent of "apt-get" for
your distribution. I won't be going into details about this, google it
and you'll sure find what you need. It is also assumed that the Linux
system already has a "basic" native toolchain installed (gcc/make and
related).This is true for Ubuntu after installation. Again, you might
need to check your specific distribution.</li><li>GNU binutils: get it from <a href="http://ftp.gnu.org/gnu/binutils/">here</a>.
At the moment of writing this, the latest versions is 2.18, which for
some weird reason refuses to compile on my system, so I'm using 2.17
instead.</li><li>GCC: version 4.3.0 or newer is recommended. As
I'm writing this, the latest GCC version is 4.3.1 which I'll be using
for this tutorial. Download it from <a href="http://gcc.gnu.org/mirrors.html">here</a> after choosing a suitable mirror.</li><li>Newlib: as I'm writing this, the latest official Newlib version is 1.16.0. Download it from the <a href="ftp://sources.redhat.com/pub/newlib/index.html">Newlib FTP directory</a>.</li><li>Also,
the tutorial assumes that you're using bash as your shell. If you use
something else, you might need to adjust some shell-specific commands. </li></ul>
<p>Also, you need some support programs/libraries in order to compile the toolchain. To install them:</p>
<p><br></p>
<table class="table_cod">
<tbody><tr>
<th>$ sudo apt-get install flex bison libgmp3-dev libmpfr-dev autoconf texinfo</th>
</tr>
</tbody></table>
<p>Next, decide where you want to install your toolchain. They
generally go in /usr/local/, so I'm going to assume
/usr/local/cross-arm for this tutorial. To save yourself some typing,
set this path into a shell variable:</p>
<p><br></p>
<table class="table_cod">
<tbody><tr>
<th>$ export TOOLPATH=/usr/local/cross-arm</th>
</tr>
</tbody></table>
<h2>&#8250; Step 1: binutils</h2>
<p>This is the easiest step: unpack, configure, build.</p>
<p><br></p>
<table class="table_cod">
<tbody><tr>
<th>$ tar -xvjf binutils-2.17.tar.bz2</th>
</tr>
</tbody></table>
<table class="table_cod">
<tbody><tr>
<th>$ cd binutils-2.17</th>
</tr>
</tbody></table>
<table class="table_cod">
<tbody><tr>
<th>$ mkdir build</th>
</tr>
</tbody></table>
<table class="table_cod">
<tbody><tr>
<th>$ cd build</th>
</tr>
</tbody></table>
<table class="table_cod">
<tbody><tr>
<th style="text-align: left;">$ ../configure --target=arm-elf --prefix=$TOOLPATH --enable-interwork --enable-multilib--with-gnu-as --with-gnu-ld --disable-nls</th>
</tr>
</tbody></table>
<table class="table_cod">
<tbody><tr>
<th>$ make all</th>
</tr>
</tbody></table>
<table class="table_cod">
<tbody><tr>
<th>$ sudo make install</th>
</tr>
</tbody></table>
<table class="table_cod">
<tbody><tr>
<th>$ export PATH=${TOOLPATH}/bin:$PATH</th>
</tr>
</tbody></table>
<p>Now you have your ARM "binutils" (assembler, linker, disassembler ...) in your PATH.</p>
<h2>Step 2: basic GCC</h2>
<p>In this step we build a "basic" GCC (that is, a GCC without any
support libs, which we'll use in order to build all the libraries for
our target). But first we need to make a slight modification in the
configuration files. Out of the box, the GCC 4.3.1/newlib combo won't
compile properly, giving a very weird "Link tests are not allowed after
GCC_NO_EXECUTABLES" error. After a bit of googling, I found the
solution for this:</p>
<p><br></p>
<table class="table_cod">
<tbody><tr>
<th>$ tar -xvjf gcc-4.3.1.tar.bz2</th>
</tr>
<tr>
<th>$ cd gcc-4.3.1/libstdc++-v3</th>
</tr>
<tr>
<th style="text-align: left;">$ joe configure.ac</th>
</tr>
</tbody></table>
<p> I'm using "joe" here as it's my favourite Linux text mode editor,
you can use any other text editor. Now find the line which says
"AC_LIBTOOL_DLOPEN" and comment it out by adding a "#" before it:</p>
<p><code># AC_LIBTOOL_DLOPEN</code></p>
<p>Save the modified file and exit the text editor</p>
<p><br> </p>
<table class="table_cod">
<tbody><tr>
<th>$ autoconf</th>
</tr>
<tr>
<th style="text-align: left;">$ cd ..</th>
</tr>
</tbody></table>
<p>Great, now we know it will compile, so let's do it:</p>
<p><br></p>
<table class="table_cod">
<tbody><tr align="left">
<th>$ mkdir build</th>
</tr>
<tr align="left">
<th>$ cd build</th>
</tr>
<tr align="left">
<th>$
../configure --target=arm-elf --prefix=$TOOLPATH --enable-interwork
--enable-multilib --enable-languages="c,c++" --with-newlib
--without-headers --disable-shared--with-gnu-as --with-gnu-ld</th>
</tr>
<tr align="left">
<th>$ make all-gcc</th>
</tr>
<tr align="left">
<th>$ sudo make install-gcc</th>
</tr>
</tbody></table>
<p>On my system, the last line above (sudo make install-gcc) terminated
with errors, because it was unable to find our newly compiled binutils.
If this happens for any kind of "make install" command, this is a quick
way to solve it:</p>
<p style="text-align: left;"><br></p><div style="text-align: left;">
</div><table class="table_cod">
<tbody><tr align="left">
<th>$ sudo -s -H</th>
</tr>
<tr align="left">
<th># export PATH=/usr/local/cross-arm/bin:$PATH</th>
</tr>
<tr align="left">
<th># make install-gcc</th>
</tr>
<tr>
<th style="text-align: left;"># exit</th>
</tr>
</tbody></table>
<h2>Step 3: Newlib</h2>
<p>Once again, Newlib is as easy as unpack, configure, build. But I
wanted my library to be as small as possible (as opposed to as fast as
possible) and I only wanted to keep what's needed from it in the final
executable, so I added the "-ffunction-sections -fdata-sections" flags
to allow the linker to perform dead code stripping:</p>
<p><br></p>
<table class="table_cod">
<tbody><tr align="left">
<th>$ tar xvfz newlib-1.16.0.tar.gz</th>
</tr>
<tr align="left">
<th>$ cd newlib-1.16.0</th>
</tr>
<tr align="left">
<th>$ mkdir build</th>
</tr>
<tr align="left">
<th>$ cd build</th>
</tr>
<tr align="left">
<th>$
../configure --target=arm-elf --prefix=$TOOLPATH --enable-interwork
--disable-newlib-supplied-syscalls --with-gnu-ld --with-gnu-as
--disable-shared</th>
</tr>
<tr align="left">
<th>$ make
CFLAGS_FOR_TARGET="-ffunction-sections -fdata-sections
-DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -Os -fomit-frame-pointer
-D__BUFSIZ__=256"</th>
</tr>
<tr align="left">
<th>$ sudo make install</th>
</tr>
</tbody></table>
<p>Some notes about the flags used in the above sequence:</p>
<ul><li><code>--disable-newlib-supplied-syscalls</code>: this deserves a page of its own, but I won't cover it here. For an explanation, see for example <a href="http://openhardware.net/Embedded_ARM/NewLib_Stubs/">this page</a></li><li><code>-DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__</code>: compile Newlib for size, not for speed (these are Newlib specific).</li><li><code>-Os -fomit-frame-pointer</code>: tell GCC to optimize for size, not for speed.</li><li><code>-D__BUFSIZ__=256</code>:
again Newlib specific, this is the buffer size allocated by default for
files opened via fopen(). The default is 1024, which I find too much
for an eLua, so I'm using 256 here. Of course, you can change this
value.</li></ul>
<h2>Step 4: full GCC</h2>
<p>Finally, in the last step of our tutorial, we complete the GCC
build. In this stage, a number of compiler support libraries are built
(most notably libgcc.a). Fortunately this is simpler that the Newlib
compilation step:</p>
<p><br></p>
<table class="table_cod">
<tbody><tr align="left">
<th>$ cd gcc-4.3.1/build</th>
</tr>
<tr align="left">
<th>$ make all</th>
</tr> <tr align="left">
<th>$ sudo make install</th>
</tr>
</tbody></table>
<h2>Step 5: all done!</h2>
<p>Now you can finally enjoy your ARM toolchain, and compile eLua with it :)
If you need further clarification, or if the above instructions didn't work for you, feel free to <a href="http://www.eluaproject.net/en/Contact">contact me</a>.</p>
</div></body></html>

343
doc/pt/tc_cortex.html Normal file
View File

@ -0,0 +1,343 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css"></head>
<body style="background-color: rgb(255, 255, 255);"><div class="content">
<h3><a name="title" href="http://www.eluaproject.net/en/Building_GCC_for_Cortex" class="local">Building GCC for Cortex</a></h3><p>This tutorial explains how you can create a GCC+Newlib toolchain
that can be used to compile programs for the Cortex (Thumb2)
architecture, thus making it possible to use GCC to compile programs
for the increasingly number of Cortex CPUs out there (<a href="http://www.luminarymicro.com/">Luminary Micro</a>, <a href="http://www.st.com/mcu/inchtml-pages-stm32.html">ST</a>,
with new Cortex CPUs being announced by Atmel and other companies). I
am writing this tutorial because I needed to work on a Cortex CPU for
the eLua project and I couldn't find anywhere a complete set of
instructions for building GCC for this architecture. You'll need such a
toolchain if you want to compile eLua for Cortex-M3 CPUs.</p>
<p><strong>DISCLAIMER: I'm by no means a specialist in the
GCC/newlib/binutils compilation process. I'm sure that there are better
ways to accomplish what I'm describing here, however I just wanted a
quick and dirty way to build a toolchain, I have no intention in
becoming too intimate with the build process. If you think that what I
did is wrong, innacurate, or simply outrageously ugly, feel free to <a href="http://www.eluaproject.net/en/Contact">contact us</a> and I'll make the necessary corrections. And of course, this tutorial comes without any guarantees whatsoever.</strong></p>
<h2>Prerequisites</h2>
<p>To build your toolchain you'll need:</p>
<ul><li>a computer running Linux: I use Ubuntu 8.04, but any Linux
will do as long as you know how to find the equivalent of "apt-get" for
your distribution. I won't be going into details about this, google it
and you'll sure find what you need. It is also assumed that the Linux
system already has a "basic" native toolchain installed (gcc/make and
related). This is true for Ubuntu after installation. Again, you might
need to check your specific distribution.</li><li>GNU binutils: get it from <a href="http://ftp.gnu.org/gnu/binutils/">here</a>.
At the moment of writing this, the latest versions is 2.18, which for
some weird reason refuses to compile on my system, so I'm using 2.17
instead. <strong>UPDATE</strong>: you MUST use the new binutils 2.19
distribution for the Cortex toolchain, since it fixes some assembler
issues. You won't be able to compile eLua 0.5 or higher if you don't
use binutils 2.19.</li><li>GCC: since support for Cortex (Thumb2)
was only introduced staring with version 4.3.0, you'll need to download
version 4.3.0 or newer. As I'm writing this, the latest GCC version is
4.3.1, which I'll be using for this tutorial. Download it from <a href="http://gcc.gnu.org/mirrors.html">here</a> after choosing a suitable mirror.</li><li>Newlib:
as I'm writing this, the latest official Newlib version is 1.16.0.
However, the CVS version contains some fixes for the Thumb2
architecture, some of them in very important functions (like
setjmp/longjmp), so you'll need to fetch the sources from CVS (this
will most likely change when a new official Newlib version is
released). So go to <a href="http://sourceware.org/newlib/download.html">http://sourceware.org/newlib/download.html</a> and follow the instructions there in order to get the latest sources from CVS.</li><li>Also,
the tutorial assumes that you're using bash as your shell. If you use
something else, you might need to adjust some shell-specific commands. </li></ul>
<p>Also, you need some support programs/libraries in order to compile the toolchain. To install them:</p>
<p><br></p>
<table class="table_cod">
<tbody><tr>
<th>$ sudo apt-get install flex bison libgmp3-dev libmpfr-dev autoconf texinfo build-essential</th>
</tr>
</tbody></table>
<p>Next, decide where you want to install your toolchain. They
generally go in /usr/local/, so I'm going to assume
/usr/local/cross-cortex for this tutorial. To save yourself some
typing, set this path into a shell variable:</p>
<p><br></p>
<table class="table_cod">
<tbody><tr>
<th>$ export TOOLPATH=/usr/local/cross-cortex</th>
</tr>
</tbody></table>
<h2>Step 1: binutils</h2>
<p>This is the easiest step: unpack, configure, build.</p>
<p><br></p>
<table class="table_cod">
<tbody><tr align="left">
<th>$ tar -xvjf binutils-2.19.tar.bz2</th>
</tr>
<tr align="left">
<th>$ cd binutils-2.19</th>
</tr>
<tr align="left">
<th>$ mkdir build</th>
</tr>
<tr align="left">
<th>$ cd build</th>
</tr>
<tr align="left">
<th>$
../configure --target=arm-elf --prefix=$TOOLPATH --enable-interwork
--enable-multilib --with-gnu-as --with-gnu-ld --disable-nls</th>
</tr>
<tr align="left">
<th>$ make all</th>
</tr>
<tr align="left">
<th>$ sudo make install</th>
</tr>
<tr align="left">
<th>$ export PATH=${TOOLPATH}/bin:$PATH</th>
</tr>
</tbody></table>
<p>Now you have your ARM "binutils" (assembler, linker, disassembler ...) in your PATH. They are fully capable of handling Thumb2.</p>
<h2>Step 2: basic GCC</h2>
<p>In this step we build a "basic" GCC (that is, a GCC without any
support libs, which we'll use in order to build all the libraries for
our target). But first we need to make a slight modification in the
configuration files. Out of the box, the GCC 4.3.1/newlib combo won't
compile properly, giving a very weird "Link tests are not allowed after
GCC_NO_EXECUTABLES" error. After a bit of googling, I found the
solution for this:</p>
<p><br></p>
<table class="table_cod">
<tbody><tr align="left">
<th>$ tar -xvjf gcc-4.3.1.tar.bz2</th>
</tr>
<tr align="left">
<th>$ cd gcc-4.3.1/libstdc++-v3</th>
</tr>
<tr align="left">
<th>$ joe configure.ac </th>
</tr>
</tbody></table>
<p> I'm using "joe" here as it's my favourite Linux text mode editor,
you can use any other text editor. Now find the line which says
"AC_LIBTOOL_DLOPEN" and comment it out by adding a "#" before it: </p>
<code># AC_LIBTOOL_DLOPEN<br></code>
<p>Save the modified file and exit the text editor</p>
<p><br></p>
<table class="table_cod">
<tbody><tr>
<th>$ autoconf</th>
</tr>
<tr>
<th style="text-align: left;">$ cd ..</th>
</tr>
</tbody></table>
<p>Great, now we know it will compile, so let's do it:</p>
<p><br></p>
<table class="table_cod">
<tbody><tr align="left">
<th>$ mkdir build</th>
</tr>
<tr align="left">
<th>$ cd build</th>
</tr>
<tr align="left">
<th>$
../configure --target=arm-elf --prefix=$TOOLPATH --enable-interwork
--enable-multilib --enable-languages="c,c++" --with-newlib
--without-headers --disable-shared --with-gnu-as --with-gnu-ld</th>
</tr>
<tr align="left">
<th>$ make all-gcc</th>
</tr>
<tr align="left">
<th>$ sudo make install-gcc</th>
</tr>
</tbody></table>
<p>On my system, the last line above (sudo make install-gcc) terminated
with errors, because it was unable to find our newly compiled binutils.
If this happens for any kind of "make install" command, this is a quick
way to solve it:</p>
<p><br></p>
<table style="width: 376px; height: 157px;" class="table_cod">
<tbody><tr>
<th>$ sudo -s -H</th>
</tr><tr><td align="undefined" valign="undefined"><code># export PATH=/usr/local/cross-cortex/bin:$PATH</code></td></tr><tr><td align="undefined" valign="undefined"><code># make install-gcc</code></td></tr><tr><td align="undefined" valign="undefined"><code># exit</code></td></tr>
</tbody></table>
<code><br><br><br></code>
<h2>Step 3: Newlib</h2>
<p>Again, some modifications are in order before we start compiling.
Because the CVS version of Newlib doesn't seem to have all the required
support for Thumb2 yet, we need to tell Newlib to skip some of its
libraries when compiling:</p>
<p><br></p>
<table class="table_cod">
<tbody><tr>
<th>$ cd [directory where the newlib CVS is located]</th>
</tr>
<tr>
<th style="text-align: left;">$ joe configure.ac</th>
</tr>
</tbody></table>
<p> Find this fragment of code:</p>
<pre><code> arm-*-elf* | strongarm-*-elf* | xscale-*-elf* | arm*-*-eabi* )<br> noconfigdirs="$noconfigdirs target-libffi target-qthreads"<br> libgloss_dir=arm<br> ;;<br><br> And add "target-libgloss" to the "noconfigdirs" variable:<br><br> arm-*-elf* | strongarm-*-elf* | xscale-*-elf* | arm*-*-eabi* )<br> noconfigdirs="$noconfigdirs target-libffi target-qthreads target-libgloss"<br> libgloss_dir=arm<br> ;;<br><br> Save the modified file and exit the text editor<br> $ autoconf<br></code></pre>
<p>On one of the systems I ran the above sequence, it terminated with
errors, complaining that autoconf 2.59 was not found. I don't know why
that happens. 2.59 seems to be quite ancient, and the build ran equally
well with 2.61 (the version of autoconf on the system that gave the
error). If this happens to you, first execute autoconf --version to
find the actual version of your autoconf, then do this:</p>
<p><br></p>
<table class="table_cod">
<tbody><tr>
<th></th>
</tr>
</tbody></table>
<pre><code>$ joe config/override.m4<br><br> Look for this line:<br><br> [m4_define([_GCC_AUTOCONF_VERSION], [2.59])])<br><br> And replace [2.59] with your actual version ([2.61] in my case).<br> $ autoconf<br></code></pre>
<p>Once again, now we're ready to actually compile Newlib. But we need
to tell it to compile for Thumb2. As already specified, I'm not a
specialist when it comes to Newlib's build system, so I chosed the
quick, dirty and not so elegant solution of providing the compilation
flags directly from the command line. Also, as I wanted my library to
be as small as possible (as opposed to as fast as possible) and I only
wanted to keep what's needed from it in the final executable, I added
the "-ffunction-sections -fdata-sections" flags to allow the linker to
perform dead code stripping:</p>
<p><br></p>
<table class="table_cod">
<tbody><tr align="left">
<th>$ mkdir build</th>
</tr>
<tr align="left">
<th>$ cd build</th>
</tr>
<tr align="left">
<th>$
../configure --target=arm-elf --prefix=$TOOLPATH --enable-interwork
--disable-newlib-supplied-syscalls --with-gnu-ld --with-gnu-as
--disable-shared</th>
</tr>
<tr align="left">
<th>$ make
CFLAGS_FOR_TARGET="-ffunction-sections -fdata-sections
-DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -Os -fomit-frame-pointer
-mcpu=cortex-m3 -mthumb -D__thumb2__ -D__BUFSIZ__=256"
CCASFLAGS="-mcpu=cortex-m3 -mthumb -D__thumb2__"</th>
</tr>
<tr align="left">
<th>$ sudo make install</th>
</tr>
</tbody></table>
<p>Some notes about the flags used in the above sequence:</p>
<ul><li><code>--disable-newlib-supplied-syscalls:</code> this deserves a page of its own, but I won't cover it here. For an explanation, see for example <a href="http://openhardware.net/Embedded_ARM/NewLib_Stubs/">this page</a>.</li><li><code>-DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__:</code> compile Newlib for size, not for speed (these are Newlib specific).</li><li><code>-mcpu=cortex-m3 -mthumb:</code> this tells GCC that you want to compile for Cortex. Note that you need both flags.</li><li><code>-D__thumb2__:</code> again, this is Newlib specific, and seems to be required when compiling Newlib for Cortex.</li><li><code>-Os -fomit-frame-pointer:</code> tell GCC to optimize for size, not for speed.</li><li><code>-D__BUFSIZ__=256:</code>
again Newlib specific, this is the buffer size allocated by default for
files opened via fopen(). The default is 1024, which I find too much
for an eLua, so I'm using 256 here. Of course, you can change this
value.</li></ul>
<h2>Step 4: full GCC</h2>
<p>Finally, in the last step of our tutorial, we complete the GCC
build. In this stage, a number of compiler support libraries are built
(most notably libgcc.a). Fortunately this is simpler that the Newlib
compilation step, as long as you remember that we want to build our
compiler support libraries for the Cortex architecture:</p>
<p><br></p>
<table class="table_cod">
<tbody><tr align="left">
<th>$ cd gcc-4.3.1/build</th>
</tr>
<tr align="left">
<th>$ make CFLAGS="-mcpu=cortex-m3 -mthumb" CXXFLAGS="-mcpu=cortex-m3 -mthumb" LIBCXXFLAGS="-mcpu=cortex-m3 -mthumb" all</th>
</tr>
<tr align="left">
<th>$ sudo make install</th>
</tr>
</tbody></table>
<h2>All Done!</h2>
<p>Phew! That was quite a disturbing tutorial, with all that confusing
flags lurking in every single shell line :) But at this point you
should have a fully functional Cortex GCC toolchain, which seems to be
something very rare, so enjoy it with pride.
If you need further clarification, or if the above instructions didn't
work for you, feel free to <a href="http://www.eluaproject.net/en/Contact">contact us</a>.</p><p></p><p></p>
</div></body></html>

9
doc/pt/tchainbuild.html Normal file
View File

@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css"></head>
<body style="background-color: rgb(255, 255, 255);"><h3><a name="title" href="http://www.eluaproject.net/en/Building_GCC_for_i386" class="local">Toolchain Build</a></h3><a name="title" href="http://www.eluaproject.net/en/Building_GCC_for_i386" class="local"></a>eLua can be compiled and link edited with GCC Toolchains.<br><br>.....................<br><br>
</body></html>

60
doc/pt/term_ref.html Normal file
View File

@ -0,0 +1,60 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body style="background-color: rgb(255, 255, 255);">
<h3><a name="over">term</a></h3>
&nbsp; &nbsp;Terminal support
<p> <a name="clear"></a>[term.clear]
term.clrscr(): clear the screen </p>
<p> &nbsp; <br>
<a name="cleareol"></a>[term.cleareol]
term.clreol(): clear from the current cursor position to the end of the
line </p>
<p> &nbsp; </p>
<p><a name="moveto"></a> [term.moveto]
term.gotoxy( x, y ): position the cursor at the given coordinates<br>
</p>
<br>
<p><a name="moveup"></a> [term.moveup]
term.up( delta ): move the cursor up "delta" lines </p>
<p> &nbsp; </p>
<p><a name="movedown"></a> [term.movedown]
term.down( delta ): move the cursor down "delta" lines </p>
<p> &nbsp; </p>
<p><a name="moveleft"></a> [term.moveleft]
term.left( delta ): move the cursor left "delta" lines </p>
<p> &nbsp; <br>
<a name="moveright"></a>[term.moveright] term.right(
delta ): move the cursor right "delta" lines </p>
<p> &nbsp; </p>
<p><a name="getlinecount"></a>
[term.getlinecount] Lines = term.lines(): returns the number of lines </p>
<p> &nbsp; </p>
<p><a name="getcolcount"></a>
[term.getcolcount] Cols = term.cols(): returns the number of columns </p>
<p> &nbsp; </p>
<br>
<p><a name="printstr"></a> [term.printstr]
term.putstr( s1, s2, ... ): writes the specified string(s) to the
terminal<br>
</p>
<p> </p>
<p> [term.printchar] term.put( c1, c2, ... ): writes the
specified character(s) to the terminal </p>
<p>&nbsp; </p>
<p><a name="getx"></a> [term.getx] Cx =
term.cursorx(): return the cursor X position </p>
<p> &nbsp; </p>
<p> <a name="gety"></a>[term.gety] Cy =
term.cursory(): return the cursor Y position </p>
<p> &nbsp; </p>
<p> <font size="2"><a name="inputchar"></a>[term.inputchar]
c = term.getch( term.WAIT | term.NOWAIT ): returns a char read from the
</font> </p>
<font size="2">&nbsp; terminal.</font>
<br style="font-family: Verdana;">
</body></html>

159
doc/pt/tmr_ref.html Normal file
View File

@ -0,0 +1,159 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body style="background-color: rgb(255, 255, 255);">
<h3><a name="over"></a>tmr</h3>
<span style="font-weight: bold;"></span><big><br>
</big>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">It allows Lua to
execute timer specific operations (delay, read timer value,</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">start timer, get
time difference).</font>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="delay"></a>tmr.delay( id, delay ): uses timer
'id' to wait for 'delay' us.</font>
</p>
<p style="margin-bottom: 0in;"> <br>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><span style="font-style: italic;"><a name="read"></a></span>Data
= tmr.read( id ): reads the value of timer 'id'. The returned value is </font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">platform
dependent.</font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><span style="font-style: italic;"><a name="start"></a></span>Data
= tmr.start( id ): start the timer 'id', and also returns its value at</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">the moment of
start. The returned value is platform dependent.</font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="diff"></a>diff
= tmr.diff( id, end, start ): returns the time difference (in us)
between</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">the timer values
'end' and 'start' (obtained from calling tmr.start or</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">tmr.read). The
order of end/start is irrelevant. </font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="mindelay"></a>Data = tmr.mindelay( id ): returns
the minimum delay (in us ) that can be </font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">achieved by
calling the tmr.delay function. If the return value is 0, the </font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">platform layer
is capable of executing sub-microsecond delays.</font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="maxdelay"></a>Data = tmr.maxdelay( id ): returns
the maximum delay (in us) that can be</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">achieved by
calling the tmr.delay function.</font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="setclock"></a>Data = tmr.setclock( id, clock ):
sets the clock of the given timer. Returns the</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">actual clock set
for the timer.</font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="getclock"></a>Data = tmr.getclock( id ): return
the clock of the given timer.</font>
</p>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<p style="margin-bottom: 0in;"> <br>
</p>
<big><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br style="font-family: Helvetica,Arial,sans-serif;">
<br style="font-family: Helvetica,Arial,sans-serif;">
<br style="font-family: Helvetica,Arial,sans-serif;">
<span style="font-family: Helvetica,Arial,sans-serif;">
&nbsp;
</span></big> <br>
<br style="font-family: Verdana;">
</body></html>

93
doc/pt/tut_bootpc.html Normal file
View File

@ -0,0 +1,93 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css"></head>
<body style="background-color: rgb(255, 255, 255);"><h3><a name="title" href="http://www.eluaproject.net/en/Booting_your_PC_in_eLua" class="local">Booting your PC in eLua</a></h3>
<div class="content">
<p>That's right: after following this tutorial, your PC will boot
directly into Lua! No OS there (this explains why the boot process is
so fast), just you and Lua. You'll be able to use the regular Lua
interpreter to write your programs and even use "dofile" to execute Lua
code.</p>
<h2>Details</h2>
<p>Booting Lua involves using the well known <a href="http://www.gnu.org/software/grub/">GRUB</a> that will be used to load a <a href="http://www.gnu.org/software/grub/manual/multiboot/">multiboot</a>
compliant ELF file that contains our eLua code. Since the eLua code and
the build instructions are not available yet, I'll be providing a
direct link to the ELF file. The code runs in protected mode, so you
have access to your whole memory. The code does not access any kind of
storage device (HDD, CDROM, floppy), so if you're worried that it might
brick your system, you can relax now :) I'm only using some very basic
keyboard and VGA "drivers", so all you're risking is a system freeze
(even this is highly unlikely), nothing a good old RESET can't handle
(be sure to use the hardware reset though, CTRL+ALT+DEL is not handled
by the code). But just in case, see also the next section.</p>
<h2>Disclaimer</h2>
<p><strong>As already mentioned, the code won't try to access any kind
of storage (HDD, CDROM, floppy), not even for reading, so you don't
need to worry about that. Also it doesn't try to reprogram your video
card registers, so it can't harm it or your monitor. It only implements
a "protected mode keyboard driver" that can't physically damage
anything in your system. In short, I made every effort to make the code
as harmless as possible. I tested it on 5 different computers and in 2 <a href="http://www.virtualbox.org/">VirtualBox</a>
emulators, and nothing bad happened. That said, there are no warranties
of any kind. In the very unlikely event that something bad does happen
to your system, you have my sincere sympathy, but I can't be held
responsible for that.</strong></p>
<h2>Prerequisites</h2>
<p>To boot your computer in Lua you'll need:</p>
<ul><li>a 386 or better computer running Linux. I actually tested
this only on Pentium class computers, but it should run on a 386
without problems.</li><li><a href="http://www.gnu.org/software/grub/">GRUB</a>.
Since you're running Linux, chances are you're already using GRUB as
your bootloader. If not, you must install it. You don't need to install
it on your HDD; a floppy, an USB stick or even a CDROM will work as
well. I won't cover the GRUB installation procedure here, just google
for "install grub on floppy/usb/cdrom" and you'll sure find what you're
looking for. You can try for example <a href="http://orgs.man.ac.uk/documentation/grub/grub_3.html">here</a>, <a href="http://www.freesoftwaremagazine.com/articles/grub_intro/">here</a> or <a href="http://www.mayrhofer.eu.org/Default.aspx?pageindex=6&amp;pageid=45">here</a>.</li><li>The eLua ELF file. Download it from <a href="http://elua.berlios.de/surprise">here</a>. OR <a href="http://www.eluaproject.net/en/Downloads">download eLua</a> and compile it for the i386 architecture using a toolchain that you can build by following <a href="http://www.eluaproject.net/en/Building_GCC_for_i386">this tutorial</a>.</li><li>a text editor to edit your GRUB configuration file.</li></ul>
<p>The rest of this tutorial assumes that you're using Linux with GRUB,
and that GRUB is located in /boot/grub, which is true for many Linux
distributions (I'm using Ubuntu 8.04).</p>
<h2>Let's do this</h2>
<p>First, copy the <a href="http://elua.berlios.de/surprise">eLua ELF file</a> to your "/boot" directory:</p>
<pre><code>$ sudo cp surprise /boot<br></code></pre>
<p>Next you need to add another entry to your GRUB menu file (/boot/grub/menu.lst). Edit it and add this entry:</p>
<pre><code> title Surprise!<br> root (hd0,0)<br> kernel /boot/surprise<br> boot<br></code></pre>
<p>You may need to modify the root (hd0,0) line above to match your
boot device. The best way to do this is to look in the menu.lst file
for the entry that boots your Linux kernel. It should look similar to
this:</p>
<pre><code> title Ubuntu, kernel 2.6.20-16-generic<br> root (hd0,2)<br> kernel /boot/vmlinuz-2.6.20-16-generic<br> initrd /boot/initrd.img-2.6.20-16-generic<br> savedefault <br></code></pre>
<p>After you find it, simply use the root (hdx,y) line from that entry
(root (hd0,2) in the example above) in your newly created entry instead
of root (hd0,0).
That's it! Now reboot your computer, and when the GRUB boot menu
appears, choose "Surprise!" from it. You can even type dofile
"/rom/bisect.lua" to execute the "bisect.lua" test file. Enjoy!
As usual, if you need more details, you can <a href="http://www.eluaproject.net/en/Contact">contact us</a>.
Also, if you want to have you own USB stick that boots Lua, let me
know. If enough people manifest their interest in this, I'll add
another tutorial on how to do it (I already have an USB stick that
boots Lua, of course :) ).</p>
</div></body></html>

103
doc/pt/tut_bootstick.html Normal file
View File

@ -0,0 +1,103 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css"></head>
<body style="background-color: rgb(255, 255, 255);"><h3><a name="title" href="http://www.eluaproject.net/en/Booting_eLua_from_a_stick" class="local">Booting eLua from a stick</a></h3>
<div class="content">
<p>This is follow up of <a href="http://www.eluaproject.net/en/Booting_your_PC_in_eLua">this tutorial</a>.
After completing it you'll be able to boot eLua directly from your USB
stick (provided, of course, that your computer can boot from an USB
stick, which is true for most computers nowadays). You might want to
check the <a href="http://www.eluaproject.net/en/Booting_your_PC_in_eLua">boot your PC in eLua</a>
tutorial first for more details. If you have an old USB stick that you
don't use anymore, and/or the shear geekness of this idea makes you
feel curious, this tutorial is definitely for you :)</p>
<h2>Disclaimer</h2>
<p><strong>As mentioned <a href="http://www.eluaproject.net/en/Booting_your_PC_in_eLua">here</a>,
the code won't try to access any kind of storage (HDD, CDROM, floppy),
not even for reading, so you don't need to worry about that. Also it
doesn't try to reprogram your video card registers, so it can't harm it
or your monitor. It only implements a "protected mode keyboard driver"
that can't physically damage anything in your system. In short, I made
every effort to make the code as harmless as possible. I tested it on 5
different computers and in 2 <a href="http://www.virtualbox.org/">VirtualBox</a>
emulators, and nothing bad happened. That said, there are no warranties
of any kind. In the very unlikely event that something bad does happen
to your system, you have my sincere sympathy, but I can't be held
responsible for that. Also, I can't be held responsible if you mess up
your HDD by failing the GRUB installation procedure (even though, once
again, this shouldn't be possible unless you really insist on messing
it up). If you're new to computers, this tutorial might not be for you.
Your call.</strong></p>
<h2>Prerequisites</h2>
<p>To have your own bootable eLua USB stick you'll need:</p>
<ul><li>an USB stick. I tested this on an 128M USB stick, because
it's the smallest I could find. You should be OK with a 4M stick or
even a 2M stick</li><li>a computer running Linux. I use Ubuntu, but any other distribution is fine.</li><li><a href="http://www.gnu.org/software/grub/">GRUB</a>.
Since you're running Linux, chances are you're already using GRUB as
your bootloader. If not, you must install it on your HDD, or at least
know how to install it directly on the USB stick. I won't go into
details here, google it and you'll find lots of good articles about
GRUB. This tutorial assumes that you're using GRUB as your bootloader.</li><li>The eLua ELF file. Download it from <a href="http://elua.berlios.de/surprise">here</a>. OR <a href="http://www.eluaproject.net/en/Downloads">download eLua</a> and compile it for the i386 architecture using a toolchain that you can build by following <a href="http://www.eluaproject.net/en/Building_GCC_for_i386">this tutorial</a>.</li><li>a text editor to edit your GRUB configuration file.</li></ul>
<p>The rest of this tutorial assumes that you're using Linux with GRUB,
and that GRUB is located in /boot/grub, which is true for many Linux
distributions.</p>
<h2>Backup your stick</h2>
<p>Since the stick is going to be formatted, make sure to backup the
data from your stick first (you can copy it back after finishing the
tutorial).</p>
<h2>Partition and format your stick</h2>
<p>Depending on your stick, this step might not be required, but
chances are you'll need to re-partition and re-format your stick before
installing GRUB on it. The problem is that many sticks have a very
creative, non-standard partition table, and GRUB doesn't like that. I
looked at the partition table on my eLua USB stick, and it scared me to
death, so I had to follow this procedure. In short, you'll need to
delete all the partitions from your stick, create a new partition, and
then format it. For a step by step tutorial check here.</p>
<h2>Install GRUB on your stick</h2>
<p>First, mount your freshly formatted stick (I'm going to assume that the mount directory is /mnt):</p>
<pre><code> $ sudo mount /dev/sda1 /mnt<br></code></pre>
<p>(of course, you'll need to change /dev/sda1 to reflect the physical location of your USB stick).
Then copy the required GRUB files to your stick:</p>
<pre><code> $ cd /mnt<br> $ mkdir boot<br> $ mkdir boot/grub<br> $ cd /boot/grub<br> $ cp stage1 fat_stage1_5 stage2 /mnt/boot/grub<br></code></pre>
<p>Copy the <a href="http://elua.berlios.de/surprise">eLua ELF file</a> to the GRUB directory as well:</p>
<pre><code> $ cp surprise /mnt/boot/grub<br></code></pre>
<p>Create a menu.lst file for GRUB with you favorite text editor (I'm using joe):</p>
<pre><code> $ cd /mnt/boot/grub<br> $ joe menu.lst<br> title Surprise!<br> root (hd0,0)<br> kernel /boot/grub/surprise<br> boot<br></code></pre>
<p>Now it's time to actually install GRUB on the stick.</p>
<pre><code> $ sudo -s -H<br> # grub<br> Now we need to find the GRUB name of our USB stick. We'll use the "find" command from<br> GRUB and our "surprise" file to accomplish this:<br><br> grub&gt; find /boot/grub/surprise<br> (hd2,0)<br><br> GRUB should respond with a single line (like (hd2,0) above). If it gives you more <br> than one line, something is wrong. Maybe you also installed eLua on your HDD? If so, <br> delete the /boot/grub/surprise file from your HDD and try again.<br> You might get a different (hdx,y) line. If so, just use it instead of (hd2,0) in the rest of <br> this tutorial.<br><br> grub&gt; root (hd2,0)<br> grub&gt; setup (hd2)<br> Checking if "/boot/grub/stage1" exists... yes<br> Checking if "/boot/grub/stage2" exists... yes<br> Checking if "/boot/grub/fat_stage1_5" exists... yes<br> Running "embed /boot/grub/fat_stage1_5 (hd2)"... 15 sectors are embedded.<br> succeeded<br> Running "install /boot/grub/stage1 (hd2) (hd2)1+15 p (hd2,0)/boot/grub/stage2<br> /boot/grub/menu.lst"... succeeded<br> Done. <br> grub&gt; quit<br></code></pre>
<p>That's it! Now reboot your computer, make sure that your BIOS is set
to boot from USB, and enjoy! You can even type dofile "/rom/bisect.lua"
to execute the "bisect.lua" test file.
As usual, if you need more details, you can <a href="http://www.eluaproject.net/en/Contact">contact us</a>.</p>
</div></body></html>

288
doc/pt/tut_openocd.html Normal file
View File

@ -0,0 +1,288 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css"></head>
<body style="background-color: rgb(255, 255, 255);"><h3><a name="title" href="http://www.eluaproject.net/en/Using_OpenOCD" class="local">Using OpenOCD</a></h3>
<div class="content">
<h2>Quick downloads</h2>
<p>If you'd rather skip the long and boring OpenOCD introduction and
skip directly to the OpenOCD script downloads, use the links below.</p>
<ul><li><p><a href="http://www.eluaproject.net/en/Using_OpenOCD?p=Using_OpenOCD#str9files">Configuration files for STR9-comStick</a></p></li><li><p><a href="http://www.eluaproject.net/en/Using_OpenOCD?p=Using_OpenOCD#lpc2888files">Configuration files for LPC2888</a></p></li><li><p><a href="http://www.eluaproject.net/en/Using_OpenOCD?p=Using_OpenOCD#str7files">Configuration files for STR7</a></p></li></ul>
<h2>About OpenOCD</h2>
<p><a href="http://elua.berlios.de/tut_openocd.html">OpenOCD</a> is an open source tool that can be used to connect to a CPU's <a href="http://en.wikipedia.org/wiki/JTAG">JTAG</a>
interface. Using OpenOCD and a physical JTAG connection allows you to
burn the on-chip flash memory of your CPU (or to load your code
directly to RAM), to read the internal CPU memory (Flash/RAM) and to
use <a href="http://sourceware.org/gdb/">gdb</a> to debug your code.
Needless to say, this is a very handy tool (and especially handy if
your CPU happens to be built around an ARM core, since in this case you
can be almost certain that it has a JTAG interface that you can use).
That said, if your only goal is to burn your firmware, my personal
suggestion is to avoid using OpenOCD if possible. It has quite a steep
learning curve, because it is a command line tool that uses
configuration files with lots of different parameters, and this takes a
while to get used to. Worse, I feel that it is not very well
docummented. The project's wiki does give a few good pointers about all
the configuration parameters, and there are some good OpenOCD tutorials
out there, but none of them tells the whole story. And the syntax (and
even some commands) seems to change slightly between releases, which
makes things even more confusing. This is why I generally choose to use
a different firmware burning tool when available, and resort to OpenOCD
only for targets that lack a proper firmware burning tool. If you need
to debug your code, however, you probably want to use OpenOCD, since
the alternatives aren't cheap.
To summarize, you can forget about OpenOCD when:</p>
<ul><li><p>your CPU manufacturer provides a special tool for
firmware burning. This is quite often the case, but more often that not
the forementioned tools work only in Windows.</p></li><li><p>you
must debug your code, but you have a good intuition about where the
problem is located. In this case, simply connecting a LED to a PIO port
and turning it on and off from different parts of your code until you
figure out exactly what's the problem can work wonders. I can't
remember when was the last time I used gdb for debugging, since "LED
debugging" was all I needed. </p></li></ul>
<p>On the other hand, you should probably use OpenOCD when:</p>
<ul><li><p>your CPU manufacturer doesn't provide a special tool for firmware burning (or it does, but it's not what you need).</p></li><li><p>you're using Linux, MacOS or another OS that is not supported by the firmware burning tool.</p></li><li><p>you need to do some serious debugging in order to understand what's wrong with your application.</p></li></ul>
<p>If you decided that you don't need OpenOCD after all, now it's a
good time to navigate away from this page and save yourself from some
possible symptoms of headache. If you need OpenOCD, read on, I'll try
to make this as painless as possible. However, don't expect this to be
a full tutorial on OpenOCD, because it's not; my intention is to give
you just enough data to use OpenOCD for burning eLua on your board.
Because of this, I won't be covering debugging with OpenOCD here, just
firmware burning. And, before we begin, please read and understand the
next paragraph.</p>
<p>DISCLAIMER: using OpenOCD improperly may force your CPU to behave
unexpectedly. While physically damaging your CPU as a result of using
OpenOCD is very hard to accomplish, you might end up with a locked
chip, or you might erase a memory area that was not supposed to be
erased, you might even disable the JTAG interface on your chip (thus
rendering it unusable). If you modify the configuration scripts that
I'm going to provide, make sure that you know what you're doing. Also,
I'm not at all an OpenOCD expert, so my configuration scripts might
have errors, even though I tested them. In short, this tutorial comes
without any guarantees whatsoever.</p>
<h2>Getting OpenOCD</h2>
<p>If you're on Windows, the best place to get OpenOCD already compiled and ready to run is to visit the <a href="http://www.yagarto.de/">Yagarto home page</a>.
They provide a very nice OpenOCD installer, and they seem to keep up
with OpenOCD progress (the versions on the Yagarto site are not
"bleeding edge", but there are quite fresh nevertheless). If you're on
Linux, you can always use apt-get or your distribution-specific package
manager:</p>
<pre><code>$ sudo apt-get install openocd<br></code></pre>
<p>There is a catch here though: the OpenOCD version that I get from
apt-get is dated 2007-09-05, while the Yagarto OpenOCD version is from
2008-06-19. Since I'm using OpenOCD from Windows (because Ubuntu 8.04
doesn't seem to handle my USB-to-JTAG adapters very well), my
instructions are relevant to the Yagarto version. As mentioned in the
introduction, the meaning and parameters of different commands might
change between OpenOCD version, so if you want to use the Yagarto
version on your non Windows system, you'll have to build it from source
(see below).
The main resource on how to build OpenOCD from source is the <a href="http://openfacts.berlios.de/index-en.phtml?title=Building_OpenOCD">OpenOCD build page</a> from the OpenOCD wiki. Also, a very good tutorial can be found <a href="http://forum.sparkfun.com/viewtopic.php?t=11221">here</a>.
I'm not going to provide step by step build instructions, since the two
links that I mentioned cover this very well, and the build process is
relatively straightforward. However, since both tutorials describe how
to build the bleeding edge version of OpenOCD, you'll need a slight
modification do build the Yagarto version instead. The modification is
in the SVN checkout step. Replace this step:</p>
<pre><code>$ svn checkout svn://svn.berlios.de/openocd/trunk<br></code></pre>
<p>With this step ('717' is the SVN revision of the Yagarto OpenOCD build):</p>
<pre><code>$ svn checkout -r 717 svn://svn.berlios.de/openocd/trunk<br></code></pre>
<p>Follow the rest of the build instructions, and in the end you should have a working OpenOCD.</p>
<h2>Supported targets</h2>
<p>I couldn't find a good page with a list of the targets that are
supported by OpenOCD. So, if you want to check if your particular CPU
is supported by OpenOCD, I recommend getting the latest sources (as
described in the previous section) and listing the
trunk/src/target/target directory:</p>
<pre><code>$ ls trunk/src/target/target<br> at91eb40a.cfg<br> at91r40008.cfg<br> cfi.c<br> ....<br> str9comstick.cfg<br> ....<br></code></pre>
<p>If this listing has something that looks like your CPU name, you're
in luck. OpenOCD has support for LPC from NXP, AT91SAM cfrom Atmel,
STR7/STR9 from ST, and many others.</p>
<h2>Using OpenOCD</h2>
<p>To use OpenOCD, you'll need:</p>
<ul><li>the OpenOCD executable, as described above</li><li>a board with a JTAG interface</li><li>a JTAG adapter</li></ul>
<p>In some cases, your CPU board might provide a built in JTAG adapter. For example, my <a href="http://www.luminarymicro.com/products/lm3s8962_can_ethernet_evaluation_kit.html">LM3S8962</a>
board provides both an USB-to-JTAG and an USB-to-serial converter built
on board, switching between them automatically. The same is true for my
<a href="http://www.hitex.com/index.php?id=383">STR9-comStick</a>. On the other hand, my <a href="http://www.olimex.com/dev/sam7-ex256.html">SAM7-EX256</a> board has only a JTAG connector, I need a separate JTAG adapter to connect to it. I'm using <a href="http://www.olimex.com/dev/arm-usb-tiny.html">ARM-USB-TINY</a> from Olimex, but there are other affordable USB-to-JTAG adapters out there, like the Amontec <a href="http://www.amontec.com/jtagkey-tiny.shtml">JTAGKey-Tiny</a>. Not to mention that you can <a href="http://www.hs-augsburg.de/%7Ehhoegl/proj/usbjtag/usbjtag.html">build your ownt</a>.
Although USB is my interface of choice, you'll find JTAG adapters for
PC LPT ports too. The good news is that once you buy a JTAG adapter,
chances are that it will work with many boards with different CPUs,
since the JTAG connector layout is standardized and the JTAG adapters
are generally able to work with different voltages.
To actually use OpenOCD, you'll need a configuration file. The
configuration file is the one that lets OpenOCD know about your setup,
such as:</p>
<pre><code>* the kind of JTAG interface that you're using.<br>* the actual hardware platform you're using (ATM7TDMI, ARM966 and others).<br>* the memory configuration of your CPU (flash banks).<br>* the script used to program the flash memory.<br></code></pre>
<p>Presenting a list of all the possible configuration options and
their meaning is way beside the scope of this document, so I'm not
going to do it, I'll give an example instead. For the example I'm going
to use parts of my STR-comStick configuration file (comstick.cfg)
adapted from the OpenOCD distribution and from other examples (don't
worry, I'll provide full download links for this file later on). First
we need to tell OpenOCD that we're using a the STR9-comStick
USB-to-JTAG adapter:</p>
<pre><code>interface ft2232<br>ft2232_device_desc "STR9-comStick A"<br>ft2232_layout comstick<br>ft2232_vid_pid 0x0640 0x002C<br>jtag_speed 4<br>jtag_nsrst_delay 100<br>jtag_ntrst_delay 100<br></code></pre>
<p>Also, OpenOCD needs to know what's our target and its memory layout:</p>
<pre><code>target arm966e little run_and_init 1 arm966e<br>run_and_halt_time 0 50<br><br>working_area 0 0x50000000 32768 nobackup<br><br>flash bank str9x 0x00000000 0x00080000 0 0 0<br>flash bank str9x 0x00080000 0x00008000 0 0 0 <br></code></pre>
<p>This tells OpenOCD that our target is an ARM966-E running in little
endian mode, with two flash memory banks, one that starts at 0x0 and
it's 0x80000 bytes in size, and another one that starts at 0x80000 and
it's 0x8000 bytes in size. Finally, OpenOCD must know what's the name
of our script file (this is the file that is used to pysically program
the CPU memory):</p>
<pre><code>#Script used for FLASH programming<br>target_script 0 reset str91x_flashprogram.script<br></code></pre>
<p>The contents of the str91x_flashprogram.script is very target-dependent:</p>
<pre><code>wait_halt<br>str9x flash_config 0 4 2 0 0x80000<br>flash protect 0 0 7 off<br>flash erase_sector 0 0 7<br>flash write_bank 0 main.bin 0<br>reset run<br>sleep 10<br>shutdown<br></code></pre>
<p>I'm not even going to attempt to explain this one :) Basically it
unprotects the flash, erases it, writes the contents of "main.bin" to
flash, and then resets the CPU. If you need to flash a file with a
different name, the only thing you need to modify is the "main.bin" in
the "flash write_bank" line.
To use all this, you need to tell OpenOCD to use our configuration file:</p>
<pre><code>openocd-ftd2xx -f comstick.cfg<br></code></pre>
<p>(note: under Windows, the OpenOCD executable name is often
"openocd-ftd2xx". Under Linux it's simply "openocd". Replace it with
the actualy name with your executable.)
That's it for your OpenOCD crash course. I realise that there's much
more to learn, so here's a list of links with much better information
on the subject:</p>
<ul><li><a href="http://www.hs-augsburg.de/%7Ehhoegl/proj/openocd/oocd-quickref.pdf">OpenOCD quick reference</a> card. (slightly outdated)</li><li>A very good OpenOCD tutorial.</li><li><a href="http://openfacts.berlios.de/index-en.phtml?title=OpenOCD_scripts">OpenOCD configuration examples</a> from the official OpenOCD wiki.</li><li>An excellent page about using <a href="http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/openocd_intro/index.html">OpenOCD with ARM controllers</a>, with lots of real life examples.</li><li>An interesting <a href="http://forum.sparkfun.com/viewtopic.php?p=42079">topic on the SparkFun forum</a> about STR9 and OpenOCD.</li></ul>
<p><a name="str9files"></a></p>
<h2>Configuration files for STR9-comStick</h2>
<p>Download them below:</p>
<p><a href="http://elua.berlios.de/other/comstick.cfg">comstick.cfg</a></p>
<p><a href="http://elua.berlios.de/other/str91x_flashprogram.script">str91x_flashprogram.script</a></p>
<p><a href="http://elua.berlios.de/other/comrst.cfg">comrst.cfg</a></p>
<p><a href="http://elua.berlios.de/other/str91x_reset.script">str91x_reset.script</a></p>
<p>The comstick.cfg configuration file is for prorgramming the
STR9-comStick. comrst.cfg is for resetting it. The comStick has a very
interesting habit: after you power it (via USB) it does not start
executing the code from the internal flash, you need to execute OpenOCD
with the comreset.cfg script to start it. This script does exactly what
it says: executes a CPU reset (since the board doesn't have a RESET
button). This is a very peculiar behaviour, and I'm not sure if it's
generic or it's only relevant to my particular comStick. I suspect that
the CPU RESET line isn't properly handled by the on-board USB-to-JTAG
converter, and the only solution I have for this is to execute this
script everytime you power the board and everytime you need to do a
RESET.</p>
<p><a name="lpc2888files"></a></p>
<h2>Configuration files for LPC2888</h2>
<p>LPC2888 is quite a different animal. I couldn't find any "official"
LPC2888 configuration file for OpenOCD, so I had to learn how to write
my own. It works, but I suspect it can be improved. This time, the
configuration file applies to the latest (SVN) version of OpenOCD, so
read this tutorial to understand how to get the latest OpenOCD sources
and how to compile them (this section is based on version 922 of the
OpenOCD repository). Then use the next file to burn your binary image
to the chip:</p>
<p><a href="http://elua.berlios.de/other/lpc2888.cfg">lpc2888.cfg</a></p>
<p>If your image name is not main.bin edit the file and change the
corresponding line (flash write_bank 0 main.bin 0), then invoke openocd
like this:</p>
<pre><code>openocd -f lpc2888.cfg<br></code></pre>
<p>I'm using <a href="http://www.olimex.com/dev/arm-usb-tiny.html">ARM-USB-TINY</a>
from Olimex, but it should be easy to use the script with any other
JTAG adapter (don't forget to change the script to match your adapter).</p>
<p><a name="str7files"></a></p>
<h2>Configuration files for STR711FR2 (STR7 from ST)</h2>
<p>Download them below:</p>
<p><a href="http://elua.berlios.de/other/str7prg.cfg">str7prg.cfg</a></p>
<p><a href="http://elua.berlios.de/other/str7_flashprogram.script">str7_flashprogram.script</a></p>
<p><a href="http://elua.berlios.de/other/str7rst.cfg">str7rst.cfg</a></p>
<p><a href="http://elua.berlios.de/other/str7_reset.script">str7_reset.scrip</a></p>
<p>For STR7 I'm using the Yagarto OpenOCD build for Windows (repository
version 717, as described at the beginning of this tutorial). The
str7prg.cfg configuration file is for prorgramming the STR9-comStick.
str7rst.cfg is for resetting it. I'm using a STR711FR2 heard board from
<a href="http://www.sctec.com.br/content/view/101/30/">ScTec</a> to
which I attached a few LEDs and a MAX3232 TTL to RS232 converter for
the serial communication. The board comes with its own JTAG adadpter,
but it uses a parallel interface, and since my computer doesn't have
one, I used the <a href="http://www.olimex.com/dev/arm-usb-tiny.html">ARM-USB-TINY</a> from Olimex. To use them, invoke the OpenOCD executable like this:</p>
<pre><code>openocd-ftd2xx -f str7prg.cfg<br></code></pre>
<p>(note: under Windows, the OpenOCD executable name is often
"openocd-ftd2xx". Under Linux it's simply "openocd". Replace it with
the actualy name with your executable.)
Also, be sure to modify str7_flashprogram.script if your image name is
not main.bin.</p><p></p><p></p><p></p><p> </p>
</div></body></html>

7
doc/pt/tutorials.html Normal file
View File

@ -0,0 +1,7 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css"></head>
<body style="background-color: rgb(255, 255, 255);"><h3><a name="title" href="http://www.eluaproject.net/en/Booting_eLua_from_a_stick"></a><span class="info">eLua Tutorials</span></h3><br></body></html>

75
doc/pt/uart_ref.html Normal file
View File

@ -0,0 +1,75 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body style="background-color: rgb(255, 255, 255);">
<h3><a name="over"></a>uart</h3>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="setup"></a>[uart.setup(</font><font face="Bitstream Vera Sans Mono, sans-serif"> id, baud,
databits, </font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">uart.PARITY_EVEN
|uart.</font><font face="Bitstream Vera Sans Mono, sans-serif">PARITY</font><font face="Bitstream Vera Sans Mono, sans-serif">_ODD | uart.</font><font face="Bitstream Vera Sans Mono, sans-serif">PARITY</font><font face="Bitstream Vera Sans Mono, sans-serif">_NONE, </font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">uart.STOPBITS_1
| uart.STOPBITS_1_5 | uart.STOPBITS_2
)]&nbsp;&nbsp;&nbsp;&nbsp; Actual_baud = uart.setup(
id, baud, databits, </font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">uart.PAR_EVEN
|uart.PAR_ODD | uart.PAR_NONE, </font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">uart.STOP_1 |
uart.STOP_1_5 | uart.STOP_2 ): set the UART interface with the</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">given
parameters, returns the baud rate that was set for the UART.</font>
</p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><br>
</font></p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="send"></a>[</font><font face="Bitstream Vera Sans Mono, sans-serif">uart.send] </font><font face="Bitstream Vera Sans Mono, sans-serif">uart.send( id,
Data1, Data2, ... ): send all the data to the specified UART interface.</font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">#### Data 1 only
!?!!<br>
</font></p>
<p style="margin-bottom: 0in;">
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><br>
</font></p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif"><a name="recv"></a>[</font><font face="Bitstream Vera Sans Mono, sans-serif">uart.recv(</font><font face="Bitstream Vera Sans Mono, sans-serif"> id,
uart.TIMEOUT_NO | <strike>uart.TIMEOUT_INFINITE</strike> |
timeout )</font><font face="Bitstream Vera Sans Mono, sans-serif">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font face="Bitstream Vera Sans Mono, sans-serif">Data =
uart.recv( id, uart.NO_TIMEOUT | uart.INF_TIMEOUT | timeout ): reads a </font>
</p>
<p style="margin-bottom: 0in;"> <font face="Bitstream Vera Sans Mono, sans-serif">byte from the
specified UART interface.</font></p>
<p style="margin-bottom: 0in;"></p>
<p style="margin-bottom: 0in;"></p>
<p style="margin-bottom: 0in;"></p>
<p style="margin-bottom: 0in;"></p>
<p style="margin-bottom: 0in;"></p>
<p style="margin-bottom: 0in;"></p>
<p style="margin-bottom: 0in;"></p>
<p style="margin-bottom: 0in;"></p>
<p style="margin-bottom: 0in;"></p>
<p style="margin-bottom: 0in;"></p>
<p style="margin-bottom: 0in;"></p>
<p style="margin-bottom: 0in;"></p>
<p style="margin-bottom: 0in;"></p>
<p style="margin-bottom: 0in;"></p>
<p style="margin-bottom: 0in;"></p>
<p style="margin-bottom: 0in;"></p>
<p style="margin-bottom: 0in;"></p>
<p style="margin-bottom: 0in;"></p>
<p style="margin-bottom: 0in;"></p>
<p style="margin-bottom: 0in;"></p>
<p style="margin-bottom: 0in;"></p>
<p style="margin-bottom: 0in;"></p>
<br>
</body></html>

78
doc/pt/using.html Normal file
View File

@ -0,0 +1,78 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css"></head>
<body style="background-color: rgb(255, 255, 255);">
<h3>Using eLua</h3><p> So, you already built and installed eLua and now it is time to have fun with it. It's actually quite easy: all you need is your
board connected to a PC, running a terminal emulation program.<br>If
you're using Windows, I strongly recommend <a href="http://www.ayera.com/teraterm/">TeraTerm</a>.
It's a freeware, it's very powerful and also easy to use. The native Hyper Terminal progam can do too.&nbsp;<br>On
Linux,
you'll probably be stucked with minicom. It is not exactly intuitive
and it runs in text mode, but it's still very powerful. If you
google for "minicom tutorial" you'll get the hang of it in no time. You
can try any other terminal emulator, as long as you set it up
properly and it gives you the option of transferring files
via XMODEM, which is what eLua uses at the moment. These are the main
settings you need to look at:</p>
<ul><li>port setup: 115200 baud (38400 for <a href="http://www.eluaproject.net/en/eLua_on_STR7_CPUs">STR7)##</a>, 8N1(8 data bits, no parity, one stop bit). </li><li>hardware flow control: none</li><li>newline handling: "CR" on receive, "CR+LF" on send (some terminal programs won't give you a choice here). </li></ul>
<p>Also, depending on the type of your board, you'll need some way to
connect the board to a serial port on your PC or to USB if you're
using an USB to serial converter. For example, as already explained <a href="http://www.eluaproject.net/en/eLua_on_LM3S_CPUs">here</a>##,
the USB port on the LM3Sxxxx boards is dual, so you can use it as an USB
to serial converter after downloading your firmware, thus you don't
need any other type of connection. The same is true for the
STR9-comStick board. On the other hand, for the SAM7-EX256 board you'll
need to connect a serial cable to the "RS232" connector, provided that
the jumpers are already set as explained <a href="http://www.eluaproject.net/en/eLua_on_AT91SAM_CPUs">here##</a> and on the MOD711 you will need to add an RS232 converter chip.</p>
<p>After you setup this PC-eLua board connection and press the "RESET" button on your board, you should see the
eLua shell prompt. For your
convenience, the shell documentation is also provided on this page.</p>
<h2><a name="shell"></a></h2><h2>The eLua shell</h2>
<p>After you burn eLua to your board and you connect the board to your terminal
emulator running on the PC, you'll be greeted with the eLua shell prompt, which
allows you to:</p>
<ul><li>get help on shell usage with the help command</li><li>run the Lua interpreter in interactive mode just like on do on&nbsp;Linux, Windows and MacOS</li><li>run a Lua program from the eLua File System</li><li>upload a Lua source file via XMODEM and execute in on board</li><li>query the eLua version</li><li>list files on eLua File Systems<br></li></ul><p>More details about some of the shell commands are presented below.</p>
<h2><span style="font-style: italic;"><a name="recvcmd"></a></span>The "recv" command</h2>
<p>To use this, your eLua taret image must be built with support for XMODEM (see
docs/elua_components.txt for details). Also, your terminal emulation program must
support sending files via the XMODEM protocol. Both XMODEM with checksum (the
original version) and XMODEM with CRC are supported, but only XMODEM with 128
byte packets is allowed (XMODEM with 1K packets won't work).
To use this feature, enter "recv" at the shell prompt. eLua will respond with
"Waiting for file ...". At this point you can send the file to the eLua board
via XMODEM. eLua will receive and execute the file. Don't worry when you see 'C'
characters suddenly appearing on your terminal after you enter this command,
this is how the XMODEM transfer is initiated.</p>
<h2><a name="luacmd"></a>The "lua" command</h2>
<p>This allows you to start the Lua interpreter, optionally passing&nbsp;command line parameters, just
as you would do from a Linux, Windows or MacOS command prompt. This command has some
restrictions:</p>
<ul><li>the command line can't be longer than 50 chars</li><li>character escaping is not implemented. For example, the next command won't work
because of the ' escape sequences:</li></ul>
<p>eLua# lua -e 'print('Hello, World!')' -i<br>
Press CTRL+Z to exit Lua<br>
lua: (command line):1: unexpected symbol near ''<br></p>
<p>However, if you use both '' and "" for string quoting, it will work:</p>
<p>eLua# lua -e 'print("Hello, World")' -i<br>
Press CTRL+Z to exit Lua<br>
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
Hello,World</p><p></p><p></p><p></p>
</body></html>

View File

@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="en-us"><title>Product</title>
<link rel="stylesheet" type="text/css" href="../style.css"></head>
<body style="background-color: rgb(255, 255, 255);"><h3><a name="title" href="http://www.eluaproject.net/en/Using_OpenOCD" class="local"></a>eLua Version's History</h3>
<div class="content"><span style="text-decoration: underline;"><span style="font-weight: bold;"></span></span><br></div></body></html>