Not enough memory

When programming the Arduino, I noticed that the memory is very small. I thought 6K of memory would be sufficient enough to do what i needed to do however it was used up quickly. Is this because the compiler is inefficient? Is there a way that I can increase the memory externally?

One possible solution is to buy an ATmega168 which has twice as much program memory as the ATmega8 (16 KB instead of 8). We’ve had a hard time finding them in Italy, but you might have better luck. You’ll need to burn the bootloader on them, which will require an AVR-ISP or parallel port programmer. It might also require a bit of tweaking to the preferences file, but nothing major, I think.

Alternatively, if you reburn the bootloader with the “Tools | burn bootloader” menu command in Arduino, you should get an extra kilobyte of program space (7KB instead of 6).

I’m running out of space too. And I’m loosing my hair to find a way to be more efficient and remove bytes of instructions. :o The program doesn’t seems to be long and complex at all, but I have to separate the program in parts and run thems on different boards.

I had a look at the bootloader and it seems to take more than 50 of the memory. Is there a way to shrink some parts of the boot loader? Remove analog instruction for example when the project concern only the digital pins? Or different Bootloader lights versions?

Are you running out of program memory (of which there is 8 KB on the ATmega8) or RAM (1 KB available)? If the former, and you have a hardware programmer (e.g. AVR-ISP), you could program the Arduino board without a bootloader to get an extra 1 KB of program space. Otherwise, you might be able to comment out some parts of the core Arduino libraries (in ARDUINO/lib/targets/arduino) that you aren’t using. What does your code need to be able to do?

I’ve found a retailer of the ATmega168 here in Sweden, which is also selling them for a pretty good price. However, my understanding of burning bootloaders etc is virtually non-existent. Could you write a piece of some sort, like a guide, on how to upgrade an Arduino with the 168 variant?