0:0 E-0 Linker error: Not enough RAM, what is it ?

General discussion on mikroBasic for AVR.
Post Reply
Author
Message
emule
Posts: 22
Joined: 17 Aug 2008 00:15

0:0 E-0 Linker error: Not enough RAM, what is it ?

#1 Post by emule » 18 Aug 2008 23:33

hi,

atmega32 + mikrobasicavr

when i declare this

dim buftemp as byte[1024]

i have a error message follow


0:0 E-0 Linker error: Not enough RAM

when i use const buftemp as byte[1024] = (0,0,0, ....)

it work but i can't modify buftemp because is a constante

what is it ?

this provide from atmega32 ?

thanks for your response
Last edited by emule on 23 Aug 2008 21:36, edited 1 time in total.

emule
Posts: 22
Joined: 17 Aug 2008 00:15

#2 Post by emule » 23 Aug 2008 21:33

any idea ?

JerryHRoss
Posts: 41
Joined: 31 Jan 2008 14:27

#3 Post by JerryHRoss » 23 Aug 2008 21:36

It appears that you have declared enough variables which have already consumed over 1024 bytes of the Mega32 RAM - there is 2048 bytes available. (Unless you have external SRAM on your board.)
Some of that 2048 bytes is used for stacks and the compiler run-time support, leaving less that 2048 bytes available for your use.

I just created a very simple program;

program ArrayTest

dim buftemp as byte[1024]
dim data, i as word

main:
for i=0 to 1023
buftemp=00
next i
end.

Once compiled the compiler reported that 1154 bytes of SRAM were used and that there are 477 bytes available for use. That equates to 2048 - 1154 - 477 = 417 bytes used for stacks and run-time support.

Or stated another way; I have a total of 1631 bytes available for my program to use. That will likely change on a case by case basis when calling subroutines, library functions, etc.

JerryHRoss
Posts: 41
Joined: 31 Jan 2008 14:27

#4 Post by JerryHRoss » 23 Aug 2008 21:41

When you declare the array as const I suspect that MikroBasic places the array in flash where it cannot be modified at run-time.

The array must be in SRAM for you to be able to modify it at run-time.

emule
Posts: 22
Joined: 17 Aug 2008 00:15

#5 Post by emule » 24 Aug 2008 12:40

thank for your response .

Post Reply

Return to “mikroBasic for AVR General”