mirror of
https://github.com/elua/elua.git
synced 2025-01-25 01:02:54 +08:00
faa0485013
Ongoing work
102 lines
5.4 KiB
HTML
102 lines
5.4 KiB
HTML
<!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, but now you don't know
|
|
what to do with it. It's actually quite easy: all you need is your
|
|
board connected to the computer and a terminal emulation program. 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. On Linux,
|
|
you'll probably be stucked with minicom. It's not exactly intuitive,
|
|
and it runs in text mode, but it's still very powerful, and if you
|
|
google for "minicom tutorial" you'll get the hang of it in no time. Or
|
|
you can try any other terminal emulator, as long as you set it up
|
|
properly (and as long as 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>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 LM3S7862 board 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>.</p>
|
|
|
|
<p>After you press the "RESET" button on your board, you should see the
|
|
eLua shell prompt. Up to date documentation of how to use the shell is
|
|
always included in the distribution (docs/the_elua_shell.txt). For your
|
|
convenience, the shell documentation is also provided on this page.</p>
|
|
|
|
<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>run 'lua' as you would run it from the Linux or Windows command prompt</li><li>upload a Lua source file via XMODEM and execute in on board</li><li>query the eLua version</li><li>get help on shell usage</li></ul>
|
|
|
|
<p>To enable the shell, define BUILD_SHELL in your build.h file, and also
|
|
BUILD_XMODEM if you want to use the "recv" command (see below). See
|
|
docs/elua_components.txt for more details about enabling the shell.</p>
|
|
|
|
<p>You'll need to configure your terminal emulation program to connect to your eLua
|
|
board. These are the parameters you'll need to set for your serial connection:</p>
|
|
|
|
<ul><li>speed 115200, 8N1 (8 data bits, no parity, one stop bit)</li><li>no flow control</li><li>newline handling (if available): CR on receive, CR+LF on send</li></ul>
|
|
|
|
<p>After you setup your terminal program, press the RESET button on the bord.
|
|
When you see the "eLua# " prompt, just enter "help" to see the on-line shell
|
|
help:</p>
|
|
|
|
<p>eLua# help<br>
|
|
Shell commands:<br>
|
|
help - print this help<br>
|
|
lua [args] - run Lua with the given arguments<br>
|
|
recv - receive a file (XMODEM) and execute it<br>
|
|
ver - print eLua version<br>
|
|
exit - exit from this shelll<br></p>
|
|
|
|
<p>More details about some of the shell commands are presented below.</p>
|
|
|
|
<h2>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>The "lua" command</h2>
|
|
|
|
<p>This allows you to start the Lua interpreter with command line parameters, just
|
|
as you would do from a Linux or Windows 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>
|
|
</body></html> |