I am working on MCB2300 (with LPC2378 processor)and using keil uVision4. In my program I am creating dynamic memory using malloc() function. As all dynamic contents will be stored in heap, I need to ensure that required heap size allocated. The default value for heap in my startup file (LPC2300.s) is 0x00000800. In my application I am reading an image (bmp format) and storing the pixel values into a matrix and the matrix is created dynamically with respect to size of input image. The maximum heap value I can set in my start up file is 0x000072FF. For this value of heap, I was able to read an image of 44 x 33 successfully. Beyond this size memory is not allocated. I need to read an image with dimensions of atleast 100 x 100. My available RAM is 32K
These are my output values after I compile my code
Program Size: Code=30664 RO-data=1220 RW-data=132 ZI-data=37628
How to provide additional heap?
Is it possible to store heap memory on SD/MMC card or external memory bank which has been provided for LPC2378. Please help me to solve this problem
If your board has external RAM chip, you can use it for heap. But if there are no external RAM, there are no way to increase heap size above internal RAM size.
You can write some variant of virtual memory driver to use SD/MMC card as memory device. But since your device has no MMU (memory management unit), your driver will be extreme complex and extreme slow. So it is not an option.
Also, having 28K of heap, you can hold 99x99 RGB24 BMP image there. 99*99*3 = 29403.