π
<-
Chat plein-écran
[^]

module lua natif giac

C, C++, ASM...

Re: module lua natif giac

Unread postby parisse » 28 Apr 2015, 14:56

Compression is indeed efficient, but the module still fails to load (I have updated the file).
The same error attempt to index a nil value is reported, but no more ndless memory error.

By the way, I configured GMP/MPFR/MPFI with
Code: Select all
export CC=nspire-gcc
export CXX=nspire-g++
export LD=nspire-ld
export AS=nspire-as
export NM=/home/parisse/Ndless/ndless-sdk/toolchain/install/bin/arm-none-eabi-nm
export RANLIB=/home/parisse/Ndless/ndless-sdk/toolchain/install/bin/arm-none-eabi-ranlib
# GMP/MPFR configure command
./configure --host=none --prefix=/home/parisse/Ndless/ndless-sdk
make
make install

I had to add a define in a .c file in GMP to compile it properly
mpn/div_qr_1n_pi1.c:#define __CLOBBER_CC : "cc"
mpn/div_qr_1n_pi1.c:#define __AND_CLOBBER_CC , "cc"
MPFR/MPFI no change.

Inside giac-1.2.0 (latest tarball), copy config.h.nspire to config.h, and make -f Makefile.nspire
I had to add a missing.c file with
Code: Select all
#include <sys/times.h>
// missing _times function in libc
clock_t _times(struct tms *ptms){
  return 0;
}

because otherwise libg did not link (missing symbol).
User avatar
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Level up: 78%
 
Posts: 3511
Joined: 13 Dec 2013, 16:35
Gender: Not specified
Calculator(s):
MyCalcs profile

Re: module lua natif giac

Unread postby Vogtinator » 28 Apr 2015, 15:26

parisse wrote:Compression is indeed efficient, but the module still fails to load (I have updated the file).
The same error attempt to index a nil value is reported, but no more ndless memory error.

Great, so the main error is solved. The issue with compression is that the backwards-compatibility requires more memory than
a recent ndless version (compression is included in the latest ndless_resources in ndless 3.9, hold the :nsbi: while opening a Zehn program to verify compression support, a dialog box should appear), as both the compressed and uncompressed executables are in memory.
The lua warning appears even in the lua example ("hello world") and seems to be harmless. I don't know the cause.

By the way, I configured GMP/MPFR/MPFI with
Code: Select all
export CC=nspire-gcc
export CXX=nspire-g++
export LD=nspire-ld
export AS=nspire-as
export NM=/home/parisse/Ndless/ndless-sdk/toolchain/install/bin/arm-none-eabi-nm
export RANLIB=/home/parisse/Ndless/ndless-sdk/toolchain/install/bin/arm-none-eabi-ranlib
# GMP/MPFR configure command
./configure --host=none --prefix=/home/parisse/Ndless/ndless-sdk
make
make install

Shouldn't the prefix rather be /home/parisse/Ndless/ndless-sdk/toolchain/install?

I had to add a define in a .c file in GMP to compile it properly
mpn/div_qr_1n_pi1.c:#define __CLOBBER_CC : "cc"
mpn/div_qr_1n_pi1.c:#define __AND_CLOBBER_CC , "cc"
MPFR/MPFI no change.

Inside giac-1.2.0 (latest tarball), copy config.h.nspire to config.h, and make -f Makefile.nspire
I had to add a missing.c file with
Code: Select all
#include <sys/times.h>
// missing _times function in libc
clock_t _times(struct tms *ptms){
  return 0;
}

because otherwise libg did not link (missing symbol).

It should probably return -1 to indicate failure. I added it to libsyscalls, git pull and make clean && make in ndless-sdk and it should work.
User avatar
VogtinatorPremium
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Level up: 1.6%
 
Posts: 217
Joined: 29 Mar 2014, 15:55
Gender: Male
Calculator(s):
MyCalcs profile

Re: module lua natif giac

Unread postby parisse » 28 Apr 2015, 16:22

Vogtinator wrote: The issue with compression is that the backwards-compatibility requires more memory than a recent ndless version (compression is included in the latest ndless_resources in ndless 3.9, hold the :nsbi: while opening a Zehn program to verify compression support, a dialog box should appear), as both the compressed and uncompressed executables are in memory.

Does it mean the compressed lua module works only for ndless 3.9? I have 3.6 on my calcs.
User avatar
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Level up: 78%
 
Posts: 3511
Joined: 13 Dec 2013, 16:35
Gender: Not specified
Calculator(s):
MyCalcs profile

Re: module lua natif giac

Unread postby Vogtinator » 28 Apr 2015, 16:26

