Topic : RC51: Request for an idata memory model

Forum : 8051

Original Post
Post Information Post
December 21, 2007 - 5:14pm
Guest

Could you make for RC51 a memory model which places variables in idata by default?

I'm doing a project on Silicon Labs F530 which has 8K/256bytes. So the model is SMALL (variables in 'data' by default). The project uses preexisting libraries which were first used in LARGE projects and were built to SMALL for this one. So, when linked into this project, library functions are allocated out of the scarce 'data' space, which has been used up. I would rather the library functions used the top 1/2 of 'idata' (0x80 - Top_of_Stack), which would free up 'data' for faster code.

There doesn't appear to be a memory model which uses 'idata'. If I must, I can prefix the variables in library source code with #def which will switch to the correct memory model. However this is inelegant; it's also inefficient as any memory space qualifier on a local variable prevents the compiler from optimising that variable into a register when it can.

I realise that RC51 is a mature product. However an idata memory model would really help code in MCU's of this class. Or is there another way of doing this which I've missed.

regards Steven Pruzina

Replies
Post Information Post
+1
0
-1
January 2, 2008 - 11:07am
Guest

I don't agree.
The internal RAM is 256 bytes long. It's obviously much better to address the first 128 bytes as "data". And the last 128 bytes are - for a large part - used for the stack.
Now, we plan to introduce a 2-passes mecanism to relocate automatically the variables at their "best place" (data/idata/xdata). That would be the solution.

+1
0
-1
January 2, 2008 - 5:39pm
Guest

Frances,

As I develop this application. I'm beginning to see your point - in part. Stack usage on this application is about 40 bytes, leaving another 80 IDATA bytes available. All application variables, both static automatic and function parameters, total about 150 - 170 bytes. So I'm declaring non-automatic variables 'idata'. This appears to be working; automatic variables and function parameters placed in 'data' by the compiler are staying under 0x7F.

Steven