1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #14332 from aabadie/pr/examples/lua_blobs

examples/lua*: adapt to the blob mechanism
This commit is contained in:
Francisco 2020-06-23 13:00:16 +02:00 committed by GitHub
commit 2b4875461e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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__)));