Bootloader size

Hello,

I'd like to know the size of my bootloader. How can I check it?
It seems my sketch size is exceeding the memory of the microprocessor

I've got an Arduino NG rev.c (13415) with an ATMEGA168 on it, that was bought about 3 month ago.
This means it has 16 kByte of programmable flash memory on which the bootloader is located, right?
Now I'd like to know the size of my bootloader, so I can determine how big my programs can be.

I've uploaded a sketch of 6242 bytes that worked. After adding a new procedure, it was 6468 bytes and didn't work anymore, even though the procedure wasn't even called.
This is reproducable, after I exceed a certain size limit (around 6300 bytes).

Am I running out of space? But that would mean that the bootloader already takes half of the available memory. I thought it was only about 2 kByte.

Any suggestions?

Chris

The bootloader is only 2 KB, so you should have 14 KB of Flash for your sketch. Is it possible that you're running out of RAM? There's only 1 KB of that. What are you adding or subtracting to change the size of your sketch? What happens when it doesn't work?

Hmm, perhaps it has something to do with the RAM. I've got a lot of global variables. Is the microprocessor loading all of them into the RAM, when running? How do I know what is loaded into the RAM?

To be honest, I don't even know anymore, what I've changed in my code. I've commented out some procedures and variables I didn't need necessarily. This included two global float arrays, perhaps this was too big for the RAM.

Now it works even with a bigger file size.

Still, I'd like to know how I can estimate the size used in the RAM.

Thanks for your quick reply

Regards,

Chris

If you can figure out where arduino put your .elf file, and where it has your tools, you can use avr-size to figure out ROUGHLY how much ram is in use. ie:

/arduino-0008/tools/avr/bin/avr-size menu.elf 
   text    data     bss     dec     hex filename
   2532     124     143    2799     aef menu.elf

RAM should be the data value, plus the bss value, plus the stack (which isn't reported.)