Building new modules into Firmware
Posted: Tue Jan 26, 2016 12:32 pm
Hi all,
I've just managed to set up a Virtual Machine as described on the Desperate Programmers blog. Mighty Max's instructions are almost spot-on, however there were a couple of missing header files that I had to add (simcall-errno.h, simcall-fcntl.h from ESP8266_RTOS_SDK-master/extra_include/xtensa/ see here) These need to be copied into /opt/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.2/include/xtensa
After doing that, and following the instructions on tailoring the includes for the required modules, I successfully built the nodemcu Lua binaries. So this is something I've not managed until now. So far so good.
Seeing as how I'm doing this so I can create a new Nodemcu User Module, next I wanted to try the simple "Hello World" example. Unfortunately I can't get this simple example to work. One thing I noticed that didn't seem right was not passing L into the lua_pushstring function:
This cleared up some errors but more errors remain:
Googling this didn't help me understand the error so I'm hoping someone here might be able to spot the problem(s).
Unfortunately I can't seem to register on the blog site where I found this to post comments to the author.
I've just managed to set up a Virtual Machine as described on the Desperate Programmers blog. Mighty Max's instructions are almost spot-on, however there were a couple of missing header files that I had to add (simcall-errno.h, simcall-fcntl.h from ESP8266_RTOS_SDK-master/extra_include/xtensa/ see here) These need to be copied into /opt/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.2/include/xtensa
After doing that, and following the instructions on tailoring the includes for the required modules, I successfully built the nodemcu Lua binaries. So this is something I've not managed until now. So far so good.
Seeing as how I'm doing this so I can create a new Nodemcu User Module, next I wanted to try the simple "Hello World" example. Unfortunately I can't get this simple example to work. One thing I noticed that didn't seem right was not passing L into the lua_pushstring function:
Code: Select all
static int ICACHE_FLASH_ATTR bonjour_bonjour(lua_State* L) {
{
lua_pushstring("Bonjour, World!"); //I think this should be lua_pushstring(L, "Bonjour, World!");
return 1;
}
This cleared up some errors but more errors remain:
Code: Select all
bonjour.c:24:1: error: 'used' attribute ignored [-Werror=attributes]
NODEMCU_MODULE(BONJOUR, "bonjour", bonjour_map, luaopen_bonjour);
^
In file included from bonjour.c:1:0:
../include/module.h:55:28: error: section attribute cannot be specified for local variables
luaL_Reg MODULE_PASTE_(lua_lib_,cfgname) = { luaname, initfunc };
Googling this didn't help me understand the error so I'm hoping someone here might be able to spot the problem(s).
Unfortunately I can't seem to register on the blog site where I found this to post comments to the author.