Electronic – ATTiny13 — avr-gcc Hello World uses over 100 bytes


I'm trying to write a program for the ATTiny13. My problem is that it has huge size constraints. Well, when making my first Hello World program, it took 100 bytes of program space just to make a light turn on and off! Are there any options I can give to avr-gcc to shrink this size down? Also, what is in the crt0? I'm not too keen on AVR assembly so I don't understand it much..

I do not want to have to drop to assembly for this project..

Best Answer

crt0 is the startup routine for the uC. The routines performs the setup of the registers and also the initialization of data.

Does the 100 bytes include the interrupt vector table? I am not sure about the ATtiny13 but the ATtiny25/45/85 has 15 interrupts vectors. This would take up 30 bytes.

gcc has an option to link in your crt0. You could take the AVR crt0.S file and modify it. It is not very long so it should not be difficult to do.