|
Page 1 of 1
|
[ 5 posts ] |
|
| Author |
Message |
|
charsleysa
Rookie
Joined: Mon Jan 10, 2011 11:39 pm Posts: 16
|
 Memory Allocation
Is it possible to release a chart or some indication of the memory allocation that occurs with ROBOTC firmware?
I am trying to develop a simple-text-language interpreter that can run in the Cortex and I want to know what sections of memory are unused or are allocated to the User Space. I have done some investigating my self and have found out that the User Space is allocated 12000 bytes of memory but I am unsure where.
Also, memcpy and memset, do they set memory anywhere in the 64Kb of memory or just in the User Space?
Regards Stefan Andres Charsley
_________________Regards Stefan Andres Charsley charsleysa@gmail.com
|
| Mon Dec 05, 2011 4:23 am |
|
 |
|
mightor
Moderator
Joined: Wed Mar 05, 2008 8:14 am Posts: 2859 Location: Rotterdam, The Netherlands
|
 Re: Memory Allocation
All memory allocation is static. If you need a large chunk of memory, you should just declare as large an array of ubytes as you need (or can) and use that.
- Xander
_________________| Some people, when confronted with a problem, think, "I know, I'll use threads," | and then two they hav erpoblesms. (@nedbat)| My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
| Mon Dec 05, 2011 4:41 am |
|
 |
|
charsleysa
Rookie
Joined: Mon Jan 10, 2011 11:39 pm Posts: 16
|
 Re: Memory Allocation
memset(pToBuffer, nValue, nNumbOfBytes); Sets a block of memory at ‘pBuffer’ to the value ‘nValue’. ‘nBytesToSet’ is the number of bytes to set. This is a useful function for initializing the value of an array to all zeros. Identical to the function found in conventional C 'string.h' library.
This function takes a pointer which then is passed to the system. Now these pointers are just normal pointers to memory are they not? If you substitute this pointer with a number of the memory segment, does it not work in the same way? What I'm trying to do is allocate memory using memory addressing and storing that information in a variable map. I have made a common allocation of 32 bits for every variable but only the required bits will be used. (All unsigned)
_________________Regards Stefan Andres Charsley charsleysa@gmail.com
|
| Mon Dec 05, 2011 7:16 pm |
|
 |
|
mightor
Moderator
Joined: Wed Mar 05, 2008 8:14 am Posts: 2859 Location: Rotterdam, The Netherlands
|
 Re: Memory Allocation
These pointers are simply variable names, which are always pointers to memory locations. ROBOTC does not have the concept of pointers like it does in C. That is why I suggested you create a large ubyte array (unsigned byte, or char) and fiddle with that. Regards, Xander
_________________| Some people, when confronted with a problem, think, "I know, I'll use threads," | and then two they hav erpoblesms. (@nedbat)| My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
| Tue Dec 06, 2011 3:00 am |
|
 |
|
sumasmreq
Rookie
Joined: Fri Jan 27, 2012 6:57 pm Posts: 40
|
 Re: Memory Allocation
How much memory is available for Variables anyway? (And how much for programs too?) I'm having some troubles with getting a two dimensional array of structs to work, though I think it is probably unrelated (Ticket #280936 if some kind person at ROBOTC wants to look at it!  ) Thanks! (sumasmreq)
|
| Fri Jan 27, 2012 7:11 pm |
|
|
|
Page 1 of 1
|
[ 5 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 1 guest |
|
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
|
|