I started with new VM, Win 7, 64bit.
First install Java JRE, I’ve got Version 7 Update 9. Then download Developer Studio (DS), here I’ve got Embedded_Application_Framework_v2-36_Full_Installer.exe. For my product family I selected AirLink FXT Series 3GPP. In software Selection, tick ARM ELF GCC Toolchain and keep EABI toolchain ticked.
After successful instalation apply bug fix described by [url]https://forum.sierrawireless.com/t/m2m-studio-2-0-0-lua-plugin/4977/3] by blicharski. You have to apply this fix after each upgrade of DS.
Test run DS and accept \workspace directory for your working directory. In Package Manager instal Firmware Package 7.46, LUA and WIP plugins from OAT ESS package 2.36.
Install http://tortoisesvn.net/downloads.html TortoiseSVN, I’ve got Version 1.7.10.
Create new directory (let name it RepoTmp) right click and SVN Checkout from https://svn.anyware-tech.com/wavecom/openat-lua.
We will create three libraries in workspace: oatlua, Ethernet and Shell. Steps for all three are almost identical.
In DS / Main Menu / File / Import select Developer Studio / Existing DS Project. Press Next. Now select RepoTmp\trunk\oatlua as root directory and tick Copy projects into workspace. Finish. Ignore any DS errors for now.
Right click on project in Project Explorer / Build Configuration / Manage / New / Import Predefined / Static Library [Target]_ARM_EABI_GCC_Debug and name it so. OK and Set Active. OK again.
Right click on project / Properties / C/C++ general / Paths and Symbols / Symbols tab add LUA_PLUGIN_VERSION with value 400
Also in Project properties / OpenAT Library select correct Framework Profile (ESS package 2.36 for now). In Libraries tab check Internet Library Package. OK. Yes.
In oatlua library we fix two bugs:
In oatlua\src-porting\luaw_loaders.c:148 we changeluaW_preload() function:
int luaW_preload( lua_State *L, const char *name, lua_CFunction opener) {
// LJWEKO
// remove double quotes
u8 s, l;
char name1[65];
l = strlen(name);
if (name[0] == 34) {
s = 1;
l = l - 2;
}
else s = 0;
strncpy(name1, &name[s], l); name1[l] = 0;
// you can do better, can't you
// LJWEKO
luaW_debug( "LUA", "DEBUG", "Preloading package %s", name1);
luaL_findtable( L, LUA_GLOBALSINDEX, "package.preload", 1);
lua_pushcfunction( L, opener);
lua_setfield( L, -2, name1);
lua_pop( L, 1);
return 0;
}
In oatlua\src-orig\lundump.c:120 we change LoadNumber() function:
static lua_Number LoadNumber(LoadState* S) {
union { lua_Number x; int b[2]; } u;
int t;
LoadVar(S,u.x);
t=u.b[0]; u.b[0]=u.b[1]; u.b[1]=t;
return u.x;
}
Clean and Build project oatlua. Library oatlua.lib is created in [Target]_ARM_EABI_GCC_Debug folder.
Now import Ethernet library from RepoTmp\trunk\samples\Ethernet. Repeat steps for oatlib (no bug fix here). Library depends on oatlua, so in Project Properties / C/C++ general / Paths and Symbols / Includes add /oatlua/itf path. You may unchek Project References oatlua. Clean and build project Ethernet.
Now import Shell library from RepoTmp\trunk\samples\Shell. Repeat steps for Ethernet library. Clean and build project Shell.
The file Shell.h in itf subdir should look like:
#ifndef __SHELL_H_INCLUDED__
#define __SHELL_H_INCLUDED__
/* Export lua preloading function */
void luapreload_Shell(); // should not be removed
#endif /* __SHELL_H_INCLUDED__ */