region RamLoc32 overflowed

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

region RamLoc32 overflowed

693 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by george079 on Tue Aug 31 19:45:44 MST 2010
Hi I have a project with LPC1768 as below

#define TEST_SIZE 0x8000 /*32KB*/
uint8_t test_table[TEST_SIZE];

int main(void) {
    
    uint32_t x;

    for(x=0;x<TEST_SIZE;x++)
        test_table[x]=x+1;
    
volatile static int i = 0 ;
    while(1) {
        i++ ;
    }
    return 0 ;
}
and compiled with  error

region RamLoc32 overflowed by 528 bytes
As i know there is 2 block of SRAM  ,each with 32KB .
In this project , it seems the RamLoc32 SRAM is overflowed,
and how could i assign to another block AHBSRAM ?
0 Kudos
3 Replies

572 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Mark_O on Thu Sep 02 02:59:00 MST 2010

Quote: george079
I found 2 links about what i'm going to do.
And it seems that it could be placed to peripheral SRAM now.

http://support.code-red-tech.com/CodeRedWiki/OwnLinkScripts
http://support.code-red-tech.com/CodeRedWiki/PlacingData



George,

thanks for the links.  I suspect I'll find them useful in the future.

- Mark
0 Kudos

572 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by george079 on Tue Aug 31 23:57:11 MST 2010
Mark,
Thank you for you reply.


Quote: Mark_O
George,

actually, there are 3 SRAM regions: one 32K, and two of 16K, though the 2 peripheral RAM regions are at least contiguous in the address space.


Good correct.


Quote:
To directly answer your question, even though there is 64K of RAM on the LPC1768, I don't think you can do what you're trying to do.  The reason being that the single array you've defined uses up ALL of the main SRAM block.  For that to work, you'd have to push ALL other data items out of that space, and into the peripheral SRAM blocks.  Including your stacks. 

I haven't done enough with this processor yet to know if that's possible or not.  Perhaps someone else with more experience can jump in.

BTW, since the main SRAM and peripheral SRAM blocks are NOT contiguous in the memory space, there is no possibility of linearly extending one data segment across them.  You probably need to evaluate whether you really need a 32KB array, or if you can get by with a smaller, or dynamic structure.

- Mark

Yes,it is for testing using SRAM over on-chip 32KB SRAM.
The real case is that i have many arrarys and total of them are over 32KB.
I would like to is how to use the other SRAM.



Quote:
P.S.  BTW, this doesn't address the issue that you're going to get truncation of all the entries after the first 255, in your loop here:

>  test_table[x]=x+1;

since your indices will quickly exceed what will fit into 1 byte.  I suspect you're already aware of that.

Thanks to note this, you read my question very carefully. :)

I found 2 links about what i'm going to do.
And it seems that it could be placed to peripheral SRAM now.

http://support.code-red-tech.com/CodeRedWiki/OwnLinkScripts
http://support.code-red-tech.com/CodeRedWiki/PlacingData
0 Kudos

572 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Mark_O on Tue Aug 31 22:20:45 MST 2010
George,

actually, there are 3 SRAM regions: one 32K, and two of 16K, though the 2 peripheral RAM regions are at least contiguous in the address space.

To directly answer your question, even though there is 64K of RAM on the LPC1768, I don't think you can do what you're trying to do.  The reason being that the single array you've defined uses up ALL of the main SRAM block.  For that to work, you'd have to push ALL other data items out of that space, and into the peripheral SRAM blocks.  Including your stacks. 

I haven't done enough with this processor yet to know if that's possible or not.  Perhaps someone else with more experience can jump in.

BTW, since the main SRAM and peripheral SRAM blocks are NOT contiguous in the memory space, there is no possibility of linearly extending one data segment across them.  You probably need to evaluate whether you really need a 32KB array, or if you can get by with a smaller, or dynamic structure.

- Mark

P.S.  BTW, this doesn't address the issue that you're going to get truncation of all the entries after the first 255, in your loop here:

>  test_table[x]=x+1;

since your indices will quickly exceed what will fit into 1 byte.  I suspect you're already aware of that.
0 Kudos