diff --git a/doc/en/arch_con_term.html b/doc/en/arch_con_term.html new file mode 100644 index 00000000..04959c53 --- /dev/null +++ b/doc/en/arch_con_term.html @@ -0,0 +1,89 @@ + +
+ +In eLua, a console and a terminal serve two related, but different purposes: +
Both components can be enabled and disabled as needed (they don't rely on each other). See building eLua for details on how to enable and disable components.
+The serial console input/output is handled by a generic layer (src/newlib/genstd.c) that can be used to easily adapt the console subsystem to a variety of input/output devices. + It needs just two functions, one for displaying characters and another one for receiving input with timeout:
+// Send/receive function types
+typedef void ( *p_std_send_char )( int fd, char c );
+typedef int ( *p_std_get_char )( s32 to );
+
+(the send faction gets an additional fd parameter that you can use to differentiate between the standard C stdout and stderr output streams).
+To set them, use std_set_send_func and std_set_get_func, both defined in inc/newlib/getstd.h. Usually they are called from src/common.c and configured to work + over UART by default:
+// *****************************************************************************
+// std functions and platform initialization
+
+static void uart_send( int fd, char c )
+{
+ fd = fd;
+ platform_uart_send( CON_UART_ID, c );
+}
+
+static int uart_recv( s32 to )
+{
+ return platform_uart_recv( CON_UART_ID, TERM_TIMER_ID, to );
+}
+
+void cmn_platform_init()
+{
+ // Set the send/recv functions
+ std_set_send_func( uart_send );
+ std_set_get_func( uart_recv );
+}
+
+If you need another type of serial console device (for example a dedicated console running over a SPI connection) just call std_set_send_func/std_set_get_func with the appropriate + function pointers.
+To enable serial consoles, define the BUILD_CON_GENERIC macro in your platform's platform_conf.h file.
+TCP/IP consoles have the same functionality as serial consoles, but they work over a TCP/IP connection using the telnet protocol. As they integrate directly with the TCP/IP subsystem, + they don't have the same generic function based mechanism as serial consoles. To enable TCP/IP consoles, define the BUILD_CON_TCP macro in your platform's platform_conf.h file.
+Besides standard stdio/stdout/stderr support provided by consoles, eLua uses the "term" module to access ANSI compatible terminal emulators. It is designed to be as flexible as + possible, thus allowing a large number of terminal emulators to be used. To enable terminal support, add BUILD_TERM in your platform's platform_conf.h file. To use it, initialize + it with a call to term_init: +
...........................
+// Terminal output function
+typedef void ( *p_term_out )( u8 );
+// Terminal input function
+typedef int ( *p_term_in )( int );
+// Terminal translate input function
+typedef int ( *p_term_translate )( u8 );
+...........................
+// Terminal initialization
+void term_init( unsigned lines, unsigned cols, p_term_out term_out_func,
+ p_term_in term_in_func, p_term_translate term_translate_func );
+
+The initialization function takes the physical size of the terminal emulator window (usually 80 lines and 25 cols) and three function pointers: +
...........................
+_D( KC_UP ),\
+_D( KC_DOWN ),\
+_D( KC_LEFT ),\
+...........................
+_D( KC_ESC ),\
+_D( KC_UNKNOWN )
+...........................
+By using this function, it is possible to adapt a very large number of "term emulators" to eLua. For example, you might want to run eLua in a "standalone
+ mode" that does not require a PC at all, just an external LCD display and maybe a keyboard for data input. Your eLua board can connect to this standalone terminal using its
+ I/O pins or built in peripherals, for example via SPI. By writing the three functions described above, the effort of making eLua work with this new type of device is minimal,
+ and also writing an "ANSI emulator" for your terminal device is not hard.For an example, see src/main.c, where these functions are implemented for an UART connection with a terminal emulator program running on PC.
+eLua also provides a Lua module (called term) that can be used to access ANSI terminal. See the term module API for a full description of this module.
+ diff --git a/doc/en/arch_romfs.html b/doc/en/arch_romfs.html new file mode 100644 index 00000000..8a8bcfa5 --- /dev/null +++ b/doc/en/arch_romfs.html @@ -0,0 +1,62 @@ + + + +The ROM file system (ROMFS) is a small, read-only file system built for eLua. It is integrated with the C + library, so you can use standard POSIX calls (fopen/fread/fwrite...) to access it. It is also accessible directly from Lua via the io module. + The files in the file system are part of the eLua binary image, thus they can't be modified after the image is + built. For the seame reason, you can't add/delete files after the image is built. ROMFS doesn't support directories.
+ROMFS is integrated with the build system for maximum flexibility on various platforms. As a result, you can select the ROMFS contents for each board on which + eLua runs. Moreover, you can specify what applications (instead of individual files) go to the file system, as a real application might need more than a single Lua program + to run (for example a HTTP page with all its dependencies).
+To use ROMFS, you have to copy the required files to the romfs/ directory. Keep in mind that the maximum file name of a ROMFS file is 14 characters, including the dot between the file + name and its extension. Make sure that the file names from romfs/ follow this rule. Then edit the main build script (SConstruct) to add a new application/modify an existing one. + All the applications that can be included in ROMFS are defined in the romfs array in SConstruct. Each application in the romfs array lists its files, as shown below + (note that ltthpd, tvbgone and pong applications require more than one file in order to run):
+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' ]
+}
+After this, you need to decide the application-to-board mapping. This is defined in another array in SConsctruct, named file_list. The definition of this array is shown below, + the format is self-explanatory:
+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' ],
+ 'EK-LM3S6965' : [ 'bisect', 'hangman', 'lhttpd', 'pong', 'led', 'piano', 'pwmled', 'tvbgone', 'hello', 'info', 'morse', 'adcscope' ],
+ 'STR9-COMSTICK' : [ 'bisect', 'hangman', 'led', 'hello', 'info' ],
+ 'PC' : [ 'bisect', 'hello', 'info', 'life' ],
+ 'LPC-H2888' : [ 'bisect', 'hangman', 'led', 'hello', 'info' ],
+ 'MOD711' : [ 'bisect', 'hangman', 'led', 'hello', 'info', 'dualpwm' ],
+ 'STM3210E-EVAL' : [ 'bisect', 'hello', 'info' ],
+ 'ATEVK1100' : [ 'bisect', 'hangman', 'led', 'hello', 'info' ],
+ 'ET-STM32' : [ 'hello', 'hangman', 'info', 'bisect' ],
+ 'EAGLE-100' : [ 'bisect', 'hangman', 'lhttpd', 'led', 'hello', 'info' ]
+}
+
+What's left to do is biuld eLua. As part of the build process, mkfs.py will be called, which will read the contents of the romfs/ directory and + output a C header file that contains a binary description of the file system. To use ROMFS from C code, whevener you want to access a file, prefix its name with /rom/. For example, + if you want to open the a.txt file in ROMFS, you should call fopen like this:
+f = fopen( "/rom/a.txt", "rb" )
+If you want to execute one file from the ROM file system with Lua, simply do this from the shell:
+eLua# lua /rom/bisect.lua
+Or directly from Lua:
+> dofile "/rom/bisect.lua"
+
+
diff --git a/doc/en/building.html b/doc/en/building.html
index 2935f67d..89e72ac2 100644
--- a/doc/en/building.html
+++ b/doc/en/building.html
@@ -19,7 +19,7 @@ package
manager you'll need to translate the "apt-get" calls to your specific
distribution.
eLua# lua -e 'print('Hello, World!')' -i
+eLua# lua -e 'print(\'Hello, World!\')' -i
Press CTRL+Z to exit Lua
lua: (command line):1: unexpected symbol near ''
-However, if you use both '' and "" for string quoting, it will work:
+However, if you use both '' (simple quotes) and "" (double quotes) for string quotin , it will work:
-eLua# lua -e 'print("Hello, World")' -i
-Press CTRL+Z to exit Lua
+eLua# lua -e 'print("Hello, World")' -i
+Press CTRL+Z to exit Lua
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
-Hello,World
+Hello,World
If you want to execute a file from the ##ROM file system, remember to prefix it with /rom. For example, to execute hello.lua, do this:
$ lua /rom/hello.lua
ls or dir
Shows a list of all the files in the filesystems used by eLua (currently only the ROM file system), as well as their size and the total size of the given file system.
exit
Exits the shell. This only makes sense if eLua is compiled with terminal support over TCP/IP , as it closes the telnet session to the eLua board. Otherwise it just
- terminates the shell and blocks forever until you reset your board.
+ terminates the shell and blocks forever until you reset your board.
Cross-compiling your eLua programs
Cross-compilation is the process of compiling a program on one hardware platform for a
different hardware platform. For example, the process of compiling the eLua binary image on
@@ -126,7 +126,7 @@ board you have some important advantages:
might be able to overcome this by compiling the Lua program on the PC and
running the bytecode instead. Also, compiling large Lua programs on your
eLua board can lead to stack overflows, which in turn leads to very
- hard to find errors.
+ hard to find errors.
In order to use cross-compilation, the two Lua targets (in this case your desktop PC and your eLua board) must be compatible
(they should have the same data types, with the same size and the same memory
@@ -204,7 +204,7 @@ Available options are:
You can omit the -s (strip) parameter from compilation, but this will result in larger bytecode files (as the debug information is not stripped if you don't use -s).
You can use your bytecode file in two ways:
- - upload it to ##the ROM file system and execute it from there.
+ - write it to the ROM file system and execute it from there.
- use the recv command from the shell to upload it to the board using a serial connection.
diff --git a/doc/wb/wb_usr.lua b/doc/wb/wb_usr.lua
index e0e8c951..8b952f89 100755
--- a/doc/wb/wb_usr.lua
+++ b/doc/wb/wb_usr.lua
@@ -218,6 +218,9 @@ wb_usr.tree =
{ name = { en = "Modules and LTR", pt = "##Module and LTR" },
link = "arch_ltr.html",
},
+ { name = { en = "Consoles and terminals", pt = "##Consoles and terminals" },
+ link = "arch_con_term.html",
+ },
{ name = { en = "eLua coding style", pt = "##eLua coding style" },
link = "arch_coding.html",
},
diff --git a/doc/wb_search_en.txt b/doc/wb_search_en.txt
index 5910333e..fa98068d 100644
--- a/doc/wb_search_en.txt
+++ b/doc/wb_search_en.txt
@@ -3,7 +3,7 @@ en/tut_bootstick.html
en/dl_binaries.html
en/arch_overview.html
en/status.html
-en/comunity.html
+en/arch_con_term.html
en/installing_lm3s.html
en/tut_bootpc.html
en/news.html
@@ -17,22 +17,23 @@ en/tutorials.html
en/arch_coding.html
en/tut_openocd.html
en/refman.html
-en/arch_romfs.html
en/doc.html
+en/arch_romfs.html
en/net_ref.html
+en/arch_newport.html
en/arch_ltr.html
en/installing_avr32.html
en/installing_str7.html
en/installing_at91sam7x.html
en/installing.html
-en/arch_newport.html
+en/tc_arm.html
en/using.html
en/versionhistory.html
en/toolchains.html
en/dl_old.html
en/examples.html
-en/tc_arm.html
en/tchainbuild.html
+en/comunity.html
en/installing_str9.html
en/installing_stm32.html
en/arch.html
diff --git a/doc/wb_search_pt.txt b/doc/wb_search_pt.txt
index 8219019c..b0a237e1 100644
--- a/doc/wb_search_pt.txt
+++ b/doc/wb_search_pt.txt
@@ -3,7 +3,7 @@ pt/tut_bootstick.html
pt/dl_binaries.html
pt/arch_overview.html
pt/status.html
-pt/comunity.html
+pt/arch_con_term.html
pt/installing_lm3s.html
pt/tut_bootpc.html
pt/news.html
@@ -17,22 +17,23 @@ pt/tutorials.html
pt/arch_coding.html
pt/tut_openocd.html
pt/refman.html
-pt/arch_romfs.html
pt/doc.html
+pt/arch_romfs.html
pt/net_ref.html
+pt/arch_newport.html
pt/arch_ltr.html
pt/installing_avr32.html
pt/installing_str7.html
pt/installing_at91sam7x.html
pt/installing.html
-pt/arch_newport.html
+pt/tc_arm.html
pt/using.html
pt/versionhistory.html
pt/toolchains.html
pt/dl_old.html
pt/examples.html
-pt/tc_arm.html
pt/tchainbuild.html
+pt/comunity.html
pt/installing_str9.html
pt/installing_stm32.html
pt/arch.html
diff --git a/doc/wb_tree_en.html b/doc/wb_tree_en.html
index d2e81396..91a2be69 100644
--- a/doc/wb_tree_en.html
+++ b/doc/wb_tree_en.html
@@ -273,177 +273,178 @@
-
+
+
-
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
+
+
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
+
+
+
+
+
-
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
-
+
-
-
+
+
-
+
diff --git a/doc/wb_tree_pt.html b/doc/wb_tree_pt.html
index 986777f0..44dd91da 100644
--- a/doc/wb_tree_pt.html
+++ b/doc/wb_tree_pt.html
@@ -219,231 +219,232 @@
eLua
-
+
-
-
-
-
-
-
+
+
+
+
+
+
-
+
-
-
+
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
+
-
-
-
-
+
+
+
+
-
-
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
+
+
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
+
+
+
+
+
-
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
-
+