Omnimaga > Ndless

Mathomatic Port to Ndless gives a memory error

(1/6) > >>

quadratic77:
Hello all,

I am trying to port Mathomatic, a computer cas system, to the Nspire CX using ndless. It says it doesn't have enough memory when I run it. I have told it HANDHELD=1 and SECURE=1 so it minimizes memory usage and have taken the number of equation spaces waaay down to the lowest the code says it can go. Also, somewhere in the readme's it says that it can run on a few MB's of RAM, so it should work on the Nspire. Sometimes it crashes the calculator and I have to reset. Frustrating process of resetting, installing ndless, etc....

I have made minimal modifications to the code, and it compiles and links without major warnings.

Any ideas? I can provide more information if you want I just don't know what else to say save telling my entire process (cmd lines, etc.).

Oh, and the code is C.

Quadratic

Vogtinator:
The problem is, that although the nspire has 64 MB RAM, you can't get huge continuous chunks of memory.
Are you using os.h or fully relying on newlib? You could insert a message into the malloc implementation in system/for-newlib/stdlib.cpp which tells you the size it's trying to allocate.


--- Quote ---I have made minimal modifications to the code, and it compiles and links without major warnings.
--- End quote ---
Which warnings are left and what modifications did you do?
Did you use "nspire-gcc" as the compiler or did you use "arm-none-eabi-gcc"? Did you add "-mlong-calls" to CFLAGS?

quadratic77:
I am so amazed at the quick response time. Thank you.

#include <limits.h>
#include <float.h>
#include <math.h>
#include <setjmp.h>
#include <ctype.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
etc.

I'm guessing that is newlib. I never included <os.h> in any file in the code.

"insert a message": how? why? Like a debug message?

I used nspire-gcc and do not think I added the -mlong-calls to the command line (I ran the command a while ago and can't revive my history listing...)
As for modifications, I changed DEFAULT_N_TOKENS to 100 instead of whatever it was (in am.h), and I think whatever I needed to do to get rid of errors. And I changed example.c to fit the nspireio2's functions. (I'm using example.c for my testing purposes. Also I'm using the library and linking it to example.o.)

I'm going to re-compile everything now so I can get more precise information for you. Should I add the -mlong-calls to the command line? Should I not use nspire-gcc?

Vogtinator:

--- Quote ---"insert a message": how? why? Like a debug message?
--- End quote ---
Jup, just call puts (printf won't work without changes in nspire-ld-bflt) or set a breakpoint there (or use asm volatile("bkpt"))


--- Quote ---I'm going to re-compile everything now so I can get more precise information for you. Should I add the -mlong-calls to the command line? Should I not use nspire-gcc?
--- End quote ---
You should. -mlong-calls should also resolve some crashes you noticed.

quadratic77:
Ok. The calc still crashes (freezes up). May be my code, may not. I've checked mine as best I can. Here is the command line:

nspire-gcc  -O3  -Wall -Wshadow -Wno-char-subscripts -marm  -mlong-calls -fexceptions -DVERSION=\"`cat VERSION`\" -DLIBRARY -DSILENT=1 -DSECURE -DHANDHELD -DNO_COLOR     -c -o am.o am.c

The above for every library source code file, then the following for example.c:

nspire-gcc -Wall -marm -Os -c lib/example.c

Then I linked:

 nspire-ld-bflt am.o cmds.o complex.o complex_lib.o diff.o factor.o factor_int.o gcd.o globals.o help.o integrate.o lib/lib.o list.o parse.o poly.o simplify.o solve.o super.o unfactor.o lib/example.o -o lib/MathomaticNdless.tns

And transferred. Ran and the calc said "not enough memory" and froze. Any ideas? Should I post source code? Would rebuilding the code without ANY modifications to the code do anything?

Quadratic

(Still amazed at the quickness of replies...)

Navigation

[0] Message Index

[#] Next page

Go to full version