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.
linvinus
Posts: 19
Joined: Mon Sep 19, 2011 9:09 am

chibios + elua

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

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

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: chibios + elua

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

Hi,

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

Giovanni

chradev
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:

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

pito
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)

linvinus
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)

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)

User avatar
DeusExMachina
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!

steved
Posts: 823
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 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?

User avatar
russian
Posts: 364
Joined: Mon Oct 29, 2012 3:17 am
Location: Jersey City, USA
Has thanked: 16 times
Been thanked: 14 times

Re: chibios + elua

Postby russian » Wed Apr 21, 2021 5:22 pm

Thank you, that's a great example!

https://github.com/linvinus/chibios_with_elua/issues/1 created :)
http://rusefi.com/ - electronic fuel injection

User avatar
russian
Posts: 364
Joined: Mon Oct 29, 2012 3:17 am
Location: Jersey City, USA
Has thanked: 16 times
Been thanked: 14 times

Re: chibios + elua

Postby russian » Wed Apr 21, 2021 11:55 pm

I've forked, assed ChibiOS 20 as submodule instead of external folder and added github actions workflow - https://github.com/rusefi/chibios_with_elua

but far from compiling so far.
http://rusefi.com/ - electronic fuel injection

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: chibios + elua

Postby Giovanni » Thu Apr 22, 2021 5:40 am

Are there compatibility problems? it was a very old ChibiOS version, what errors exactly?

Giovanni


Return to “User Projects”

Who is online

Users browsing this forum: No registered users and 8 guests