memory problem

memory problem

Postby Manoj » Wed Jan 29, 2020 6:09 am

Hello,
I need to store values in an integer array whose size is approximately 4096.
I declared :
int Samp_Value[4096];
But the compiler says:
/*************************************/
xldtob.o: Link Error: Could not allocate section .data, size = 72 bytes, attributes = data
Objects\USB Data Logger - C30\usb_host_msd.o: Link Error: Could not allocate section _019a3cb05e3112c0, size = 58 bytes, attributes = bss
xldtob.o: Link Error: Could not allocate section .dconst, size = 50 bytes, attributes = data
xlitob.o: Link Error: Could not allocate section .data, size = 34 bytes, attributes = data
Objects\USB Data Logger - C30\usb_host.o: Link Error: Could not allocate section _01a026905e3112be, size = 16 bytes, attributes = bss
Objects\USB Data Logger - C30\usb_config.o: Link Error: Could not allocate section .data, size = 28 bytes, attributes = data
Objects\USB Data Logger - C30\usb_host.o: Link Error: Could not allocate section .bss, size = 18 bytes, attributes = bss
Objects\USB Data Logger - C30\mainprogram.o: Link Error: Could not allocate section .pbss, size = 16 bytes, attributes = persist
Objects\USB Data Logger - C30\mainprogram.o: Link Error: Could not allocate section .data, size = 10 bytes, attributes = data
Objects\USB Data Logger - C30\usb_host_msd_scsi.o: Link Error: Could not allocate section .bss, size = 6 bytes, attributes = bss
malloc.o: Link Error: Could not allocate section .data, size = 6 bytes, attributes = data
ldiv.o: Link Error: Could not allocate section .data, size = 2 bytes, attributes = data
xgenld.o: Link Error: Could not allocate section .dconst, size = 2 bytes, attributes = data
div.o: Link Error: Could not allocate section .data, size = 2 bytes, attributes = data
brk.o: Link Error: Could not allocate section .bss, size = 2 bytes, attributes = bss
heap: Link Error: Could not allocate section .heap, size = 512 bytes, attributes = heap
Link Error: Could not allocate data memory
Link step failed.
/*****************************************************/
when I decalre
int Samp_Value[1024];
It successfully compiles.
Is there any way to increase the size upto 4096?
I am using pic24fj256gb110 with mplab icd3.
Thank you.
Manoj
 
Posts: 37
Joined: Mon Apr 09, 2018 8:01 am

Re: memory problem

Postby AussieSusan » Thu Jan 30, 2020 2:38 am

The pic24fj256gb110 has 16K bytes of RAM. An 'int' variable uses 2 bytes so an array of 4096 'int's will take 8192 bytes or half of your memory.
I see that you are also using USB which probably has some buffers of its own.
Therefore the text of the 'Link Error:' line ("Could not allocate data memory") probably says it all.
As to how to get around it, different MCU with more RAM; rearrange your app so it uses less memory; come up with a paging system that uses 4 pages of 1024 'int's each....
I guess the real answer must come from the application designer (i.e. you).
Susan
AussieSusan
Verified identity
 
Posts: 173
Joined: Mon Jun 16, 2014 4:45 am
PIC experience: Experienced Hobbyist

Re: memory problem

Postby Manoj » Thu Jan 30, 2020 5:30 am

Right.Thanks
Manoj
 
Posts: 37
Joined: Mon Apr 09, 2018 8:01 am


Return to PIC24

Who is online

Users browsing this forum: No registered users and 4 guests

cron