• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Linker error: global RAM variables size is too large

Status
Not open for further replies.

bhakti_dinar

New Member
Hello master,
this is my second thread continue last thread about my final project program avr barcode,
I have made program in code vision avr, based on mikro atmega8535
First i have compiled and no errors,
and then I building appear errors "Linker error: global RAM variables size: 1488 bytes is too large"

Anyone can solve my problem because i just newbie.
pliss master

Thanks

Best regards
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
You have over stepped you Ram limits.... Two options... get a bigger AVR with more Ram... or optimize your code with less Ram usage

That chip only has 512 bytes available ( a third of what you need )
 

kubeek

Well-Known Member
Most Helpful Member
2048 to be exact, but anyway first you need to get rid of any strings that are present in the code and move them to program memory That is usually the biggest memory hog. Second thing you can do if you have some large buffers then you need to declare them in global scope and re-use them for different parts of code.
 

bhakti_dinar

New Member
Thanks master kubeek,
sorry i wanna ask u again,
first, do you mean strings code have to move in program memory flash,right?
And the second thing for some large buffers can you learn me a little bit, because i still not understand to "declare in global scope" and re-use them for different parts of code..

best regards
 

kubeek

Well-Known Member
Most Helpful Member
Thanks master kubeek,
sorry i wanna ask u again,
first, do you mean strings code have to move in program memory flash,right?
And the second thing for some large buffers can you learn me a little bit, because i still not understand to "declare in global scope" and re-use them for different parts of code..

best regards
Frankly I have no idea how your code works, but I doubt you really need 1500 bytes of ram.
Global scope means you dont declare your variables inside main or any other function, but you declare them outside of main, right after includes. This way any function can access those variables, so for example if you need some large buffer for strings coming through UART and then you neeed a similar buffer for something else at different time, you can reuse the buffer for multiple purposes without decalring another one and wasting ram.

Imagine you´re writing it in assembler, there you need to be as compact as possible and try to use only the 32 registers, and using ram as little as possible.
 
Last edited:

bhakti_dinar

New Member

kubeek

Well-Known Member
Most Helpful Member
Sorry, I am not willing to register for yet another site, can´t you just attach the code to your post?
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
Reading through that code..... WOW... This guy likes pascal, that's for sure...

You are definitely going to need the bigger Mega32... I don't think anyone can squeeze that into 512 bytes...

Like Kubeek said.... just change the chip.... its the same pinout.
 

magvi

Member
save the strings that go to lcd in code memory and use pointers to fetch data. you can use the ram as buffer, read the data and sent the data to lcd without storing it in buffer. scanning time will get affected but worth a try
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top