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.

Friday, September 7, 2012

Enable Lua scripting on TS-7260 board

Lua is a powerful, fast, lightweight, embeddable scripting language. I would like to use it on my TS-7260 board. I use the following steps:
  1. Download the latest Lua 5.2.1 source code and unzip it to local directory (c:/lua-5.2.1).
  2. Setup TS-Linux cross compilation environment in a cygwin shell as below:
  3. Since there is no readline support for TS-Linux, comment out line 46 of file src/luaconf.h to exclude LUA_USE_READLINE.
  4. Compile all C files of Lua as below:
  5. Build Lua shared library liblua.so.1.0.1 as below:
  6. Build Lua executable lua as below:
  7. Copy Lua shared library and Lua executable to TS-7260 board, place them is directory /lib and /usr/bin respectively.
  8. In directory /lib, enable executable permission and create a symbolic link for liblua.so.1.0.1 as below:
  9. In directory /usr/bin, enable executable permission for lua as below:
  10. Type "lua" in a TS-Linux bash shell and expect the following greeting from Lua:
  11. You are ready to run Lua script on TS-7260.

Mid-Career Crisis

I am currently in a start-up business with two other partners but the business doesn't seem to pick up at all despite we putting in money and time to keep it alive. Personal conflict among partners about our business direction grows bigger and we are gradually losing my confidence and momentum to work. Everyday I am just counting the day when I will leave the start-up.

But, here comes my next bigger problem: What am I going to do after that?

So, I am facing my mid-career crisis now. How can I get out of this crisis?

My inner voice tell me that I need to start planning now for my next career.

So, what would I like to do next?

I see a number of choices.

Back to employment

Now I really like/miss the life of getting a pay check every month.

Maybe I could do a U-turn and go back to my ex-company. That could be my easiest way to get employed again. I have a feeling that my ex-company still need my experience and skill (and to solve old bugs that I left in their software). I just need to send them a signal. But, I feel ashamed to do that. I just don't feel comfortable to face my ex-colleagues again.

I also feel very reluctant to go through the formal process of job application (job search, resume writing, job interview, etc.) again. At this middle-age, I know my chance of getting an interview through this formal process is very slim. I don't want to waste my time.

What I could hope for is through the back-door process, that is to get a job through introduction/recommendation by friends/contacts working in companies. But, again I feel ashamed to tell my friends or contacts that my start-up has failed and I need a job urgently. I think I will wait for the moment when I have to tell them the truth (when I can't hide any more) and hopefully they will introduce me a job opening. Anyway, I don't have many friends or contacts either.

I have been working as software engineer in a number of software factories/sweatshops since I started working. Really, I hate the life of software engineer. If possible, I don't want to get into this again.

See, I am still quite choosy about my next job. Do I have a choice now?

Start a new business myself

I don't have much experience, network nor communication skill as a businessman. But I think that is not important. With a spirit of entrepreneurship, I think what's most important is to ask myself: what can I sell that most people want.

My current startup (though it looks like going to fail) has taught me a few lessons:
  • know your customer well.
  • sell thing that your customer really need (to solve their problem or to save their money), and be quick.
  • sell a total solution, not just a piece of software/hardware.
  • sell thing that is niche/specialized in the market.
I know I am not born/grow to be a entrepreneur. I need to ask myself, do I have the gut to start and run a business. What drive/motivate me to be an entrepreneur? How can I made use of my job experience and (software development) skills? All that need time and effort for me to reflect and research, and hopefully to build up a business plan. It will take some time.

Go freelancing

May be I could get freelance/contract job from my ex-company. That won't be difficult, I think. But, like I have mentioned above, I feel ashamed to make a U-turn.

So, I can only look for freelance job out in the market. I still don't have any idea how to get this kind of freelancing software development work here. Some networking is needed.

Anyway, I don't think I like freelancing as my next career, mainly because of instability of income, and not-so-good public image of freelancer here. It can only be my short term job while I look for a proper employment, or start my new business.

Get back to school

I could also get back to school to re-train myself for the next career. But, first of all, I need to know what is my next career first.

So, what should I do next?

Right now I really don't have a clear direction but to walk into each path a little more to see what is further down the road, and then decide which path I should take. This mid-career crisis has already engulfed me and I need to plan my strategy carefully to get out of it. It is a test for me. I hope I can face it with a positive mind.