No, the backwards-compatibility my make-prg works up to ndless 2.0 (AFAIK the first version with "PRG" header).
For faster loading and less RAM usage the newest ndless_resources is recommended. ndless_resources from ndless 3.9 works on OS 3.1 and 3.6 as well. That's also why it's not called ndless_resources_3.9.tns.
User avatar
VogtinatorPremium
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Level up: 1.6%
 
Posts: 217
Joined: 29 Mar 2014, 15:55
Gender: Male
Calculator(s):
MyCalcs profile

Re: module lua natif giac

Unread postby parisse » 28 Apr 2015, 16:32

I just checked on my nspire cx, and it works!!!
evalf(pi,30)
I'll update khicas for download tomorrow...
User avatar
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Level up: 78%
 
Posts: 3511
Joined: 13 Dec 2013, 16:35
Gender: Not specified
Calculator(s):
MyCalcs profile

Re: module lua natif giac

Unread postby Adriweb » 28 Apr 2015, 16:51

I'm late to the party, but, on the Lua side was the "require" a typo (instead of "nrequire") ?

That's what is done in the current Khicas, at least:
Code: Select all
hasGiac = pcall(nrequire, "luagiac")
if not hasGiac then
...


Anyway, nice job, congratulations :)
Image

MyCalcs: Help the community's calculator documentations by filling out your calculators info!
MyCalcs: Aidez la communauté à documenter les calculatrices en donnant des infos sur vos calculatrices !
Inspired-Lua.org: All about TI-Nspire Lua programming (tutorials, wiki/docs...)
User avatar
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 80.3%
 
Posts: 14617
Images: 1218
Joined: 01 Jun 2007, 00:00
Location: France
Gender: Male
Calculator(s):
MyCalcs profile
Twitter: adriweb
GitHub: adriweb

Re: module lua natif giac

Unread postby parisse » 28 Apr 2015, 19:52

Yes, it was a typo.
User avatar
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Level up: 78%
 
Posts: 3511
Joined: 13 Dec 2013, 16:35
Gender: Not specified
Calculator(s):
MyCalcs profile

Re: module lua natif giac

Unread postby parisse » 28 Apr 2015, 21:48

Unfortunately, there are several Xcas commands that reboot the calc, like sqrt(5).
It will probably take some time before I can update khicas to the newlib version (until then, I have updated with the version compiled with my old toolchain). Depends if I can easily install nspire_emu and if I can gdb (that did not work with the old toolchain...).
Last edited by parisse on 28 Apr 2015, 21:50, edited 1 time in total.
User avatar
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Level up: 78%
 
Posts: 3511
Joined: 13 Dec 2013, 16:35
Gender: Not specified
Calculator(s):
MyCalcs profile

Re: module lua natif giac

Unread postby parisse » 29 Apr 2015, 07:13

I made more tests, it appears something is wrong with the lua interface in the lua module only, because the console executable does not seem to have the same problems
giac.tns: http://www-fourier.ujf-grenoble.fr/~parisse/calc/giac.tns
luagiac module: http://www-fourier.ujf-grenoble.fr/~parisse/calc/luagiac.luax.tns
sqrt(2) works as expected inside giac.tns and reboots inside khicas.tns
http://www-fourier.ujf-grenoble.fr/~parisse/calc/khicas.tns
Any idea why?
User avatar
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Level up: 78%
 
Posts: 3511
Joined: 13 Dec 2013, 16:35
Gender: Not specified
Calculator(s):
MyCalcs profile

Re: module lua natif giac

Unread postby Vogtinator » 29 Apr 2015, 18:20

Debugging should work if you're using a recent enough ndless_resources with support for compressed Zehn files (the backwards-compatiblity layer doesn't support debugging). I don't know what is causing those lua issues and sadly I can't help debugging, it's a very busy week for me, with three abitur exams. Those bugs may also explain the weird behavior I posted in the other topic.
User avatar
VogtinatorPremium
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Level up: 1.6%
 
Posts: 217
Joined: 29 Mar 2014, 15:55
Gender: Male
Calculator(s):
MyCalcs profile

PreviousNext

Return to Native: Ndless, Linux, ...

Who is online

Users browsing this forum: No registered users and 14 guests

-
Search
-
Social TI-Planet
-
Featured topics
Comparaisons des meilleurs prix pour acheter sa calculatrice !
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
Phi NumWorks jailbreak
123
-
Donations / Premium
For more contests, prizes, reviews, helping us pay the server and domains...
Donate
Discover the the advantages of a donor account !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partner and ad
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
1636 utilisateurs:
>1618 invités
>14 membres
>4 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
Other interesting websites
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)