π
<-
Chat plein-écran
[^]

module lua natif giac

C, C++, ASM...

Re: module lua natif giac

Message non lude parisse » 28 Avr 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: Tout sélectionner
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: Tout sélectionner
#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).
Avatar de l’utilisateur
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Prochain niv.: 77.2%
 
Messages: 3500
Inscription: 13 Déc 2013, 16:35
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

Re: module lua natif giac

Message non lude Vogtinator » 28 Avr 2015, 15:26

parisse a écrit: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: Tout sélectionner
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: Tout sélectionner
#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.
Avatar de l’utilisateur
VogtinatorPremium
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Prochain niv.: 1.6%
 
Messages: 217
Inscription: 29 Mar 2014, 15:55
Genre: Homme
Calculatrice(s):
MyCalcs profile

Re: module lua natif giac

Message non lude parisse » 28 Avr 2015, 16:22

Vogtinator a écrit: 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.
Avatar de l’utilisateur
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Prochain niv.: 77.2%
 
Messages: 3500
Inscription: 13 Déc 2013, 16:35
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

Re: module lua natif giac

Message non lude Vogtinator » 28 Avr 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.
Avatar de l’utilisateur
VogtinatorPremium
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Prochain niv.: 1.6%
 
Messages: 217
Inscription: 29 Mar 2014, 15:55
Genre: Homme
Calculatrice(s):
MyCalcs profile

Re: module lua natif giac

Message non lude parisse » 28 Avr 2015, 16:32

I just checked on my nspire cx, and it works!!!
evalf(pi,30)
I'll update khicas for download tomorrow...
Avatar de l’utilisateur
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Prochain niv.: 77.2%
 
Messages: 3500
Inscription: 13 Déc 2013, 16:35
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

Re: module lua natif giac

Message non lude Adriweb » 28 Avr 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: Tout sélectionner
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...)
Avatar de l’utilisateur
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Prochain niv.: 80.1%
 
Messages: 14606
Images: 1216
Inscription: 01 Juin 2007, 00:00
Localisation: France
Genre: Homme
Calculatrice(s):
MyCalcs profile
Twitter/X: adriweb
GitHub: adriweb

Re: module lua natif giac

Message non lude parisse » 28 Avr 2015, 19:52

Yes, it was a typo.
Avatar de l’utilisateur
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Prochain niv.: 77.2%
 
Messages: 3500
Inscription: 13 Déc 2013, 16:35
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

Re: module lua natif giac

Message non lude parisse » 28 Avr 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...).
Dernière édition par parisse le 28 Avr 2015, 21:50, édité 1 fois.
Avatar de l’utilisateur
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Prochain niv.: 77.2%
 
Messages: 3500
Inscription: 13 Déc 2013, 16:35
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

Re: module lua natif giac

Message non lude parisse » 29 Avr 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?
Avatar de l’utilisateur
parisseVIP++
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Prochain niv.: 77.2%
 
Messages: 3500
Inscription: 13 Déc 2013, 16:35
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

Re: module lua natif giac

Message non lude Vogtinator » 29 Avr 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.
Avatar de l’utilisateur
VogtinatorPremium
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Prochain niv.: 1.6%
 
Messages: 217
Inscription: 29 Mar 2014, 15:55
Genre: Homme
Calculatrice(s):
MyCalcs profile

PrécédenteSuivante

Retourner vers Native: Ndless, Linux, ...

Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 9 invités

-
Rechercher
-
Social TI-Planet
-
Sujets à la une
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
-
Faire un don / Premium
Pour plus de concours, de lots, de tests, nous aider à payer le serveur et les domaines...
Faire un don
Découvrez les avantages d'un compte donateur !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partenaires et pub
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
2519 utilisateurs:
>2502 invités
>12 membres
>5 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
Autres sites intéressants
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)