main.c
Go to the documentation of this file.00001
00049 #include "hw/hw_boot.h"
00050 #include "cfg/cfg_ser.h"
00051
00052 #include <net/xmodem.h>
00053
00054 #include <cfg/compiler.h>
00055 #include <cfg/debug.h>
00056 #include <cfg/macros.h>
00057
00058 #include <drv/ser.h>
00059 #include <drv/timer.h>
00060 #include <drv/flash_avr.h>
00061
00062 #include <string.h>
00063
00064 #include <avr/wdt.h>
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079 void wdt_init(void) __attribute__((naked)) __attribute__((section(".init3")));
00080
00081 void wdt_init(void)
00082 {
00083 MCUSR = 0;
00084 wdt_disable();
00085
00086 return;
00087 }
00088
00089
00090 int main(void)
00091 {
00092 FlashAvr flash;
00093 Serial ser;
00094
00095
00096
00097 flash_avr_init(&flash);
00098
00099 IRQ_ENABLE;
00100
00101 BOOT_INIT;
00102
00103 kdbg_init();
00104 timer_init();
00105
00106
00107
00108 ser_init(&ser, CONFIG_BOOT_PORT);
00109 ser_setbaudrate(&ser, CONFIG_BOOT_BAUDRATE);
00110
00111 xmodem_recv(&ser.fd, &flash.fd);
00112
00113 kfile_close(&flash.fd);
00114 kfile_close(&ser.fd);
00115
00116 IRQ_DISABLE;
00117
00118 BOOT_END;
00119
00120 START_APP();
00121
00122 }
00123