porting Lua to ELKS? #1404
Replies: 3 comments 5 replies
-
Hello @sergione78, Before editing Makefiles and attempting a port, it is important to take a look at the Lua engine itself, and try to learn whether or not it is dependent on the size of integers or addresses being 32-bits (or greater). This can also usually be quickly learned by looking at memory allocations - ELKS is limited to a max single allocation of 32767 bytes, and a further max combined allocation of 64K bytes. By most software standards of today, this is extremely small. Another place to look would be the Lua "marketing" literature (so to speak) - does it say "Can run on 16-bit microcontrollers"? Without a lot of work, ELKS applications are limited to 64K data, and 128K code. I hope this helps. Thank you! |
Beta Was this translation helpful? Give feedback.
-
Hello @sergione78, Thank you for the logs. To be frank, the likelihood of success on this is not looking good:
This error is basically saying that sizeof(lu_mem) != sizeof unsigned int). On ia16-elf-gcc, sizeof(int) is always 16, so sizeof(lu_mem) is probably 32, which won't work on ELKS. You'll want to look further into the definition of
This error means that the code segment is too large, and that you'll have to use medium model (which could also easily be too small). This can be done using ia16-elf-gcc using the following flags:
There are also some link problems which have to be ironed out by adding/subtracting .o files, regarding the undefined or multiply defined symbols. Thank you! |
Beta Was this translation helpful? Give feedback.
-
Hello @sergione78, From the looks of the comment in llimits.h, lua may in fact be capable of running on 16-bit machines, so that is hopeful. With regards to the continuing errors, I need to see the exact error messages from the toolchain in order to help you. I doubt we're looking at any toolchain errors, but from your previous posts, it looks like there may be a number of undefined C library functions, (like feof(), clearerr(), which are macros and require including stdio.h, and setjmp(), which requires setjmp.h, etc). There are also some undefined calls to functions like strftime and ___errno, which are not (yet) in ELKS' C library. I also noticed a duplicate I'd say you're doing pretty good actually. Please post more linker output and we can discuss from there. Thank you! |
Beta Was this translation helpful? Give feedback.
-
I was wondering if there is the possibility of porting the Lua language to Elks. I tried to use the ia16-elf-gcc compiler by myself editing the Makefile, but unfortunately I have absolutely no experience with compiling and everything ends up with a file not found. Would anyone better than me want to try?
Beta Was this translation helpful? Give feedback.
All reactions