How do I know how much memory space is left?

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've been growing the code in a program I'm working on. The latest function I added is causing the program to behave very strange (LCD is printing garbage and the program seems to be skipping steps). This is happening even if I comment out the line in the main() that calls this function.

My only theory is that I'm running out of space. Is there a way I can tell if I'm running low on memory in the AVR?

I'm using AVR Studio 4.14 on Windows 2000 with a STK500 and an ATmega16 on.

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

map file ?

Mike Adams
ADI Development, Inc.
http://www.adidev.com

... When it has to actually work.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What does your build output show, it looks like this:

AVR Memory Usage
----------------
Device: atxmega64a3

Program:    2312 bytes (3.3% Full)
(.text + .data + .bootloader)

Data:         30 bytes (0.7% Full)
(.data + .bss + .noinit)


Build succeeded with 0 Warnings...

1) Studio 4.18 build 716 (SP3)
2) WinAvr 20100110
3) PN, all on Doze XP... For Now
A) Avr Dragon ver. 1
B) Avr MKII ISP, 2009 model
C) MKII JTAGICE ver. 1

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The key thing (assuming it is avr-gcc you are using) in that output that IJ shows is the Data figure. A rough rule of thumb is that percentage must not be greater than 70% - if it is start by looking at using PROGMEM.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well I guess my theory was correct.

Here is my build print out:

AVR Memory Usage
----------------
Device: atmega16

Program:   12550 bytes (76.6% Full)
(.text + .data + .bootloader)

Data:        963 bytes (94.0% Full)
(.data + .bss + .noinit)


Build succeeded with 2 Warnings...

Thanks guys I never paid much attention to the build statements other than for errors and warnings. Looks like I have some trimming to do.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'll bet some of those 936 bytes can go into PROGMEM.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks, I may give PROGMEM a try.

My other solution is just to drop in a ATmega1284.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

To other compiler users reading this post..... the iccv7avr compiler has a box called "all strings in flash" (as opposed to copying them all to ram at powerup) in the IDE, and there are a parallel set of 'const print' statements (cprintf(...) that fetch the format string from flash rather than ram.

Imagecraft compiler user