Page 1 of 1
Trouble fitting USBaspLoader
Posted: Tue May 04, 2010 5:27 am
by frank26080115
I can't seem to compile USBaspLoader to fit within 2048 bytes with any of the settings (all chips ranging from atmega8 to atmega328p, all supported clocks from 12 to 20 MHz)
I uploaded the resulting hex files to my chip (atmega168 with a 12mhz clock) anyways and the computer won't enumerate my device.
How did you do it? you compiled it to 1912 bytes for the atmega168 at 12mhz, changed my D- pin number and the bootloader exit condition and edited the makefile and ran make and it gave me 2164.
is there a specific compiler version? does it matter that i'm running a 64 bit computer? if you tell me how to compile all of these bootloaders correctly, I'll setup a VM with the right OS and compiler to do the compiling.
I seriously only want to change the D- pin to PD7 and use PB7 for the jumper
Re: Trouble fitting USBaspLoader
Posted: Wed May 05, 2010 3:29 am
by frank26080115
ok i've compiled it for the atmega328p with the 4k bootloader setting (instead of 2k so it will fit) and my own pin configuration and it works, so now i just have to figure out how to compile it under 2k so it works with other chips.
did you manually optimize the disassembly or something?
Re: Trouble fitting USBaspLoader
Posted: Wed May 05, 2010 4:36 am
by santacruzbob
Frank,
I've had luck compiling this code using gcc 3.4.6
for whatever reason the old compilers generated considerably smaller code. There are a few options in bootloaderconfig.h that you can remove to save some space (eeprom access options?). I was able to compile this with 4.3.4 and fit it in the 2k bootloader section. Do you have any atmega88p/88pa by chance? I've got code that works perfectly with the atmega88 but doesn't work with the atmega88p and I've been trying to find the problem for nearly a year now. I'm beginning to think it's a problem with the silicon? If you've got either of those chips I'd love to hear back regarding success/failure with usbasploader (and other v-usb based bootloaders). -Bob
Re: Trouble fitting USBaspLoader
Posted: Wed May 05, 2010 5:06 am
by frank26080115
i did some code changes to "USBaspLoader.2009-03-20"
file usbdrvasm.S
line 59
# define USB_INTR_VECTOR INT0_vect
this change made V-USB work with the ATmega328P whereas before it would not due to a mis-defined interrupt vector name
refer to this post
viewtopic.php?f=8&t=2663&p=11457&hilit=168p#p11936this may fix your problem with your 88P chip
i've also commented out all "DBG1" and the "odDebugInit" but I understand that they are not enabled anyways, i even commented out the oddebug.c in the makefile
and wrote a batch file to make all of them
using WinAVR-20100110
Code: Select all
text data bss dec hex filename
0 2038 0 2038 7f6 atmega168_12000000.hex
0 2358 0 2358 936 atmega168_12800000.hex
0 2094 0 2094 82e atmega168_15000000.hex
0 2104 0 2104 838 atmega168_16000000.hex
0 2226 0 2226 8b2 atmega168_16500000.hex
0 2086 0 2086 826 atmega168_20000000.hex
0 2038 0 2038 7f6 atmega168p_12000000.hex
0 2358 0 2358 936 atmega168p_12800000.hex
0 2094 0 2094 82e atmega168p_15000000.hex
0 2104 0 2104 838 atmega168p_16000000.hex
0 2226 0 2226 8b2 atmega168p_16500000.hex
0 2086 0 2086 826 atmega168p_20000000.hex
0 2038 0 2038 7f6 atmega328p_12000000.hex
0 2358 0 2358 936 atmega328p_12800000.hex
0 2094 0 2094 82e atmega328p_15000000.hex
0 2104 0 2104 838 atmega328p_16000000.hex
0 2226 0 2226 8b2 atmega328p_16500000.hex
0 2086 0 2086 826 atmega328p_20000000.hex
0 1972 0 1972 7b4 atmega88_12000000.hex
0 2028 0 2028 7ec atmega88_15000000.hex
0 2034 0 2034 7f2 atmega88_16000000.hex
0 2016 0 2016 7e0 atmega88_20000000.hex
0 1972 0 1972 7b4 atmega88p_12000000.hex
0 2028 0 2028 7ec atmega88p_15000000.hex
0 2034 0 2034 7f2 atmega88p_16000000.hex
0 2016 0 2016 7e0 atmega88p_20000000.hex
0 1950 0 1950 79e atmega8_12000000.hex
0 2006 0 2006 7d6 atmega8_15000000.hex
0 2012 0 2012 7dc atmega8_16000000.hex
0 1994 0 1994 7ca atmega8_20000000.hex
i've confirmed that the atmega168 and atmega328P works with the 2k bootloader version now at 12 MHz (the only chips and clock i have on hand)
The atmega328P always have the 4k boot option so i'm not concerned about the other clock speeds, it looks like the hex for the atmega8 and atmega88 are all fine, i need to get the atmega168 versions working
edit: i found the avr-gcc version you are talking about and it does indeed compile into smaller hex files, problem solved, thanks