Golem:/Applications/arduino-0009/bootloader168 brian$ make ngavr-gcc -g -Wall -O2 -mmcu=atmega168 -DF_CPU=16000000L '-DMAX_TIME_COUNT=F_CPU>>1' '-DNUM_LED_FLASHES=3' -c -o ATmegaBOOT_168.o ATmegaBOOT_168.cavr-gcc -g -Wall -O2 -mmcu=atmega168 -DF_CPU=16000000L '-DMAX_TIME_COUNT=F_CPU>>1' '-DNUM_LED_FLASHES=3' -Wl,--section-start=.text=0x3800 -o ATmegaBOOT_168_ng.elf ATmegaBOOT_168.o avr-objcopy -j .text -j .data -O ihex ATmegaBOOT_168_ng.elf ATmegaBOOT_168_ng.hexrm ATmegaBOOT_168_ng.elf ATmegaBOOT_168.oGolem:/Applications/arduino-0009/bootloader168 brian$ ls -ltotal 80-rwxr-xr-x 1 brian staff 27114 Aug 6 18:20 ATmegaBOOT_168.c-rw-r--r-- 1 brian staff 5181 Aug 20 10:16 ATmegaBOOT_168_ng.hex-rwxr-xr-x 1 brian staff 2404 Aug 20 10:15 Makefiledrwxr-xr-x 4 brian staff 136 Aug 20 10:09 tempholdGolem:/Applications/arduino-0009/bootloader168 brian$ cd tempholdGolem:/Applications/arduino-0009/bootloader168/temphold brian$ ls -ltotal 32-rw-r--r-- 1 brian staff 5165 Aug 6 18:20 ATmegaBOOT_168_diecimila.hex-rw-r--r-- 1 brian staff 5165 Aug 6 18:20 ATmegaBOOT_168_ng.hexGolem:/Applications/arduino-0009/bootloader168/temphold brian$
Maybe you've got a different version of avr-gcc than I do? I'm not sure which one I used to build them, to honest.
I wasn't that clever actually - it just grabs whichever one happens to be in your path (which doesn't include the one that comes with Arduino unless you've added it yourself).
No problem. The length of the bootloader wait is set by the MAX_TIME_COUNT constant which is defined in the Makefile (in the ng: or diecimila: targets). In both cases it's based on the F_CPU constant that corresponds to the clock speed of the microcontroller (16 MHz in the case of Arduino). The code that uses the MAX_TIME_COUNT constant is the getch() function, which waits for character input from the computer. If it doesn't receive a character in the right amount of time, it calls app_start() which jumps to the beginning of the sketch on the chip. There's also a "timeout" after receiving a certain number of errors, or data that doesn't fit the bootloader protocol (stk500). The error count is incremented anywhere the bootloader receives a byte that doesn't conform to the protocol.
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16