How does memory configuration works?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How does memory configuration works?

2,022件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by zou9a on Mon Feb 22 03:03:37 MST 2016
Hi,
I'm using the last LPCXpresso, to make an application embedded on a LPC1788 + an external SDRAM 32M (K4S561632C)

I have to use and split the ext.SDRAM to 4 regions. The first and the second will be used for the LCD buffer (2 LCD buffer), the third one is an array of a &graphic objet. The last one will save the content of the graphic object. simple no

I started by creating a new memory in the project's properties -> MCU settings -> Memory config.

Then, I have allocated using malloc a big array:

      
 unsigned long* unUsed;
unUsed = malloc(512*1024*1024*sizeof(unsigned long));
_printPointer(50, 100, "unUsed pointer", &unUsed[512*1024*1024-1]);


The printed address returns me 0x9000 1160. When I looked to the UM, it seems that address corresponds to an external SRAM and not the external SDRAM (might be 0xA........ in my case)

So, my question is why I have this value and not the attended one?

Thank you
0 件の賞賛
返信
5 返答(返信)

1,928件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by vtw.433e on Mon Feb 22 10:03:08 MST 2016
pvHeapLimit?
0 件の賞賛
返信

1,928件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by zou9a on Mon Feb 22 08:56:45 MST 2016
1. Ok, thank you for the hint - now it's 0xA017E800

2. I see my mistake,
PROVIDE(_pvHeapStart =0xA017E800)
should work now

3. Yes, I must use it. Because only 3 region in my external RAM (before 0xA017E800) will be static, the rest save some graphical objects and it must be dynamically managed.

Q: for the static region before 0xA017E800, how I can be sure that my application will not use it? I'm sure that malloc will not because of
PROVIDE(_pvHeapStart =0xA017E800)
.
Can I define a limit of malloc such 0xA1FFFFFF?

Thanks again
0 件の賞賛
返信

1,928件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by vtw.433e on Mon Feb 22 07:15:42 MST 2016
1. malloc is allocated from the heap and there is just one heap. The heap needs to be 8-byte aligned - 0xA017E7F5 is not 8-byte aligned.

2. DEFINED is a linker directive that returns true (1) or flase (0) is a symbol is defined. As 0xA017E7F5 is not a symbol, it is going to return false (0), so you are setting the start of the heap to zero!

3. Are you sure you want to use malloc for this? If you always want to used fixed-size, fixed-location areas, then just use them - either define a pointer or use one of the 'linker methods' such as defined in this FAQ:
https://www.lpcware.com/content/faq/lpcxpresso/data-different-ram-blocks
0 件の賞賛
返信

1,928件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by zou9a on Mon Feb 22 06:02:53 MST 2016
No sorry, It was 5 not 512. I have read it and that's not the question

I try to use malloc into the ext, and I cant. I have modified the script linker, I add memory on the memory configuration of lpcxpresso, nothing work.

True, the K4S561632C is 256M but I will use just 32M, because it's bus address must be multiplexed to use all available memory and I will not do it. 32M it's enough for me.

My question was: how to use malloc outside from 0xA017E7F5 to 0xA1FFFFFF.

PROVIDE(_pvHeapStart = DEFINED(0xA017E7F5); //doesnt work
0 件の賞賛
返信

1,928件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by vtw.433e on Mon Feb 22 05:37:41 MST 2016
So, you are trying to malloc 2048 Mbytes (512*1024*1024*4 =  512*4 * 1Mbyte) ? What do you think that will do?

Suggest you read the user manual on Memory COnfiguration. And then read the numerous FAQs on memory

p.s. When I look up K4S561632C, I see it is a 256Mbit part - i.e. 8Mbyte...
0 件の賞賛
返信