Date:2011-05-10 16:51:46 (8 years 7 months ago)
Author:Werner Almesberger
Commit:ddd00223505d8283637bcd4c0796f2f01262db64
Message:atusb/fw/boot.c (main): don't time out until there is an application

This prevents the boot loader from resetting all the time and makes
it easier to "catch" it with dfu-util.
Files: atusb/fw/boot.c (3 diffs)

Change Details

atusb/fw/boot.c
1414#include <stdint.h>
1515
1616#include <avr/io.h>
17#include <avr/pgmspace.h>
1718
1819#define F_CPU 8000000UL
1920#include <util/delay.h>
...... 
3435
3536int main(void)
3637{
38    /*
39     * pgm_read_byte gets cached and there doesn't seem to be any other
40     * way to dissuade gcc from doing this.
41     */
42    volatile int zero = 0;
3743    uint32_t loop = 0;
3844
3945    board_init();
...... 
4955
5056    while (loop != MS_TO_LOOPS(2000)) {
5157        usb_poll();
52        if (dfu.state == dfuIDLE)
58        if (dfu.state == dfuIDLE && pgm_read_byte(zero) != 0xff)
5359            loop++;
5460        else
5561            loop = 0;

Archive Download the corresponding diff file



interactive