|
Page 1 of 1
|
[ 7 posts ] |
|
total available memory f. code, var declaration, stack, heap
| Author |
Message |
|
Ford Prefect
Senior Roboticist
Joined: Sat Mar 01, 2008 12:52 pm Posts: 936 Location: a small planet in the vicinity of Beteigeuze
|
 total available memory f. code, var declaration, stack, heap
hi,
what is the maximum memory amount in RobotC for NXT of
total available memory,
for program code,
number of variable declarations,
stack,
and (maybe) heap?
_________________ Ford Prefect
Never purchase release 1.x ! (ancient programmer's wisdom) "Don't argue with idiots. They'll drag you down to their level and then beat you with experience."
|
| Sun Mar 23, 2008 7:59 am |
|
 |
|
Dick Swan
Creator
Joined: Fri Feb 09, 2007 9:21 am Posts: 613
|
Total variable memory is about 15K bytes.
Program memory is limited by the size of the flash file system. Have not tested programs beyond 25K bytes or so which is a really large program.
Stack size is sufficient to allow about 8 to 10 levels of function nesting. Recursive functions are not currently allowed.
No dynamic memory allocation so there is no heap.
|
| Wed Mar 26, 2008 12:52 am |
|
 |
|
Ford Prefect
Senior Roboticist
Joined: Sat Mar 01, 2008 12:52 pm Posts: 936 Location: a small planet in the vicinity of Beteigeuze
|
hi,
thanks for reply, but what do you mean by:
"Stack size is sufficient to allow about 8 to 10 levels of function nesting"?
What does this particularly mean and how large is this?
Can you please tell me, if some day recursive functions will be allowed,
and further on, if dynamic memory allocation (heap) will be possible?.
Variable memory of about 15K bytes is rather small. Can this be enlarged?
And last, but not least, is there any limit to the number of variable declarations?
_________________ Ford Prefect
Never purchase release 1.x ! (ancient programmer's wisdom) "Don't argue with idiots. They'll drag you down to their level and then beat you with experience."
|
| Wed Mar 26, 2008 4:29 am |
|
 |
|
Dick Swan
Creator
Joined: Fri Feb 09, 2007 9:21 am Posts: 613
|
There's no limit on number of variables that I am aware.
Recursive functions are planned for later this year. Right now all variables are statically allocated (i.e. not on a stack). This is a common practice in many embedded systems; hence the restriction on no recursion as there is only one copy of procedure parameters and local variables.
The "task stack" size is a compile time constant and can be increased if needed. Currently it only holds function return addresses but the infrastructure is there for frame pointers and local variable storage. This is what's coming later this year.
15K is "enormous" memory size for a small embedded system. Some of the platforms that ROBOTC supports have only 256 bytes total for all user variables!
|
| Wed Mar 26, 2008 1:41 pm |
|
 |
|
Ford Prefect
Senior Roboticist
Joined: Sat Mar 01, 2008 12:52 pm Posts: 936 Location: a small planet in the vicinity of Beteigeuze
|
I thought, the NXT had 256 kByte total memory.
Would be nice, if half of this was available for code, and the other half for variable stack, and heap.
_________________ Ford Prefect
Never purchase release 1.x ! (ancient programmer's wisdom) "Don't argue with idiots. They'll drag you down to their level and then beat you with experience."
|
| Wed Mar 26, 2008 5:26 pm |
|
 |
|
Dick Swan
Creator
Joined: Fri Feb 09, 2007 9:21 am Posts: 613
|
THe NXT has 256K bytes of flash (i.e. read only) memory and 64K bytes of RAM.
The size of the firmware load is somewhere in the 120K to 150K range. This is stored in flash. The remaining flash is for the file system.
ROBOTC variables are stored in RAM along with all sorts of other things like buffers for communications, etc.
Currently 15K of RAM is available for ROBOTC variables.
And yes. There is a big chunk of unused RAM that could be used for additional variable space with the current firmware. But its planned for things like the per task stack (recursive functions remember) which will tie up several KBytes (10 tasks at 512 byte stack each?) so it's unlikely the available memory for static variables will increase.
|
| Thu Mar 27, 2008 2:04 am |
|
 |
|
Ford Prefect
Senior Roboticist
Joined: Sat Mar 01, 2008 12:52 pm Posts: 936 Location: a small planet in the vicinity of Beteigeuze
|
but 10 tasks at 512 byte stack = 5 kByte!
even 20 tasks (which is on MY wishlist!) will amount to just 10 kBytes.
plus 15 kByte current variable space = 20-25 kByte!
There still is a "chunk" of about 30 kBytes!
Can't you please increase the variable space by another 5 or 10 kBytes?
_________________ Ford Prefect
Never purchase release 1.x ! (ancient programmer's wisdom) "Don't argue with idiots. They'll drag you down to their level and then beat you with experience."
|
| Thu Mar 27, 2008 6:56 am |
|
|
|
Page 1 of 1
|
[ 7 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 7 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|