lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Hi Luis
The general goal I was aiming for was to be able to use luac to compile a lua binary on a PC (the typical development environment) and be able to run that on different embedded hardware. I was pondering what is involved to achieve that ?
> Are you saying that all those devices have different endianness?
Just the large number of devices around these days means there is bound to be a mix of Endian's. I would say Little Endian is the most common, but for example the Wii, and the PS3 are Big Endian I think.
> And these are the only differences between them??
No I didnt mean that, there are bound to be lots of different hardware configurations. But lets consider where hardware differences impact Lua ?
1) Filesystems: In my experience filesystems typically look like the ANSI libary, fopen(), fclose(), fread() etc.
2) I/O Systems:  For embedded systems this usually just redirects the C printf() to a Serial Port, or maybe a console screen if one is available.
3) Real Time Clock: This probably boils down to a just a couple of functions to read and write to the hardware.
Porting Lua for the above 3 points is fairly straightforward and someone coming at Lua for the first time would have a reasonable understanding of what is needed to be done, and the size of the work involved.
What isnt straightforward, and a new Lua user wouldnt have a clue how to do or the size of the task, is how to tackle the Endianism problem ? Thats why I was saying it would be good to restore the old endianism agnostic feature it used to have back in its early days. I was very pleasantly surprised when you posted your 1996 patch to fix the endian problem and I discovered how minimal the changes were. (and still worked fine in 2011)
> Date: Sat, 17 Dec 2011 17:51:32 -0200
> From:
> To:
> Subject: Re: Can someone sell Lua 5.2.0 to me please ?
> > now we are nearly in 2012 with a plethora of consoles, hand helds,
> > tablets etc, this issue of being endian agnostic is very much more
> > useful than it would have been back in back in the late 90's whenever
> > the decision was taken to remove the feature.
> Are you saying that all those devices have different endianness?
> And these are the only differences between them??
> Or that you'd rather generate one precompiled file and run it everywhere?
> In this case, I think what you need is a cross-compiler, ie, a version
> of luac that outputs in the correct order for each platform.
> I assume there is a separate build process for each platform anyway.
> So this luac step would just be one more step in that process.