Monday, September 10, 2012

Enable Lumen multitasking framework on TS-7260 board


Lumen is a Lua-based framework to develop portable multitasking applications. It is very simple, consists just a scheduler that manage Lua coroutines to achieve multitasking, and no C code involved. I would like to use it on my TS-7260 board, after having enable Lua scripting on it (see my previous blog Enable Lua scripting on TS-7260 board).

I used the followings steps to try Lumen on my TS-7260 board:
  1. Obtained latest Lumen code from GitHub into my desktop PC.
  2. Tried running the test program tests/test.lua on my desktop PC, which also has Lua 5.2.1 installed. The test program terminated prematurely. I later found out that the following modification (in function M.idle, in file sched.lua) is needed, has to be changed to After this change, the test program ran and terminated properly, as shown below:
  3. Lumen has a shell task that depends on NIXIO for telnet access. Next, I obtained the latest NIXIO code and cross-compiled it for TS-LINUX, as shown below:
    1. Added the following code into NIXIO main makefile:
    2. Replaced all reference to luaL_reg with luaL_Reg in NIXIO C files
    3. Built C module of NIXIO (nixio.so) as below:
    4. Copied files fs.lua and util.lua in directory lua/nixio to TS-7260 board, placed it under directory /root/nixio.
    5. Copied file nixio.so to TS-7260 board, placed it under directory /root/nixio. Enabled executable permission (chmod +x) to it.
  4. Copied Lumen files to TS-7260 board, place them under directory /root/Lumen.
  5. Set environment variables LUA_PATH and LUA_CPATH as below:
  6. Tried running the test program tests/test.lua on TS-7260 board: and got the same result as in step 2 above. So, Lumen has just worked on TS-7260 board.
  7. Tried starting the shell task of Lumen on TS-7260 board, which was listening to port 2012 for telnet access: From a desktop PC, telnet to the shell task as below: I am now able to remotely run Lua codes via the shell task.

No comments:

Post a Comment