compiling 2.0 firmware

USB AVR Programmer and SPI interface. Adafruit's USBtinyISP.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
jgrauman
 
Posts: 12
Joined: Fri Jan 04, 2008 1:45 am

compiling 2.0 firmware

Post by jgrauman »

I think I have all the tools installed to compile and burn chips properly. Unfortunately, I'm trying to compile the usbtiny firmware and the compiler isn't optimizing enough to fit onto the chip. avr-gcc --version yields:
avr-gcc (GCC) 4.2.1

To compile the firmware, I used the supplied makefile. Here are my results. I've tried changing the -Os to various settings, but nothing has been able to shrink the flash size enough to fit onto the attiny2313. Any thoughts? Thanks.

Josh

avr-gcc -Os -g -Wall -I. -I../usbtiny -mmcu=attiny2313 -c ../usbtiny/crc.S
avr-gcc -Os -g -Wall -I. -I../usbtiny -mmcu=attiny2313 -c ../usbtiny/int.S
avr-gcc -Os -g -Wall -I. -I../usbtiny -mmcu=attiny2313 -c ../usbtiny/usb.c
avr-gcc -Os -g -Wall -I. -I../usbtiny -mmcu=attiny2313 -c -o main.o main.c
avr-gcc -g -mmcu=attiny2313 -o main.elf crc.o int.o usb.o main.o
text: 2096, data: 2, bss: 60
ERROR: Flash size limit exceeded by 50 bytes.
make: *** [main.hex] Error 1

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Post by adafruit »


User avatar
rglenn
 
Posts: 20
Joined: Thu Oct 04, 2007 10:36 pm

Post by rglenn »

Wow. You totally called that one :)

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Post by adafruit »


User avatar
jgrauman
 
Posts: 12
Joined: Fri Jan 04, 2008 1:45 am

Post by jgrauman »

As you can see from my output, the firmware compiles fine, it's just that your project is on the edge of what can fit onto an attiny2313 and different versions of compilers optimize things differently. I'm also able to burn firmware fine, it's clearly a compiler issue. For some reason avr-gcc 4.2.1 makes the final hex file 50 bytes larger than whatever version others are using. I mainly wanted two pieces of information. 1) confirmation that you use the supplied makefile to compile the firmware (and thus confirmation that you are using the same the optimizations that you see from my example), and 2) the version of avr-gcc you are using.

Sorry for not making these requests explicit, I thought they were clear from my post. Thanks.

Josh

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Post by adafruit »

I'm having trouble compiling/burning the chip for this project...

Use the precompiled .hex file and Makefiles as your compiler may not be able to squeeze the code down to fit in the chip. Modify the Makefile in spi as needed and, in the spi folder, type in "make fuse flash" Beyond that, you're on your own.



http://www.ladyada.net/make/usbtinyisp/help.html

ive updated it to answer your question as specifically as possible
Last edited by adafruit2 on Sat Jan 05, 2008 5:23 pm, edited 1 time in total.

User avatar
jgrauman
 
Posts: 12
Joined: Fri Jan 04, 2008 1:45 am

Post by jgrauman »

You won't even tell me what version of avr-gcc you are using?

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Post by adafruit »

jgrauman wrote:You won't even tell me what version of avr-gcc you are using?
hey, if you want to build this project without buying a kit you need to spend some time doing your own research instead of posting a question every 3 minutes! :)

http://www.google.com/search?q=avr-gcc+code+size
Last edited by adafruit2 on Sat Jan 05, 2008 5:29 pm, edited 1 time in total.

User avatar
jgrauman
 
Posts: 12
Joined: Fri Jan 04, 2008 1:45 am

Post by jgrauman »

I did buy a kit... No problem I'll try different versions of gcc.

User avatar
jgrauman
 
Posts: 12
Joined: Fri Jan 04, 2008 1:45 am

Post by jgrauman »

To build another usb device. The reason I bought your kit is I'm working on a project to build a usb controlled BANNED copier (using an avr). The hardware is finished, so I'm working on interfacing it to usb and the firmware and linux drivers. Your programmer is a good starting point to getting usb to work. So I'm using your programmer to program another attiny2313 which I'm then putting back into the programmer to test usb drivers, etc... Thanks for your work on the project, I really didn't mean to be a bother, I thought they would be quick/easy questions. - Josh

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Post by adafruit »

jgrauman wrote:To build another usb device. The reason I bought your kit is I'm working on a project to build a usb controlled BANNED copier (using an avr). The hardware is finished, so I'm working on interfacing it to usb and the firmware and linux drivers. Your programmer is a good starting point to getting usb to work. So I'm using your programmer to program another attiny2313 which I'm then putting back into the programmer to test usb drivers, etc... Thanks for your work on the project, I really didn't mean to be a bother, I thought they would be quick/easy questions. - Josh
no problem. i've been answering email/posts nonstop for 6 hours so im getting a bit snarky :)
good luck with that project, theres not much space on the 2313 you may have to upgrade to an atmega8.
i think im going to take a hot cocoa break before my head explodez from more posting!@

timv
 
Posts: 82
Joined: Thu Nov 01, 2007 4:13 pm

Post by timv »

Coincidentally I ran into exactly the same thing this afternoon trying to find some way to compile that code under Ubuntu Linux. I fought it tooth and nail and eventually licked it.

I just posted a long report about what's going on and how I fixed it:
http://www.ladyada.net/forums/viewtopic.php?t=4770

(I haven't bought a USBtinyISP kit either. But I bought a MiniPOV3 kit and have never assembled it or asked any questions about it. Do I get a mulligan for that?)

Locked
Please be positive and constructive with your questions and comments.

Return to “USBtinyISP”