[En-Nut-Discussion] Lua without floting point support

Andre Riesberg andre at riesberg-net.de
Fri Apr 9 15:34:51 CEST 2010


Harald Kipp schrieb:
> Hi Andre,
>
> On 09.04.2010 12:37, Andre Riesberg wrote:
>
>   
>> I try to use Lua in my application. I don't need any floating point 
>> support.
>> In the Nut Configurator the checkbox "C runtime (target specifed) -> 
>> File Streams -> Floting point" is not set.
>> Under "Lua Support -> Standard Librarys -> Floating Point Numbers" the 
>> checkbox disabled and not checked.
>>     
>
> Looks to me like we have to fix this in the Configurator. As far as I
> can see, the Lua math library requires floating point support. Thus, the
> math library should be disabled in the Configurator when floating point
> is not available.
>
>
>   
>> If I add -lm to my LIBS in the makefile the compiling is successful and 
>> the application works fine. But the application look quit big, so I 
>> think there is a lot of (dead) floating point code inside.
>>     
>
> I'd recommend to start with all Lua libs unchecked. It may turn out
> later, that the string or table libraries may be useful enough to spend
> more code space. Though, a lot can be done with just basic Lua.
>
> Note also, that the TCP I/O lib is a very simple, hacked demo only.
> http://www.ethernut.de/en/firmware/nutlua.html
>
> Harald
>
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>
>
>   
Hallo Harald,

I have unchecked all Libs, remove all floating point calls in lmathlib.c.

But there are still some floting point calls left:

lvm.c:
    two calls of "luai_numpow"
lmathlib.c:
    in function "math_random" two calls of "floor". I think this can be 
replaced by (int).

After this changes code size is the half. The size of "lua_Number" is 
now 4!

Greetings
André

















More information about the En-Nut-Discussion mailing list