Page 1 of 1

chibios + elua

Posted: Thu Mar 12, 2015 6:47 pm
by linvinus
Hi!
just want to share example how to use chibios with elua.
Example for STM32F4 discovery
https://github.com/linvinus/chibios_with_elua

example lua

Code: Select all

function test()
print("Start")
chibios.thd.SleepMilliseconds(1000)
print("End after 1 sec")
end

test()

Re: chibios + elua

Posted: Thu Mar 12, 2015 7:14 pm
by Giovanni
Hi,

Thanks for sharing, it is an interesting example, especially the way you make the API available to eLua.

Giovanni

Re: chibios + elua

Posted: Sat Mar 21, 2015 10:17 am
by chradev
Hi Guys,

I try to build and run the project on ChibiStudio under Windows 7 and get error at compilation:

rules.mk:157: EXT_PREPROCESS_SHELL
rules.mk:161: EXT_PREPROCESS_SHELL
rules.mk:226: EXT_PREPROCESS_SHELL
rules.mk:280: EXT_PREPROCESS_SHELL
rules.mk:282: EXT_PREPROCESS_SHELL

...

/usr/bin/sh: arm-none-eabi-gcc: command not found
make: *** [build/obj/vectors.o] Error 127
make: *** Waiting for unfinished jobs....

This probably is because of Linux shell functionality lack and make version.
I try other GNU Tools for Windows and compilation starts in spite of above errors.

Next I have to rename ext/platform_chibios/board_stm32f4chibios.h.dis to ...h.
But then compilation stops because of lack of romfiles.h file needed by ext/elua/src/romfs.c.
Probably Lua installed in the host is needed as well.

Can somebody help me to build the project with ChibiStudio?

Best regards
Chris

Re: chibios + elua

Posted: Sat Mar 21, 2015 7:51 pm
by pito
Try to replace this in Makefile with your path:

Code: Select all

CHIBIOSLUA ?= $(shell pwd)

Re: chibios + elua

Posted: Mon Mar 23, 2015 9:27 pm
by linvinus
chradev, hi
yes makefile tested under linux only, i don't use windows, sorry

Probably Lua installed in the host is needed as well.

yes, elua build system based on lua, you may refer to elua documentation, how to build image under windows.

the romfiles.h is generated by elua after following commands (actually after ./build_elua.lua board=stm32f4chibios but others also needed)

EXT_PREPROCESS_SHELL=$(warning EXT_PREPROCESS_SHELL) \
$(shell ln -s $(CHIBIOSLUA)/ext/stm32f4chibios.lua $(ELUA)/boards/known/stm32f4chibios.lua 2>/dev/null) \
$(shell ls $(ELUA)/src/platform/chibios >/dev/null 2>&1 || ln -s $(CHIBIOSLUA)/ext/platform_chibios $(ELUA)/src/platform/chibios >/dev/null 2>&1) \
$(shell (cd ${ELUA} ; patch -N <$(CHIBIOSLUA)/ext/build_data.lua.diff ; ./build_elua.lua board=stm32f4chibios config_only=true; ./build_elua.lua board=stm32f4chibios) >>./build.log 2>&1)

you may replace to something like this
EXT_PREPROCESS_SHELL=$(warning EXT_PREPROCESS_SHELL) \
$(shell cp $(CHIBIOSLUA)/ext/stm32f4chibios.lua $(ELUA)/boards/known/stm32f4chibios.lua 2>/dev/null) \
$(shell cp $(CHIBIOSLUA)/ext/platform_chibios $(ELUA)/src/platform/chibios >/dev/null 2>&1) \
$(shell (cd ${ELUA} ; patch -N <$(CHIBIOSLUA)/ext/build_data.lua.diff ; ./build_elua.lua board=stm32f4chibios config_only=true; ./build_elua.lua board=stm32f4chibios) >>./build.log 2>&1)

this code must not print anything to STDOUT , under linux output redirected to /dev/null, i don't know how to do the same in windows
also, for testing purpose, you may run this commands by hand, before run make in root sourses directory

this commands do following things:
1) create new platform (cp $(CHIBIOSLUA)/ext/platform_chibios $(ELUA)/src/platform/chibios)
2) create new board type that use this platform ( cp $(CHIBIOSLUA)/ext/stm32f4chibios.lua $(ELUA)/boards/known/stm32f4chibios.lua)
3) add the new platform into build_data.lua (patch -N <$(CHIBIOSLUA)/ext/build_data.lua.diff)
4) run ./build_elua.lua board=stm32f4chibios this command will generate ext/elua/boards/headers/board_stm32f4chibios.h and romfiles.h
you may place romfs files under ext/elua/romfs directory (refer to elua documentation)

Re: chibios + elua

Posted: Fri Jul 15, 2016 8:10 am
by DeusExMachina
IMO it is a really cool thing. I have a project which has to support a different types of equipment. It should support our company's products which still do not exist. Using SD card + USB MSD and console it is possible to add new lua-based device descriptors or even add additional functionality (data aquisition, new comm protocols etc.). I should check it out!

Re: chibios + elua

Posted: Wed May 24, 2017 8:22 am
by steved
Has anyone made any progress on getting this to compile under ChibiStudio on Windows, before I dig deeper?