View unanswered posts | View active topics It is currently Thu Jul 24, 2014 4:01 pm






Reply to topic  [ 5 posts ] 
Memory Allocation 
Author Message
Rookie

Joined: Mon Jan 10, 2011 11:39 pm
Posts: 16
Post 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
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3162
Location: Rotterdam, The Netherlands
Post 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

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Mon Dec 05, 2011 4:41 am
Profile WWW
Rookie

Joined: Mon Jan 10, 2011 11:39 pm
Posts: 16
Post 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
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3162
Location: Rotterdam, The Netherlands
Post Re: Memory Allocation
Code:
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)

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

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Tue Dec 06, 2011 3:00 am
Profile WWW
Rookie

Joined: Fri Jan 27, 2012 6:57 pm
Posts: 40
Post Re: Memory Allocation
Quote:
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?


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! :wink: )

Thanks! (sumasmreq)


Fri Jan 27, 2012 7:11 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 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

Search for:
Jump to:  
cron



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.