main.c

Go to the documentation of this file.
00001 
00049 #include <net/xmodem.h>
00050 #include <cfg/compiler.h>
00051 #include <cfg/debug.h>
00052 #include <cfg/macros.h> /* BV() */
00053 
00054 #include <drv/wdt.h>
00055 #include <drv/ser.h>
00056 #include <drv/timer.h>
00057 #include <drv/flash_avr.h>
00058 
00059 #include "hw/hw_boot.h"
00060 #include "cfg/cfg_boot.h"
00061 
00062 #include <string.h>
00063 
00064 int main(void)
00065 {
00066     FlashAvr flash;
00067     Serial ser;
00068 
00069 
00070     // Set up flash programming functions.
00071     flash_avr_init(&flash);
00072 
00073     IRQ_ENABLE;
00074 
00075     BOOT_INIT;
00076 
00077     kdbg_init();
00078     timer_init();
00079 
00080 
00081     /* Open the main communication port */
00082 
00083     ser_init(&ser, CONFIG_SER_HOSTPORT);
00084     ser_setbaudrate(&ser, CONFIG_SER_HOSTPORTBAUDRATE);
00085 
00086     xmodem_recv(&ser, &flash.fd);
00087     kfile_close(&flash.fd);
00088     kfile_close(&ser.fd);
00089 
00090     IRQ_DISABLE;
00091 
00092     BOOT_END;
00093 
00094     START_APP();
00095 
00096 }
00097