Page 1 sur 4

ndless memory map

Message non luPosté: 26 Mai 2020, 18:15
de parisse
How much memory is available for the stack and the heap? It seems there is less than 64K stack. Is this customizable in ndless-sdk/system/ldscript?

Re: ndless memory map

Message non luPosté: 26 Mai 2020, 18:23
de Vogtinator
This is managed by the OS, but on 4.2 and later Ndless adds an extra 128K: https://github.com/ndless-nspire/Ndless ... ook.c#L156

Re: ndless memory map

Message non luPosté: 27 Mai 2020, 05:38
de parisse
Thanks, that's enough (I just found that the giac parser was misconfigured).
How much RAM on the heap?
And BTW, do you know if it's possible to power off the calc inside a ndless app?

Re: ndless memory map

Message non luPosté: 27 Mai 2020, 15:43
de Vogtinator
parisse a écrit:Thanks, that's enough (I just found that the giac parser was misconfigured).
How much RAM on the heap?

I know that on OS 3.9 on Touchpad there was just barely more than 8MiB free, so on a CX it's probably below 32MiB.
There's quite a bit of fragmentation though, so it's possible that only a ~10MiB continuous allocation works.

And BTW, do you know if it's possible to power off the calc inside a ndless app?

It might be, but there is no syscall. To do it properly (i.e. like the OS, with saving the scratchpad and so on) would probably need some more complex event loop integration.
Or maybe a function which sends a poweroff event after returning from main() would be possible.

Re: ndless memory map

Message non luPosté: 27 Mai 2020, 16:55
de parisse
Vogtinator a écrit:I know that on OS 3.9 on Touchpad there was just barely more than 8MiB free, so on a CX it's probably below 32MiB.
There's quite a bit of fragmentation though, so it's possible that only a ~10MiB continuous allocation works.

That's much much more than on the Numworks or Casio Prizm, normal school usage of KhiCAS should be memory-proof...

It might be, but there is no syscall. To do it properly (i.e. like the OS, with saving the scratchpad and so on) would probably need some more complex event loop integration.
Or maybe a function which sends a poweroff event after returning from main() would be possible.

Does it mean that the RAM is not kept (I mean refreshed) in OFF mode? Otherwise it should be possible to power off and on again without taking care of the OS data. Well, sending a poweroff event would not spare much time to the user, because he would still have to re-enter KhiCAS after ON.

BTW, I just discovered that the RTC clock of the nspire seems very accurate (probably more than my Casio watch...), I wonder why TI does not display the time.

Re: ndless memory map

Message non luPosté: 27 Mai 2020, 18:07
de Vogtinator
parisse a écrit:
It might be, but there is no syscall. To do it properly (i.e. like the OS, with saving the scratchpad and so on) would probably need some more complex event loop integration.
Or maybe a function which sends a poweroff event after returning from main() would be possible.

Does it mean that the RAM is not kept (I mean refreshed) in OFF mode? Otherwise it should be possible to power off and on again without taking care of the OS data. Well, sending a poweroff event would not spare much time to the user, because he would still have to re-enter KhiCAS after ON.

Do you mean standby mode? That might be simpler to implement, but there's no syscall for that either.

Re: ndless memory map

Message non luPosté: 27 Mai 2020, 19:13
de parisse
Yes, standby mode is what I'd like to have when I press Ctrl-off inside KhiCAS.
If you are working on a math problem, you might need to do some computations or graph representations or a small program for a few minutes, then you work on your paper and during that time you don't want to keep the calc on. Currently you must press menu menu to leave KhiCAS then ctrl off to shutdown the calc, and then on, 2, enter to launch KhiCAS and wait 15 seconds before the shell is ready.

Re: ndless memory map

Message non luPosté: 03 Juil 2020, 12:50
de nspiredev500
If you want low power consumption, you could just disable the LCD and go into a loop:
Code: Tout sélectionner
while (! isKeyPressed(KEY_NSPIRE_HOME))
{
  msleep(100);
}

To get the OS standby mode, you could save all your state into a file and exit the application when ctrl + ON is pressed.
The only problem would be starting it again after the calculator exits standby mode.
Or you could do the research and figure out how the standby mode works and implement it yourself.
There is only little information about this on Hackspire: https://hackspire.org/index.php?title=Memory-mapped_I/O_ports_on_CX#900B0000_-_Power_management

Re: ndless memory map

Message non luPosté: 03 Juil 2020, 12:55
de Ti64CLi++
You can disable the screen, by lowering the contrast to its minimum.
Here is a code which does exactly that :
Code: Tout sélectionner
unsigned short *pContrast = (unsigned short *)0x900F0020;
*pContrast = 0x100;


0x100 is the minimum value for the contrast, which is when the screen is turned off ;)

Re: ndless memory map

Message non luPosté: 03 Juil 2020, 13:56
de parisse
That's what I do, but it's far from perfect : you can still guess that there is something on the screen, and the batteries do not last for long in that mode (perhaps 1 or 2 days). It's reasonably good if you don't forget to leave KhiCAS once you have finished your daywork.