chibios + elua

This forum is about you. Feel free to discuss anything is related to embedded and electronics, your awesome projects, your ideas, your announcements, not necessarily related to ChibiOS but to embedded in general. This forum is NOT for support.
Posts: 19
Joined: Mon Sep 19, 2011 9:09 am

chibios + elua

Postby linvinus » Thu Mar 12, 2015 6:47 pm

just want to share example how to use chibios with elua.
Example for STM32F4 discovery

example lua

Code: Select all

function test()
print("End after 1 sec")


User avatar
Site Admin
Posts: 13133
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 770 times
Been thanked: 653 times

Re: chibios + elua

Postby Giovanni » Thu Mar 12, 2015 7:14 pm


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


Posts: 48
Joined: Sun Apr 28, 2013 6:52 am

Re: chibios + elua

Postby chradev » Sat Mar 21, 2015 10:17 am

Hi Guys,

I try to build and run the project on ChibiStudio under Windows 7 and get error at compilation: EXT_PREPROCESS_SHELL EXT_PREPROCESS_SHELL EXT_PREPROCESS_SHELL EXT_PREPROCESS_SHELL 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

Posts: 199
Joined: Sun Nov 06, 2011 3:54 pm

Re: chibios + elua

Postby pito » Sat Mar 21, 2015 7:51 pm

Try to replace this in Makefile with your path:

Code: Select all

CHIBIOSLUA ?= $(shell pwd)

Posts: 19
Joined: Mon Sep 19, 2011 9:09 am

Re: chibios + elua

Postby linvinus » Mon Mar 23, 2015 9:27 pm

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)

$(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
$(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)

User avatar
Posts: 223
Joined: Tue Apr 03, 2012 5:08 am
Location: South Korea
Has thanked: 3 times
Been thanked: 3 times

Re: chibios + elua

Postby DeusExMachina » Fri Jul 15, 2016 8:10 am

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!

Posts: 734
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 10 times
Been thanked: 109 times

Re: chibios + elua

Postby steved » Wed May 24, 2017 8:22 am

Has anyone made any progress on getting this to compile under ChibiStudio on Windows, before I dig deeper?

Return to “User Projects”

Who is online

Users browsing this forum: No registered users and 2 guests