1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

examples/lua*: adapt to the blob mechanism

This commit is contained in:
Alexandre Abadie 2020-06-23 08:45:20 +02:00
parent d191b9c38a
commit ead8b80cb9
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
4 changed files with 4 additions and 46 deletions

View File

@ -25,28 +25,7 @@ CFLAGS += -DTHREAD_STACKSIZE_MAIN='(THREAD_STACKSIZE_DEFAULT+7000)'
USEPKG += lua
LUA_PATH = $(BINDIR)/lua
# add directory of generated *.lua.h files to include path
CFLAGS += -I$(LUA_PATH)
# generate .lua.h header files of .lua files
LUA = $(wildcard *.lua)
LUA_H = $(LUA:%.lua=$(LUA_PATH)/%.lua.h)
BUILDDEPS += $(LUA_H) $(LUA_PATH)/
BLOBS += $(wildcard *.lua)
include $(RIOTBASE)/Makefile.include
# The code below generates a header file from any .lua scripts in the
# example directory. The header file contains a byte array of the
# ASCII characters in the .lua script.
$(LUA_PATH)/:
$(Q)mkdir -p $@
# FIXME: This way of embedding lua code is not robust. A proper script will
# be included later.
$(LUA_H): $(LUA_PATH)/%.lua.h: %.lua | $(LUA_PATH)/
$(Q)xxd -i $< | sed 's/^unsigned/const unsigned/g' > $@

View File

@ -23,7 +23,7 @@
#include "lua_run.h"
#include "lua_builtin.h"
#include "repl.lua.h"
#include "blob/repl.lua.h"
/* The basic interpreter+repl needs about 13k ram AT Minimum but we need more
* memory in order to do interesting stuff.

View File

@ -22,28 +22,7 @@ endif
USEPKG += lua
LUA_PATH = $(BINDIR)/lua
# add directory of generated *.lua.h files to include path
CFLAGS += -I$(LUA_PATH)
# generate .lua.h header files of .lua files
LUA = $(wildcard *.lua)
LUA_H = $(LUA:%.lua=$(LUA_PATH)/%.lua.h)
BUILDDEPS += $(LUA_H) $(LUA_PATH)/
BLOBS += $(wildcard *.lua)
include $(RIOTBASE)/Makefile.include
# The code below generates a header file from any .lua scripts in the
# example directory. The header file contains a byte array of the
# ASCII characters in the .lua script.
$(LUA_PATH)/:
$(Q)mkdir -p $@
# FIXME: This way of embedding lua code is not robust. A proper script will
# be included later.
$(LUA_H): $(LUA_PATH)/%.lua.h: %.lua | $(LUA_PATH)/
$(Q)xxd -i $< | sed 's/^unsigned/const unsigned/g' > $@

View File

@ -25,7 +25,7 @@
#include "lualib.h"
#include "lua_run.h"
#include "main.lua.h"
#include "blob/main.lua.h"
#define LUA_MEM_SIZE (11000)
static char lua_mem[LUA_MEM_SIZE] __attribute__ ((aligned(__BIGGEST_ALIGNMENT__)));